How can I get additional certificates?

Dr. Stephen Henson wrote:

On Thu, Feb 19, 2004, Andrzej Posiadala wrote:



When you've already read a PKCS#7 message into memory and you have it under PKCS7 * p7 pointer , try this:

STACK_OF(X509) *certs; X509 * tmpCert;
certs = PKCS7_get0_signers(p7, NULL, flags);
for (int i = 0; i < sk_X509_num(certs); i++)
{
tmpCert = sk_X509_value(certs,i) ;
//do sth. with tmpCert
}
sk_X509_free(certs);


For further info take a look at apps/smime.c




That will only retrive the certificates that signed a message. If the PKCS#7 structure contains any additional certificates or has no signers at all (a certificates only signedData structure) then it wont retrieve them.

Steve.
--
Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage
OpenSSL project core developer and freelance consultant.
Funding needed! Details on homepage.
Homepage: http://www.drh-consultancy.demon.co.uk
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]






--
=============================================
Manuel Sanchez Cuenca
Dept. Ingenieria y Tecnologia de Computadores
Universidad de Murcia - Espana
Tlf: +34 968363995 - Fax: 968364151
email: [EMAIL PROTECTED]
www: http://skywalker.dif.um.es/~lolo



______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to