On 2009-10-06 02:13 PDT, Konstantin Andreev wrote: > Hello, Nelson. > > On Mon, 10 Oct 2009, Nelson B Bolyard wrote: >> On 2009-10-05 02:20 PDT, Konstantin Andreev wrote: >>> I need to decode some DER-encoded ASN1 CHOICE, but I can't manage >>> this in a reasonable way. >> >> FYI, the documentation on NSS's ASN.1 encoder and its two decoders is at >> http://www.mozilla.org/projects/security/pki/nss/tech-notes/tn1.html >> >> It documents SEC_ASN1_CHOICE. I believe the info you want is there, ... > > No, it is not. I have read TN1 before posting here. It has only subtle > clue about CHOICE decoding, here it is: "Subsequent templates specify a > custom identifier for each possible component type in the size > parameter". > > The feature itself even not mentioned. The most important parts of > feature are not mentioned too:
The section that documents SEC_ASN1_CHOICE reads: >> SEC_ASN1_CHOICE: allows decoding of components that are of variable >> type. This must be the first template in a NULL-terminated array. The >> offset parameter specifies where to store the type identifier in the >> target data. Subsequent templates specify a custom identifier for each >> possible component type in the size parameter. All I added was an example that uses the offset element of the SEC_ASN1_CHOICE template and the size element of each of the subsequent templates. > The TN1 ought to be updated. I certainly agree that much more could be added to that page. > Thank you for this invaluable thorough example. This is exactly what I > was looking for. You're welcome. -- dev-tech-crypto mailing list dev-tech-crypto@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-tech-crypto