ConvertFrom-SecureString - PowerShell


 

Converts a secure string into an encrypted standard string. (ConvertFrom-SecureString)

   

# NAME
ConvertFrom-SecureString

# SYNOPSIS
Converts a secure string into an encrypted standard string.

# SYNTAX
ConvertFrom-SecureString [-Key <Byte[]>] [-SecureString] <SecureString> [<CommonParameters>]

ConvertFrom-SecureString [[-SecureKey] <SecureString>] [-SecureString] <SecureString> [<CommonParameters>]

# DESCRIPTION
The ConvertFrom-SecureString cmdlet converts a secure string (System.Security.SecureString) into an encrypted standard string (System.String). Unlike a secure string, an encrypted standard string can be saved in a file for later use. The encrypted standard string can be converted back to its secure string format by using the ConvertTo-SecureString cmdlet. If an encryption key is specified by using the Key or SecureKey parameters, the Rijndael encryption algorithm is used. The specified key must have a length of 128, 192, or 256 bits because those are the key lengths supported by the Rijndael encryption algorithm. If no key is specified, the Windows Data Protection API (DPAPI) is used to encrypt the standard string representation.

# PARAMETERS
-Key <Byte[]>
Specifies the encryption key as a byte array.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-SecureKey <SecureString>
Specifies the encryption key as a secure string. The secure string value is converted to a byte array before being used as the key.

Required? false
Position? 2
Default value
Accept pipeline input? false
Accept wildcard characters? false

-SecureString <SecureString>
Specifies the secure string to convert to an encrypted standard string.

Required? true
Position? 1
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? false

<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer and OutVariable. For more information, type,
"get-help about_commonparameters".

# INPUTS
System.Security.SecureString
You can pipe a SecureString object to ConvertFrom-SecureString.

# OUTPUTS
System.String
ConvertFrom-SecureString returns a standard string object.

# NOTES

To create a secure string from characters that are typed at the command prompt, use the AsSecureString parameter of the Read-Host cmdlet.

When you use the Key or SecureKey parameters to specify a key, the key length must be correct. For example, a key of 128 bits can be specified as a byte array of 16 digits. Similarly, 192-bit and 256-bit keys correspond to byte arrays of 24 and 32 digits, respectively.

# EXAMPLE 1

C:\PS>$securestring = read-host -assecurestring

# Description
-----------
This command creates a secure string from characters that you type at the command prompt. After entering the command, type the string you want to store as a secure string. An asterisk (*) will be displayed to represent each character that you type.

# EXAMPLE 2

C:\PS>$standardstring = convertfrom-securestring $securestring

# Description
-----------
This command converts the secure string in the $securestring variable to an encrypted standard string. The resulting encrypted standard string is stored in the $standardstring variable.

# EXAMPLE 3

C:\PS>$key = (3,4,2,3,56,34,254,222,1,1,2,23,42,54,33,233,1,34,2,7,6,5,35,43)

C:\PS> $standardstring = convertfrom-securestring $securestring -key $key

# Description
-----------
These commands use the Rijndael algorithm to convert the secure string stored in the $securestring variable to an encrypted standard string with a 192-bit key. The resulting encrypted standard string is stored in the $standardstring variable.

The first command stores a key in the $key variable. The key is an array of 24 digits, all of which are less than 256.

Because each digit represents a byte (8 bits), the key has 24 digits for a total of 192 bits (8 x 24). This is a valid key length for the Rijndael algorithm. Each individual value is less than 256, which is the maximum value that can be stored in an unsigned byte.

The second command uses the key in the $key variable to convert the secure string to an encrypted standard string.

RELATED LINKS
Online version: http://go.microsoft.com/fwlink/?LinkID=113287
ConvertTo-SecureString
Read-Host

C:\Windows>powershell get-help ConvertTo-SecureString -full

ColorConsole [Version 1.7.1000] PowerShell 2.0-Export
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2014 Microsoft Corporation.

OS: Windows 10, 8.1, 8, 7, Vista / Windows Server 2016, 2012, 2008
»»»» ColorConsole








Windows-10





Windows-10

... facebook.de
... Windows-10 FAQ
... Windows-10 Info


Become a Sponsor
... Your button here?





PowerShell: Converts a secure string into an encrypted standard string.

HTTP: ... PS_Windows/en/ConvertFrom-SecureString.htm
0.296
15106

Show delete confirmation dialog on Windows 8.1 / 10 when delete file!

 /

Windows-7, das Farbschema wurde geändert?

 /

What are the individual test values or measurements for hard drives?

 /

Kann ich Dateien von 32-Bit auf einem 64-Bit Betriebssystemen öffnen?

 /

Kann ich die Windows Server 2008 Testversion downloaden?

 /

Download DirectX 11 für Windows 7, 8,1, 10 (Direct3D 11)!

 /

What is TWAIN?

 /

Create Action Center Desktop Shortcut for Windows 8.1/8!

 /

Viewing shares, sessions and open files, cmd example?

 /

Leave the folder size display in a column, does it (Q-Dir)?

 /

How can I activate and deactivate the screen magnifier?

 /

Disable the Windows Store in Windows 8.1 / 10, how to?

 /