-
Notifications
You must be signed in to change notification settings - Fork 565
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
CmsEnvelope decryption ECCP256 / AES128CBC failed #543
Comments
I have the same issue, do you have any solution for this yet? |
As I see the 166 (8 times )is the DefaultIV in RFC3394WrapEngine.cs line 51 : Array.Copy(DefaultIV, 0, m_iv, 0, 8); if I modify the contents of m_iv here so that the comparison is good later, I get an error later, when calling the pkcs7 pad block:
|
Hi Everyone! I have same problem. And I found the reason of the issue. The input CMS what I want to decrypt was encrypted with the Java version of the Bouncy Castle. The issue is that the Java and Dotnet implementation is working differently. The Java implementation is this:
But the Dotnet implementation is this:
The problem is that if the For examle: So when the CMS was encrypted in Java, in that case the dotnet version can not read the value, because calculates wrong IV. I tried it to change the IV in debug mod to this:
And with this change the decryption works fine. |
HI
The error msg:
when i try to decrypt a cms envelope where the key uese ECC P256
I try to do this:
Envelope encrypted with 2.16.840.1.101.3.4.1.2 (Aes128Cbc)
KeyEcryption AlgOid: 1.3.132.1.11.1 (SHA256)
PublicKeyParamSet {1.2.840.10045.3.1.7} 256-bit Elliptic Curve Cryptography
the UnwrapSessionKey(wrapAlgOid, agreedWrapKey);
WrapOID: {2.16.840.1.101.3.4.1.5} AES128 fo wrapping
agreedKey.m_key: 71,240,93,144,182,231,203,68,70,11,69,126,109,174,71,72
calls:
byte[] sKeyBytes = keyCipher.Unwrap(encKeyOctets, 0, encKeyOctets.Length);
in this, at the end:
if (!Arrays.FixedTimeEquals(a, m_iv))
throw new InvalidCipherTextException("checksum failed");
this is failed.
"a" = 46,166,,123,149,177,43,148,153
but m_iv is loaded with 166 , all the 8 bytes.
The text was updated successfully, but these errors were encountered: