Skip to content

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

  • Error — If the attribute list is empty, contains an unsupported field key, or uses 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.