encodeRelativeDistinguishedName
DER-encodes a single RelativeDistinguishedName (RDN).
Returns a DER SET OF name attributes for one X.509 name segment.
Use this when you need a multi-valued RDN.
ts
function encodeRelativeDistinguishedName(
attributes: RelativeDistinguishedNameInput,
): Uint8ArrayParameters
attributes:RelativeDistinguishedNameInput— Attribute list to encode inside one RDN.
Returns — DER-encoded RelativeDistinguishedName bytes.
Throws
Error— If the attribute list is empty, contains an unsupported field key, or uses an invalid country code.
See also
Attribute OIDs and ASN.1 string encodings come from
NAME_FIELD_DEFINITIONS.
Examples
ts
const rdn = encodeRelativeDistinguishedName([
{ type: 'commonName', value: 'example.com' },
{ type: 'serialNumber', value: 'device-7' },
]);
// emits one RDN with both attributes in the same SET