Generated PER Encode Functions

PER encode functions are generated when the -per (packed encoding rules), -aper (aligned packed encoding rules), or -uper (unaligned packed encoding rules), switch is specified on the command line. For Go, -per and -aper have the same meaning - aligned PER encoders will be generated. The -uper option is used to generate unaligned decoders. There is no option to switch between aligned and unaligned at run-time as there is for some other languages. For the remainder of this section, the acronym PER will be used to mean either aligned or unaligned PER.

For each ASN.1 production defined in the ASN.1 source file, a PER encode function is generated. This function will convert a populated Go variable of the given type into a PER encoded ASN.1 message.