Re: IMPLEMENT_ASN1_FUNCTIONS tutorial or help

2021-08-19 Thread Ken Goldman
On 8/17/2021 9:47 PM, Sands, Daniel via openssl-users wrote: The dump you show below is: Attributes (set, tagged with a 0, optional) Version privateKeyAlgorithm privateKey This is a PKCS#8 packet for a key. The encapsulated data is the RSA public key in PKCS1 format. I know OpenSSL has built-

RE: [EXTERNAL] Re: IMPLEMENT_ASN1_FUNCTIONS tutorial or help

2021-08-17 Thread Sands, Daniel via openssl-users
> My latest attempt to code the below DER is this. It compiles, but the d2i > segfaults on apparently the second element. > > Anything obviously wrong? > > typedef struct { > ASN1_INTEGER *version; > ASN1_INTEGER *serialNumber; > X509_ALGOR *signature; > X509_PUBKEY *key; >

Re: IMPLEMENT_ASN1_FUNCTIONS tutorial or help

2021-08-17 Thread Ken Goldman
My latest attempt to code the below DER is this. It compiles, but the d2i segfaults on apparently the second element. Anything obviously wrong? typedef struct { ASN1_INTEGER *version; ASN1_INTEGER *serialNumber; X509_ALGOR *signature; X509_PUBKEY *key; } TPM_ADDTOCERT; ASN1_S

Re: [EXTERNAL] Re: IMPLEMENT_ASN1_FUNCTIONS tutorial or help

2021-08-17 Thread Ken Goldman
On 8/17/2021 12:57 PM, Sands, Daniel via openssl-users wrote: Now I would like to do the other end, where I have der and I want to parse back to the structure, using d2i() 1 - Is there a tutorial on this? Seems like you don't need one. If you got i2d working you should have d2i already! I

RE: [EXTERNAL] Re: IMPLEMENT_ASN1_FUNCTIONS tutorial or help

2021-08-17 Thread Sands, Daniel via openssl-users
> >> Now I would like to do the other end, where I have der and I want to > >> parse back to the structure, using d2i() > >> > >> 1 - Is there a tutorial on this? > > > > Seems like you don't need one. If you got i2d working you should have d2i > already! > > > > I wasn't clear. The input and out

Re: IMPLEMENT_ASN1_FUNCTIONS tutorial or help

2021-08-17 Thread Ken Goldman
On 8/17/2021 10:38 AM, Matt Caswell wrote: On 16/08/2021 21:56, Ken Goldman wrote: I am trying to parse some ASN.1 DER so I can add it to an X.509 certificate. For the input side, a poster showed me ASN1_SEQUENCE, ASN1_SEQUENCE_END, and then DECLARE_ASN1_FUNCTIONS, IMPLEMENT_ASN1_FUNCTIONS

Re: IMPLEMENT_ASN1_FUNCTIONS tutorial or help

2021-08-17 Thread Matt Caswell
On 16/08/2021 21:56, Ken Goldman wrote: I am trying to parse some ASN.1 DER so I can add it to an X.509 certificate. For the input side, a poster showed me ASN1_SEQUENCE, ASN1_SEQUENCE_END, and then DECLARE_ASN1_FUNCTIONS, IMPLEMENT_ASN1_FUNCTIONS which created the i2d() function. It sho

IMPLEMENT_ASN1_FUNCTIONS tutorial or help

2021-08-16 Thread Ken Goldman
I am trying to parse some ASN.1 DER so I can add it to an X.509 certificate. For the input side, a poster showed me ASN1_SEQUENCE, ASN1_SEQUENCE_END, and then DECLARE_ASN1_FUNCTIONS, IMPLEMENT_ASN1_FUNCTIONS which created the i2d() function. Now I would like to do the other end, where I have d