You may want to check how gnutls parses a general name using libtasn1. https://gitlab.com/gnutls/gnutls/blob/master/lib/x509/x509.c#L1625
regards, Nikos On Wed, May 22, 2019 at 8:22 PM Vasily Olekhov <[email protected]> wrote: > > Greetings. I can't parse GeneralNames section in AuthorityKeyIdentifier > extension of X509 Certificate. > > Libtasn1 stumbles upon GeneralName. > Minium [not]working example: > > choice.der: > 0000000: a4 22 30 20 31 1e 30 1c 06 09 2a 86 48 86 f7 0d ."0 1.0...*.H... > 0000010: 01 09 01 16 0f 64 69 74 40 6d 69 6e 73 76 79 61 .....dit@minsvya > 0000020: 7a 2e 72 75 z.ru > > This snippet should have parsed as > [4] (directoryName [4] Name) > SEQUENCE (Name: CHOICE(RDNSequence) ) > SET (RDNSequence: SET ... OF AttributeTypeAndValue) > SEQUENCE (AttributeTypeAndValue) > OBJECT IDENTIFIER 1.2.840.113549.1.9.1 emailAddress (PKCS #9. > Deprecated, use an altName extension instead) > IA5String [email protected] > > > I am trying to parse like this: > r=asn1_create_element(pkix_defs, "PKIX1Implicit88.GeneralName", &gn); > r=asn1_der_decoding(&gn, pbBlob, cbBlob, errorDescription); > > This results in > [TAG_ERROR][:: tag error near element 'directoryName.rdnSequence.?1.'] > > PKIX1Implicit88 definitions are from examples directory. > > Vasiliy >
