Skip to main content

AttributeFactory

Static class to manage X509 attributes

Constructors​

Constructor​

new AttributeFactory(): AttributeFactory

Returns​

AttributeFactory

Methods​

create()​

static create(data, options?): Attribute

Returns X509 Attribute based on it's identifier

Parameters​

data​

BufferSource

DER encoded buffer

options?​

any

Optional ASN.1 parse options (e.g. asn1js.fromBER resource limits)

Returns​

Attribute

Example​

const attr = AttributeFactory.create(asnAttrRaw);

register()​

static register(id, type): void

Registers a new X509 Attribute class. If id already exists replaces it

Parameters​

id​

string

Attribute identifier

type​

any

Attribute class

Returns​

void

Example​

AttributeFactory.register(asnPkcs9.id_pkcs9_at_challengePassword, ChallengePasswordAttribute);