Decrypting DPAPI strings with PowerShell

PowerShell

We can use the ProtectedData class for this


Add-Type -AssemblyName System.Security;
[Text.Encoding]::ASCII.GetString([Security.Cryptography.ProtectedData]::Unprotect([Convert]::FromBase64String("some base64 encoded text"), $null, 'CurrentUser'))

Or


[Text.Encoding]::ASCII.GetString([Security.Cryptography.ProtectedData]::Unprotect([Convert]::FromBase64String("some base64 encoded text"), $null, 'LocalMachine'))

Post a Comment

Previous Post Next Post