On Wed, 2002-01-09 at 18:21, Frank Geck wrote:
> I was trying to get the common name (CN) from a PKCS7 file that I had
> read in.  I used, sk=PKCS7_get_signer_info(p7) now I have sk holding a
> STACK_OF(PKCS7_SIGNER_INFO), any function to return the CN as I go
> through the stack?
> 

don't know if this will help you:

STACK_OF(PKCS7_SIGNER_INFO)* sk = PKCS7_get_signer_info(p7);

for (int i = 0; i < sk_PKCS7_SIGNER_INFO_num(sk); i++)
{
    PKCS7_SIGNER_INFO* si = PKCS7_SIGNER_INFO_value(sk, i);
    X509* x509 =  PKCS7_cert_from_signer_info(p7, si);
    X509_NAME* name = X509_get_subject_name(x509);

    text = malloc(sizeof(x->cert_info));
    text = X509_NAME_oneline(name, text, 200);
    printf("Subject name data: %s\n", text);
    free(text);
}


-- 
Aleix
------------------------------
Aleix Conchillo Flaqué
SCYTL founder & R&D Engineer
e-mail: [EMAIL PROTECTED]
phone:  +34 933 016 547



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

Reply via email to