[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[iaik-jce] Padding problem??


As part of investigation another problem, I used your S/MIME tools to create
an encryped email, which I then saved.  After stripping the headers, I then
had just the Base64-encoded DER-coded ContentInfo containing the

I then wrote a small program to parse this, re-constructing the ContentInfo
from an InputStream.  All is well until I try to decrypt the "KeyEncryption
key", when the program barfs and produces the stack trace shown below.
What's particularly confusing is that I can successfully use this program in
the same way  to parse and decrypt a message someone else sent me using
another vendor's toolkit, but can't get it to work with a message built with

Can you shed any light on the subject??



ContentInfo constructed
Enclosed content is of type 'PKCS#7 data'.
Encryption Algorithm used is 'RC2-CBC
EncryptedContentInfo.hasContent() returns true
There are 4232 bytes available in input stream.
Printing out RecipientInfos
RecipientInfo for recipient 0
  ISN: SerialNumber: 159
  Issuer: Blah, blah, blah...

Decrypting using 0  as the index of the RecipientInfo!
PrivateKey retrieved
Key Encryption Algorithm is 'rsaEncryption'.
Error decrypting symmetric key!
iaik.pkcs.PKCSException: javax.crypto.BadPaddingException: Encryption block
has wrong block type!
        at java.lang.Throwable.fillInStackTrace(Native Method)
        at java.lang.Throwable.<init>(Throwable.java:94)
        at java.lang.Exception.<init>(Exception.java:42)
        at iaik.pkcs.PKCSException.<init>(Unknown Source)
        at iaik.pkcs.pkcs7.RecipientInfo.decryptKey(Unknown Source)
        at LoadEncrypted.main(LoadEncrypted.java:196)
Mailinglist-archive at http://jcewww.iaik.tu-graz.ac.at/mailarchive/iaik-jce/maillist.html

To unsubscribe send an email to listserv@iaik.tu-graz.ac.at with the folowing content: UNSUBSCRIBE iaik-jce