Skip to content

encodeRelativeDistinguishedName ​

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,
): Uint8Array

Parameters

Returns — DER-encoded RelativeDistinguishedName bytes.

Throws

  • ResultError — If the attribute list is empty, contains an unsupported field key, an empty or over-long value, or an invalid country code.

See also

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

Released under the MIT License.