On Wed, Aug 20, 2003, Danny Joseph wrote:

> Dr. Henson,
> 
> following your last e-mail.
> 
> Yes, I would like to obtain a PKCS#7 data ContentInfo from my binary file:
> so can you tell me more about the API albeit function?
> 

Actually this is *very* messy at present. If you look at crypto/pkcs7/pkcs7.h
you'll see OpenSSLs C structure representing the PKCS#7 structure. For many
types the fields are filled in automatically, either by high level API or at
least the low level API. 

Things get a bit messier for the data type because it isn't handled by either
API at present.

Fortunately the type is very simple and something like this should do the trick
(error checking omitted for clarity):

PKCS7 *p7;
p7 = PKCS7_new();
PKCS7_set_type(p7, NID_pkcs7_data);
ASN1_set_string(p7->d.data, data, datalen);

At that point 'p7' should be a valid PKCS#7 data type.


> And another question : what is the input file format with - signer in smime
> function. I have an .509 extension and I have an error message saying unable
> to load certificate. Following the examples, I guess it takes a PEM format.
> Do you know how to translate a .509 format to a PEM format?
> 

It does indeed expect PEM format. The .x509 may be in DER format. If the file
looks binary then you can try:

openssl x509 -in file.x509 -out file.pem -inform DER

Steve.
--
Dr Stephen N. Henson.
Core developer of the   OpenSSL project: http://www.openssl.org/
Freelance consultant see: http://www.drh-consultancy.demon.co.uk/
Email: [EMAIL PROTECTED], PGP key: via homepage.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to