Generated BER/DER Decode Functions

BER or DER decode functions are generated when the -ber (basic encoding rules) or the -der (distinguished encoding rules) switch is specified on the command line. BER and DER decode functions are similar. The only difference is that the DER functions contain additional checks to make sure the encoding is in the required canonical form. For the remainder of this section, the acronym BER will be used to mean either BER or DER.

For each ASN.1 production defined in the ASN.1 source file, a BER decode function is generated. This function decodes an encoded ASN.1 message contained in a message buffer (byte slice) and stores the results in a data variable of a Go type corresponding to the ASN.1 production type.