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 SecureString
       The secure string to convert to an encrypted standard string.
        
   -secureKey SecureString
       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:
       -Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable,
       -OutBuffer -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:

PS C:\> $my_encrypted_string = 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)
PS C:\> $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 Cmdlets:

ConvertTo-SecureString
Get-Credential - Get a security credential (username/password)
Read-Host - Read a line of input from the host console.


 
Copyright © SS64.com 1999-2019
Some rights reserved