Hello, currently I'm trying to add attributes to pcks#7 envelope but I cannot find any info how to add attributes.
Here is an example from MS.
http://msdn.microsoft.com/en-us/library/windows/desktop/aa382367(v=vs.85).aspx
I am trying to add 3 attributes into SignPara.rgAuthAttr.
First initialize CRYPT_ATTRIBUTE structure.
SignPara.cAuthAttr = 3;
CRYPT_ATTRIBUTE* pkimsg_attrs = (CRYPT_ATTRIBUTE*)malloc(SignPara.cAuthAttr * sizeof(CRYPT_ATTRIBUTE));
Then add BLOB object and add it into pkimsg_attrs .
Then assign it as
SignPara.rgAuthAttr = pkimsg_attrs;
But when I decrypt the envelope, the attributes are all invalid.
Below is how I add new attribute into pkimsg_attrs;
PCRYPT_INTEGER_BLOB request_type_str = new CRYPT_INTEGER_BLOB();//request_type_str->cbData = 1;
request_type_str->cbData = 2;
request_type_str->pbData = (BYTE*)"19";
LPSTR nid_messageType = "2.16.840.1.113733.1.9.2";//STR
pkimsg_attrs->pszObjId = new char[strlen(nid_messageType)];
strcpy(pkimsg_attrs->pszObjId,nid_messageType);
pkimsg_attrs->cValue=1;
pkimsg_attrs->rgValue = request_type_str;