Hello,

I'm working for the Libreoffice in Google Summer of Code 2012. My
project is to implement PDF signing.

I'm trying to create a PKCS7 object of the PDF file and include the
PKCS7 object in the file itself. But when I call:

SEC_PKCS7ContentInfo *ci = SEC_PKCS7CreateSignedData(cert,
certUsageEmailSigner, NULL, SEC_OID_SHA1, &digest, NULL, (void *)pass);

I get NULL and after that:

fprintf(stderr, "%d\n\n", PORT_GetError());

line prints:

-8156

which is  SEC_ERROR_EXTENSION_NOT_FOUND.

When I traced the code I see that  sec_pkcs7_create_signed_data call
returns successfully but sec_pkcs7_add_signer fails.

Trace is like that:

sec_pkcs7_add_signer -> CERT_VerifyCertificate -> CERT_VerifyCertChain
-> CERT_FindBasicConstraintExten -> cert_FindExtension

and finally cert_FindExtensionByOID function returns
SEC_ERROR_EXTENSION_NOT_FOUND.

My full patch is here: http://pastebin.ca/2179231

Can anybody help me about that error? I need to create a PKCS7 object
and encoded it via SEC_PKCS7Encode. May my certificate be the problem?
Is there any restriction about the certificates used with
SEC_PKCS7CreateSignedData function?


Regards.

-- 
Gökçen Eraslan

Attachment: signature.asc
Description: OpenPGP digital signature

-- 
dev-tech-crypto mailing list
dev-tech-crypto@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-crypto

Reply via email to