Hello All,
I'm using openssl 1.0.1e.

I want to use these two example functions

X509_ATTRIBUTE *add_seq2string(PKCS7_SIGNER_INFO *si, char *str1, char
*str2);
int sk_get_seq2string(STACK_OF(X509_ATTRIBUTE) *sk, char **str1, char
**str2);

included in the file "/openssl-1.0.1e/crypto/pkcs7/example.c" to create a 
X509_ATTRIBUTE composed by a sequence of two strings.

I create a X509_ATTRIBUTE with add_seq2string function, but when I pass this 
X509_ATTRIBUTE
to sk_get_seq2string function, it doesn't return the two strings because
there is a problem at this line:

if (!asn1_GetSequence(&c,&length)) goto err;


This is the code:

int main(){
    X509_ATTRIBUTE *attr = add_seq2string(NULL, "string1", "string2"); 
//the function doesn't use the first param
   
    char **str1, **str2;
    STACK_OF(X509_ATTRIBUTE) *sk = sk_X509_ATTRIBUTE_new_null();
    sk_X509_ATTRIBUTE_push(sk, attr);

    sk_get_seq2string(sk, str1, str2);

    printf("%s %s", *str1, *str1);

    return 0;
}

Can anyone tell me where is the problem?
Thanks





--
View this message in context: 
http://openssl.6102.n7.nabble.com/X509-ATTRIBUTE-create-tp44423.html
Sent from the OpenSSL - User mailing list archive at Nabble.com.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [email protected]
Automated List Manager                           [email protected]

Reply via email to