i2d & ASN1_SEQUENCE related query in openssl 1.1.1.
prudvi raj
rajprudvi98 at gmail.com
Mon Oct 12 20:50:51 UTC 2020
Hi,
I am trying to write replacement ASN1 macros for i2d/d2i functions in
openssl 1.1.1
Previously:
typedef struct pkcs7_issuer_and_subject_st
{
X509_NAME *issuer; /* Certificate Issuer's name */
X509_NAME *subject; /* Certificate's subject name */
} PKCS7_ISSUER_AND_SUBJECT;
----
i2d function:
int i2d_PKCS7_ISSUER_AND_SUBJECT (PKCS7_ISSUER_AND_SUBJECT * a,
unsigned char **pp)
{
M_ASN1_I2D_vars (a);
M_ASN1_I2D_len (a->issuer, i2d_X509_NAME);
M_ASN1_I2D_len (a->subject, i2d_X509_NAME);
M_ASN1_I2D_seq_total ();
M_ASN1_I2D_put (a->issuer, i2d_X509_NAME);
M_ASN1_I2D_put (a->subject, i2d_X509_NAME);
M_ASN1_I2D_finish ();
}
======================================
New :
DECLARE_ASN1_FUNCTIONS(PKCS7_ISSUER_AND_SUBJECT)
ASN1_SEQUENCE(PKCS7_ISSUER_AND_SUBJECT) = {
ASN1_SIMPLE(PKCS7_ISSUER_AND_SUBJECT, issuer, X509_NAME),
ASN1_SIMPLE(PKCS7_ISSUER_AND_SUBJECT, subject, X509_NAME)
} ASN1_SEQUENCE_END(PKCS7_ISSUER_AND_SUBJECT)
IMPLEMENT_ASN1_FUNCTIONS(PKCS7_ISSUER_AND_SUBJECT)
Finally , we can call the function :
ulLen = i2d_PKCS7_ISSUER_AND_SUBJECT (&pkcs7IssuerAndSub, &ptr);
Is this the correct way , or am I missing anything ??
( does it need DECLARE_ASN1_ALLOC_FUNCTIONS & DECLARE_ASN1_ITEM ..
...etc.,.)
Can anyone help me out in this regard !!
Thanks,
Prudvi.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mta.openssl.org/pipermail/openssl-users/attachments/20201013/976b82a5/attachment.html>
More information about the openssl-users
mailing list