BER/DER encode functions are generated when the -ber (basic encoding rules) or -der (distinguished encoding rules) switch is specified on the command line. Encoding for BER and DER is quite similar, with the more restrictive DER being also acceptable as a BER encoding. To produce a valid DER encoding, you must use -der, which will generate DER encode functions insted of BER encode functions. For the remainder of this section, unless otherwise noted, you may understand BER to refer to DER in the case that -der was used.
For each ASN.1 production defined in the ASN.1 source file, a BER encode function is generated. This function will convert a populated Go variable of the given type into a BER encoded ASN.1 message.