der
constder:object
Pure DER validators for schema-aware checks of primitive encodings and SET ordering. These functions inspect the supplied bytes without parsing or changing them.
Type Declaration
Section titled “Type Declaration”checkPrimitiveEncoding
Section titled “checkPrimitiveEncoding”checkPrimitiveEncoding: (
universalTag,isConstructed,content) =>DerIssue|undefined
Checks the form and contents of a primitive UNIVERSAL value using DER rules. Returns undefined for a supported, valid value, or UNSUPPORTED_DER_TYPE when the type cannot be checked, including SEQUENCE and SET. Containers are not parsed. TeletexString, VideotexString, GraphicString and GeneralString contents are opaque; only their primitive form is checked.
Parameters
Section titled “Parameters”universalTag
Section titled “universalTag”number
isConstructed
Section titled “isConstructed”boolean
content
Section titled “content”Uint8Array
Returns
Section titled “Returns”DerIssue | undefined
checkSetOfOrder
Section titled “checkSetOfOrder”checkSetOfOrder: (
encodings) =>DerIssue|undefined
Checks SET OF ordering (X.690 11.6) of complete, already validated DER encodings. Ordering alone does not establish the validity of the supplied elements.
Parameters
Section titled “Parameters”encodings
Section titled “encodings”readonly Uint8Array<ArrayBufferLike>[]
Returns
Section titled “Returns”DerIssue | undefined
checkSetOrder
Section titled “checkSetOrder”checkSetOrder: (
identifiers) =>DerIssue|undefined
Checks SET ordering (X.690 10.3) by actual component tag class and tag number. Supply complete, already validated, minimally encoded identifier octets. The constructed flag is ignored and arbitrarily large tag numbers are supported. For an untagged CHOICE, supply the identifier of the encoded alternative.
Parameters
Section titled “Parameters”identifiers
Section titled “identifiers”readonly Uint8Array<ArrayBufferLike>[]
Returns
Section titled “Returns”DerIssue | undefined
compareSetOfElements
Section titled “compareSetOfElements”compareSetOfElements: (
a,b) =>number
Compares complete DER element encodings for SET OF ordering (X.690 11.6). The shorter input is conceptually padded with trailing zero octets. A negative, zero or positive result indicates less than, equal to or greater than. This comparison does not validate either encoding.
Parameters
Section titled “Parameters”Uint8Array
Uint8Array
Returns
Section titled “Returns”number