ConvertFrom-SecureString

Convert a secure string into an encrypted standard string.

Syntax
      ConvertFrom-SecureString [-secureString] SecureString 
         [[-secureKey] SecureString]
            [CommonParameters]
    
      ConvertFrom-SecureString [-secureString] SecureString 
         [-key Byte[]]
            [CommonParameters]

key
   -secureString 
        The secure string to convert to an encrypted standard string.
        
   -secureKey 
        The encryption key as a secure string,
        this is converted to a byte array before being used as the key.
        
   -key Byte
        The encryption key as a byte array.
        
   CommonParameters
        The common parameters: -Verbose, -Debug,-ErrorAction, -ErrorVariable, -OutVariable.

Examples

Create a secure string by typing at the command prompt.

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

Convert a secure string stored in a variable to an encrypted standard string. The resulting encrypted standard string can be displayed by typing $standardstring:

$standardstring = convertfrom-securestring $securestring

Convert a secure string using the Rijndael algorithm, the key is an array of 24 digits, all of which are less than 256, (24 * 8 bit bytes = 192 bits)

PS C:\>$key = (3,42,2,3,100,34,254,222,1,1,2,23,42,54,33,233,1,64,2,7,6,5,35,43)
$standardstring = convertfrom-securestring $securestring -key $key

"The one permanent emotion of the inferior man is fear of the unknown, the complex, the inexplicable. What he wants beyond everything else is safety" - H. L. Mencken

Related Powershell Commands:

ConvertTo-SecureString
Read-Host



Back to the Top

© Copyright SS64.com 1999-2010
Some rights reserved