Hello,
I have implemented a Rebex provider that verifies signature and decryps signed and encrypted files.
In general works fine, but when i encrypt and sign a file with the following commands using openssl a get an error on decode method of SignedData object in Rebex.Common.dll:
Exception thrown: 'System.Security.Cryptography.CryptographicException' in Rebex.Common.dll
Additional information: Unsupported ASN.1 type encountered.
opemssl commands i use:
openssl cms -encrypt -outform **pem** -binary -aes256 -in C:\OpenSSL-Win64\bin\TPS-218\initfile.zip -out C:\OpenSSL-Win64\bin\TPS-218\encrypted_fileDER2.enc pemMVgl.pem
openssl cms -sign -outform **pem** -nodetach -binary -md sha256 -inkey privateMVgl.pem -signer pemMVgl.pem -in C:\OpenSSL-Win64\bin\TPS-218\encrypted_fileDER2.enc -out C:\OpenSSL-Win64\bin\TPS-218\signedEncryptedfileDER2.zip
But when i use der instead of pem, it works fine.
commands that my Rebex wrapper can verify-decrypt:
openssl cms -encrypt -outform **der** -binary -aes256 -in C:\OpenSSL-Win64\bin\TPS-218\initfile.zip -out C:\OpenSSL-Win64\bin\TPS-218\encrypted_fileDER2.enc pemMVgl.pem
openssl cms -sign -outform **der** -nodetach -binary -md sha256 -inkey privateMVgl.pem -signer pemMVgl.pem -in C:\OpenSSL-Win64\bin\TPS-218\encrypted_fileDER2.enc -out C:\OpenSSL-Win64\bin\TPS-218\signedEncryptedfileDER2.zip
Related issue that i found but not helped
http://forum.rebex.net/6813/signing-verifying-a-file-with-a-pem-file?show=6834#a6834
What I need is my Rebex wrapper to do the operation regardless the above difference. Please advice.
Extra info regarding my implementation:
I have the certificates imported in trusted windows store, so using a certificate finder that i pass to the SignedData object i decode the data. But in this case it seems in the beginning of the decode method that it is passed an unsupported content.
byte[] content =...read bytes(the signed file)
signedData.Decode(content);// this usually works except fr this case which throws the exception above
FYI: I cannot change the ssl commands from pem to der because they are used by another system that i have no access.
My client has a similar issue decrypting :
system.Security.Cryptography.CryptographicException: Unable to decrypt data (0x80090005).
at kftm.rxkm(Byte[] ggv, kfwo ggw)
at Rebex.Security.Cryptography.AsymmetricKeyAlgorithm.Decrypt(Byte[] rgb, EncryptionParameters parameters)
at Rebex.Security.Cryptography.Pkcs.KeyTransRecipientInfo.smqc(Boolean gnd)
at Rebex.Security.Cryptography.Pkcs.EnvelopedData.GetSymmetricKey()
at Rebex.Security.Cryptography.Pkcs.EnvelopedData.cggr()
at Rebex.Security.Cryptography.Pkcs.EnvelopedData.Decrypt()