[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[iaik-jce] pkcs#12 decryption failing
so.....
I was looking through the archives , and saw benoit's post:
(otjacque@crpcu.lu)
>I must read this file and extract the private key and the certificate from
it.
>I managed to read part of the file. It contains 2 Authenticatedsafe.
>Authenticatedsafe Nr 0 is unencrypted. It contains 1 SafeBag, type
>PKCS8ShroudedKeyBag. I suppose it is the private key.
>It is encrypted with PbeWithSHAAnd3-KeyTripleDES-CBC algorithm.
>I know the password associated with the private key.
>Authenticatedsafe Nr 1 is encrypted with PbeWithSHAAnd40BitRC2-CBC.
>So I can't read its content. Nevertheless I suppose it is the
>certificate.
>How can I extract the PrivateKey and the Certificate in order to be able to
>encrypt, decrypt and sign mails with them?
-------------------------------
I have almost the same exact problem (and a solution wasn't posted...so
here I am asking the question again).
I generated a p12 file from the openssl command tool (openssl.org) that
works with Internet Explorer, but when I run the following code:
public static void main(String[] argv)
{
FileInputStream fis= null;
try
{
fis = new FileInputStream("user4.p12");
System.out.println("made fileinputstream");
PKCS12 greatstuff = new PKCS12(fis);
System.out.println("pkcs12 object created: "+
greatstuff.toString());
System.out.println("about to decode the file....");
char[] password = "password".toCharArray();
greatstuff.decrypt(password);
System.out.println("just decoded it....: "+
greatstuff.toString());
..........
-----it faults on the the decrypt line. this is the output that I get:
C:\cvs\new-stuff\vote\src>java signTest
made fileinputstream
pkcs12 object created: PKCS#12 object:
Version: 3
AuthenticatedSafe: 0
mode: PASSWORD_ENCRYPTED
Content encrypted with: PbeWithSHAAnd40BitRC2-CBC
No SafeBags or not decrypted yet.
AuthenticatedSafe: 1
mode: UNENCRYPTED
SafeBag: 0
PKCS8ShroudedKeyBag: not decrypted yet!
about to decode the file....
an exception was thrown
iaik.pkcs.PKCSException: java.security.NoSuchAlgorithmException:
AlgorithmParame
ters not available
at iaik.pkcs.pkcs12.AuthenticatedSafe.decrypt(Unknown Source)
at iaik.pkcs.pkcs12.PKCS12.decrypt(Unknown Source)
at signTest.main(signTest.java:28)
----------------
I've looked all through the openssl command line docs, looked through their
mailing lists, looked through the mailing list here, and couldn't find an
answer...so, please help me out there. thanks
-Jill
--
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