Name.fromAsn1 constructor

Name.fromAsn1(
  1. ASN1Sequence sequence
)

Name ::= CHOICE { -- only one possibility for now -- rdnSequence RDNSequence }

RDNSequence ::= SEQUENCE OF RelativeDistinguishedName

RelativeDistinguishedName ::= SET SIZE (1..MAX) OF AttributeTypeAndValue

AttributeTypeAndValue ::= SEQUENCE { type AttributeType, value AttributeValue }

AttributeType ::= OBJECT IDENTIFIER

AttributeValue ::= ANY -- DEFINED BY AttributeType

Implementation

factory Name.fromAsn1(ASN1Sequence sequence) {
  return Name(sequence.elements.map((ASN1Object set) {
    return <ObjectIdentifier?, dynamic>{
      for (var p in (set as ASN1Set).elements)
        toDart((p as ASN1Sequence).elements[0]): toDart(p.elements[1])
    };
  }).toList());
}