[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[iaik-jce] SignerInfo
I have to build a pkcs7 envelope of SignedData type using components I
already
have.
1) A document converted in an array of byte: DocBuffer
2) An X509 certificate loaded from disk: cert
3) An already encrypted document digest, stored in an array of byte:
encrypted_digest
Here is what I do:
int mode = SignedData.IMPLICIT;
SignedData signed_data = new SignedData (DocBuffer, mode);
iaik.x509.X509Certificate[] certificates = {cert};
signed_data.setCertificates(certificates);
SignerInfo signer_info = new SignerInfo();
signer_info.setEncryptedDigest( encrypted_digest );
signed_data.addSignerInfo( signer_info );
byte[] encoded_signed_data = signed_data.getEncoded();
The last library call throws a iaik.pkcs.PKCSException:
iaik.asn1.CodingException: java.lang.NullPointerException at
iaik.pkcs.pkcs7.SignedData.toASN1Object
Further inspections point out that maybe signer_info is not properly setted:
trying to convert it in an ASN1Object gives an exception, also. But, how can
I
make a better signer_info? Take in count that I can't use the other
constructors
because I can't directly extract the private key from the underlaying
framework.
Thanks a lot in advance
Mauro
--
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