Product: PowerShell Universal
Version: 2.10.1
I am unable to decrypt a secure string as plain text. I get the following error:
[error] Key not valid for use in specified state.
[error] Exception calling "SecureStringToBSTR" with "1" argument(s): "Value cannot be null. Parameter name: s"
[error] Cannot find an overload for "PtrToStringAuto" and the argument count: "1".
I’ve tried both ConvertFrom-SecureString -AsPlainText and the following:
$decrypted = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($password)
$decryptedPassword = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($decrypted)