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

AW: [iaik-jce] BadPaddingException in RecipientInfo.decryptKey()



I cannot say what´s going on without seeing any source sample. How do you
get the key from the PKCS#12 file (you may use demo.pkcs.PKCS12Create as a
sample showing how to create and parse a PKCS#12 file).

Dieter Bratko

-----Ursprüngliche Nachricht-----
Von: iaik-jce-owner@iaik.tu-graz.ac.at
[mailto:iaik-jce-owner@iaik.tu-graz.ac.at]Im Auftrag von Alan Grenadir
Gesendet: Mittwoch, 12. April 2000 00:53
An: IAIK
Betreff: [iaik-jce] BadPaddingException in RecipientInfo.decryptKey()


Hello,

I am using a PKCS12 file with password that contains a private key and
user public cert.  I encrypt a data file into an EnvelopedDataStream
with one recipient and then decrypt to extract the data file.

My code works fine when I use a PKCS12 file created from keys I create
myself using
KeyPairGenerator gen = KeyPairGenerator.getInstance(alg) and
gen.generateKeyPair().

However, when I use a PKCS12 file exported from Netscape for a Verisign
keypair, I get the following exception in my decrypt logic at the step
RecipientInfo recipientInfo = ...;
PrivateKey privateKey = recipientInfo.decryptKey ():
BadPaddingException: Encryption block has wrong block type!

In addition, when I use a PKCS12 file from the RSA CA, I get the
following exception at the same step of the logic:
BadPaddingException: Encrypted message has not k OCTETS!

How can I handle keys from these CAs?

Thanks in advance,
Alan





--
Mailinglist-archive at
http://jcewww.iaik.at/mailarchive/iaik-jce/jcethreads.html

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




smime.p7s