Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] how to handle ASN.1 Choice? #247

Open
hnvn opened this issue Oct 12, 2024 · 0 comments
Open

[Question] how to handle ASN.1 Choice? #247

hnvn opened this issue Oct 12, 2024 · 0 comments

Comments

@hnvn
Copy link

hnvn commented Oct 12, 2024

I try to parse this following ASN.1 structure

//   ASN.1 structure of CMS SignedData
//    
//      ContentInfo ::= SEQUENCE {
//        contentType ContentType,
//        content [0] EXPLICIT ANY DEFINED BY contentType 
//      }
//
//      ContentType ::= OBJECT IDENTIFIER
//      
//      SignedData ::= SEQUENCE {
//        version CMSVersion,
//        digestAlgorithms DigestAlgorithmIdentifiers,
//        encapContentInfo EncapsulatedContentInfo,
//        certificates [0] IMPLICIT CertificateSet OPTIONAL,
//        crls [1] IMPLICIT RevocationInfoChoices OPTIONAL,
//        signerInfos SignerInfos 
//      }
// 
//      SignerInfos ::= SET OF SignerInfo
// 
//      CertificateSet ::= SET OF CertificateChoices
// 
//      DigestAlgorithmIdentifiers ::= SET OF DigestAlgorithmIdentifier
// 
//      RevocationInfoChoices ::= SET OF RevocationInfoChoice
//
//      EncapsulatedContentInfo ::= SEQUENCE {
//        eContentType ContentType,
//        eContent [0] EXPLICIT OCTET STRING OPTIONAL 
//      }
//
//      CertificateChoices ::= CHOICE {
//        certificate Certificate,
//        extendedCertificate [0] IMPLICIT ExtendedCertificate,  -- Obsolete
//        v1AttrCert [1] IMPLICIT AttributeCertificateV1,        -- Obsolete
//        v2AttrCert [2] IMPLICIT AttributeCertificateV2,
//        other [3] IMPLICIT OtherCertificateFormat 
//      }

I am confused about CHOICE and have no idea how to parse this kind of data structure. It's very pleased if anyone experienced with this data structure can help me out. Thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant