A second problem ...

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

A second problem ...

Lopez Thomas
Hello,

first:
thanks for everybody who give me help, to search the right package.

second:
I have a second problem, my exeption:
org.bouncycastle.cms.CMSException: key invalid in message.
    at
org.bouncycastle.cms.CMSEnvelopedDataGenerator.generate(CMSEnvelopedDataGenerator.java:355)
    at
org.bouncycastle.cms.CMSEnvelopedDataGenerator.generate(CMSEnvelopedDataGenerator.java:421)
    at interbat.crypto.x509.info_p12.chiffrer(info_p12.java:139)
    at interbat.crypto.x509.info_p12.main(info_p12.java:120)

and my code :
File file_to_sign = new File(input);
            byte[] buffer = new byte[(int)file_to_sign.length()];
            DataInputStream in = new DataInputStream(new
FileInputStream(file_to_sign));
            in.readFully(buffer);
            in.close();
            CMSEnvelopedDataGenerator edGen = new
CMSEnvelopedDataGenerator();
            edGen.addKeyTransRecipient(cert);//ajout du cer
            CMSProcessableByteArray data = new
CMSProcessableByteArray(buffer);
            CMSEnvelopedData envel = edGen.generate(data,
"1.2.840.113549.3.7", "BC");// this is lign 139
            buffer = envel.getEncoded();

Well I don't understand where the problem is.

May be the force you have.
Rgds,
Thomas.

Loading...