PowerShell
On this weblog submit I’ll perform the way to decrypt a safe string. A safe string is a string that’s saved in a non-readable format to briefly retailer passwords and strings. Let’s begin.
For testing functions, retailer a password as a safe string.
$password = ConvertTo-SecureString 'P@ssw0rd' -AsPlainText -Pressure
Subsequent, we’ll use a considerably cryptic code to decrypt this.
$Ptr = [System.Runtime.InteropServices.Marshal]::SecureStringToCoTaskMemUnicode($password)
$outcome = [System.Runtime.InteropServices.Marshal]::PtrToStringUni($Ptr)
[System.Runtime.InteropServices.Marshal]::ZeroFreeCoTaskMemUnicode($Ptr)
Right here is your entire code in motion:
Nice that’s it.
Printed by