Title: Message
Hi all
I try to create a pkcs#12 with several secret bags.
I haven't found any sample which indicates how to do this and especially how to create a secret bag.
I try the following code, but it doesn't work  :
 
 PKCS12_SAFEBAG *safebag;
 ASN1_OCTET_STRING *os;
 ASN1_TYPE *at;
 char pData[]="secret data";
 int dataLen=sizeof(pData);
 int mySecretNid;
 
 os=ASN1_OCTET_STRING_new();
 ASN1_OCTET_STRING_set(os, pData, dataLen);
 at=ASN1_TYPE_new();
 ASN1_TYPE_set(at,os->type,(char *)os);
 mySecretNid=OBJ_create("1.2.3.4","OID_MY_SECRET_DATA","My secret data OID");
 safebag=PKCS12_item_pack_safebag(at, ASN1_ITEM_rptr(ASN1_OCTET_STRING), mySecretNid, NID_secretBag);
 
I think that the problem is due to the ASN1_ITEM_rptr(ASN1_OCTET_STRING) parameter, but i don't know what to pass else ?
ASN1_ITEM_rptr(ASN1_TYPE) is not implemented.
 
Anybody knowns what kind of parameter which works ?
 

Claude.

Reply via email to