openssl asn.1使用

unsigned int unTempLen = 0;
 unsigned char szBuffer[8] = {0};
 unsigned char szOut[1024] = {0};
 ASN1_INTEGER asn1Int;
 asn1Int.length = 8;
 asn1Int.type = V_ASN1_INTEGER;
 asn1Int.data = szBuffer;
 ASN1_INTEGER_set(&asn1Int, 365);
 unsigned char* pOut = szOut;
 int nRetLen = i2d_ASN1_INTEGER(&asn1Int, &pOut);
 unTempLen += nRetLen;

 asn1Int.length = 8;
 asn1Int.type = V_ASN1_INTEGER;
 asn1Int.data = szBuffer;
 ASN1_INTEGER_set(&asn1Int, 0xFF);
 pOut = szOut+unTempLen;
 nRetLen = i2d_ASN1_INTEGER(&asn1Int, &pOut);

你可能感兴趣的:(openssl asn.1使用)