Encoding Instructions for the Generic String Encoding Rules (GSER)
updates
- rfc-3641 — Generic String Encoding Rules (GSER) for ASN.1 Types
Extracted elements (20)
The CHOICE-OF-STRINGS encoding instruction is required to be textually co-located with the CHOICE type definition, making it clear to a reader that the encoding instruction applies to every use of the type regardless of how it is referenced.
The CHOICE-OF-STRINGS encoding instruction provides a machine-processable representation for ChoiceOfStrings declarations, replacing the informal declaration mechanism from RFC 3641 (GSER) with one formally grounded in the ASN.1 encoding instruction framework.
The optional PrecedenceList allows a specification writer to control the order in which a GSER decoder considers alternatives when the leading identifier is absent, enabling preferences such as PrintableString before UTF8String for the DirectoryString type.
The uTF8String alternative did not appear in the second edition of the SelectedAttributeTypes ASN.1 module of X.520, requiring a different (simplified) CHOICE-OF-STRINGS encoding instruction for GSER applications targeting that edition versus the third and later editions.
A GSER encoder MUST use IdentifiedChoiceValue if a GSER decoder would determine the chosen alternative to be something other than the actual chosen alternative; otherwise, ChoiceOfStringsValue MAY be used.
Applications using GSER MUST add the encoding instruction '[GSER:CHOICE-OF-STRINGS PRECEDENCE printableString uTF8String]' immediately before the CHOICE keyword in the DirectoryString definition in the third and every subsequent edition of the SelectedAttributeTypes ASN.1 module of X.520.
Each identifier in the PrecedenceList MUST be the identifier of a NamedType of the ChoiceType, and a particular identifier SHALL NOT appear more than once in the same PrecedenceList.
For compatibility with the second edition of X.520 (which lacks uTF8String), applications using GSER with that edition MUST add '[GSER:CHOICE-OF-STRINGS PRECEDENCE printableString]' before the CHOICE keyword in DirectoryString.
If case (3) (constrained type) applies to any NamedType, then the constraint MUST be identical for every NamedType: either none of the alternatives has a constraint, or all have exactly the same constraint.
The ASN.1 restricted string type MUST be different for each NamedType in the ChoiceType — no two alternatives may share the same restricted string type.
The CHOICE-OF-STRINGS encoding instruction SHOULD be used instead of simply declaring a ChoiceOfStrings type.
The IdentifiedChoiceValue rule MUST be used to encode values of a CHOICE type where the ChoiceType is not subject to a CHOICE-OF-STRINGS encoding instruction.
The Type in the EncodingPrefixedType for a CHOICE-OF-STRINGS encoding instruction SHALL be a ChoiceType (directly or via constrained, tagged, or encoding-prefixed wrapping), effectively forcing co-location of the instruction with the CHOICE type definition.
The Type of each NamedType in the subject ChoiceType MUST be one of the ASN.1 restricted string types (NumericString, PrintableString, TeletexString, etc.) or a type notation, constrained type, or prefixed type that ultimately references such a string type.
When ChoiceOfStringsValue has been used, a GSER decoder MUST determine the chosen alternative by considering alternatives in order (PrecedenceList order first, then definition order) and accepting the first alternative that allows all characters in the StringValue.
A CHOICE value is encoded using the ChoiceValue ABNF rule: ChoiceValue = IdentifiedChoiceValue / ChoiceOfStringsValue, where IdentifiedChoiceValue = identifier ':' Value and ChoiceOfStringsValue = StringValue.
In the context of the GSER encoding reference, the EncodingInstruction production is defined as 'EncodingInstruction ::= ChoiceOfStringsInstruction', and the EncodingInstructionAssignmentList production (for encoding control sections) is empty.
The CHOICE-OF-STRINGS encoding instruction notation is defined as: UnionInstruction ::= 'CHOICE-OF-STRINGS' AlternativesPrecedence?, AlternativesPrecedence ::= 'PRECEDENCE' PrecedenceList, PrecedenceList ::= identifier PrecedenceList?
The encoding reference that identifies the Generic String Encoding Rules is literally 'GSER'. This reference is used in type prefixes and encoding control sections to indicate which encoding rules are affected.
This specification changes only the manner in which ChoiceOfStrings types are declared; it does not alter the existing behavior of GSER implementations. The security considerations for GSER (RFC 3641) are therefore unchanged.