Asn1String
ASN.1 String class used as wrapper do discriminate between different ASN.1 string types By default, the string value is decoded using UTF-8. If a different charset or custom decoding is needed, the rawValue property can be used directly.
To enable parsing of non-compliant strings without exploding, every String is internally represented as raw ByteArray and not validated during decoding from ASN.1. The isValid property indicates whether the bytes contained in an ASN.1 String object type are valid according to the validation rules of that type.
Inheritors
Types
BMP STRING (unchecked). Validation is not implemented. This string format is deprecated for HTTPS certificates and its use in generally discouraged in favor of UTF-8 strings (see Asn1String.UTF8).
GENERAL STRING (checked)
GRAPHIC STRING (checked)
IA5 STRING (checked)
NUMERIC STRING (checked)
PRINTABLE STRING (checked)
TELETEX STRING (checked). This string format is deprecated for HTTPS certificates and its use in generally discouraged in favor of UTF-8 strings (see Asn1String.UTF8).
UNIVERSAL STRING (no checks) Validation is not implemented. This string format is deprecated for HTTPS certificates and its use in generally discouraged in favor of UTF-8 strings (see Asn1String.UTF8).
CHARACTER/UNRESTRICTED STRING (no checks)
UTF8 STRING (verbatim String)
VIDEOTEX STRING (no checks) Validation is not implemented. This type is no longer used in practice.
VISIBLE STRING (checked)
Properties
Always the UTF-8 interpretation of rawValue. The decoding is performed via String.decodeFromAsn1ContentBytes, which internally uses the standard library's ByteArray.decodeToString.
Functions
Convenience function to directly get the DER-encoded representation of the implementing object
Exception-free version of encodeToDer
Safe version of encodeToDer, wrapping the result into a KmmResult
Encodes the implementing object into an A
Exception-free version of encodeToTlv
Safe version of encodeToTlv, wrapping the result into a KmmResult
shorthand for Asn1Element.prettyPrint, hence, a call to this function encodes this encodable to an Asn1Element, holds it in memory, pretty prints it, and discards it. This characteristic may be relevant in memory-constrained environments.
Creates a new implicitly tagged ASN.1 Element from this ASN.1 Element. NOTE: The TagClass of the provided tag will be used! If you want the result to have TagClass.CONTEXT_SPECIFIC, also invoke tag withClass TagClass.CONTEXT_SPECIFIC!. If a CONSTRUCTED Tag is applied to an ASN.1 Primitive, the CONSTRUCTED bit is overridden and set to zero
Creates a new implicitly tagged ASN.1 Element from this ASN.1 Structure. If the provided template's tagClass is not set, the class of the resulting structure defaults to TagClass.CONTEXT_SPECIFIC. If a CONSTRUCTED Tag is applied to an ASN.1 Primitive, the CONSTRUCTED bit is overridden and set to zero
Creates a new implicitly tagged ASN.1 Element from this ASN.1 Element. Sets the class of the resulting structure to TagClass.CONTEXT_SPECIFIC