-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jose.EncryptionException: 'Unable to decrypt content or authentication tag do not match #195
Comments
Thanks, i'll try to run soonish. |
Still awaiting your response |
Hi @Dhazan1 , thanks for reminding me. Are you sure that you are using correct P-256 curve key? Especially if private When i replaced your key to other one, it perfectly working. var publicKey = new Jwk(crv: "P-256",
x: "BHId3zoDv6pDgOUh8rKdloUZ0YumRTcaVDCppUPoYgk",
y: "g3QIDhaWEksYtZ9OWjNHn9a6-i_P9o5_NrdISP0VWDU"
);
var privateKey = new Jwk(crv: "P-256",
x: "BHId3zoDv6pDgOUh8rKdloUZ0YumRTcaVDCppUPoYgk",
y: "g3QIDhaWEksYtZ9OWjNHn9a6-i_P9o5_NrdISP0VWDU",
d: "KpTnMOHEpskXvuXHFCfiRtGUHUZ9Dq5CCcZQ-19rYs4"
);
var payload = new Dictionary<string, object>()
{
{"pan","1234567891234567" },
{"exp","1223"}
};
var plain = JsonConvert.SerializeObject(payload);
Console.WriteLine(plain);
var encryptedData1 = Jose.JWE.Encrypt(plain, new[] { new JweRecipient(JweAlgorithm.ECDH_ES, publicKey) }, encryption);
Console.WriteLine(encryptedData1);
var decryptedDataTest = JWE.Decrypt(encryptedData1, privateKey);
Console.WriteLine(decryptedDataTest.Plaintext); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm encrypting, then immediately I'm decrypting, but I keep getting this error.
This is the link to the code write-up https://github.com/Dhazan1/JoseLibraryImplementationInAsp.net/tree/main
The text was updated successfully, but these errors were encountered: