Rougher
Rougher

Reputation: 848

Decrypting v20 cookies

I am trying to decrypt v20 cookies in C#. Like it is done here And I am stuck on the 1st step already, on decrypting the app bound key.

var appBoundEncKeyB64 = JObject.Parse(localState)["os_crypt"]["app_bound_encrypted_key"].ToString();
var appBoundEncKey = Convert.FromBase64String(appBoundEncKeyB64).Skip(4).ToArray();
var appBoundDecodedKey = ProtectedData.Unprotect(appBoundEncKey, null, DataProtectionScope.LocalMachine);

I get the next error:

at System.Security.Cryptography.ProtectedData.Unprotect(Byte[] encryptedData, Byte[] optionalEntropy, DataProtectionScope scope)
at Common.BrowserCookieReader.ReadCookieValue(String browserName, String browserCompanyName, String cookieName, String cookieHost, String username)

System.Security.Cryptography.CryptographicException: 'Key not valid for use in specified state.'

NOTE: I run in from Visual Studio in Admin Mode.

Upvotes: 0

Views: 127

Answers (0)

Related Questions