package model.x501; import model.asn1.ASN1Object; import model.asn1.Encodable; import model.asn1.Tag; import model.asn1.exceptions.ParseException; import model.asn1.parsing.BytesReader; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; /** * Represents an X.501 directory Name (a.k.a. RDNSequence). *
* Name ::= CHOICE { -- only one possibility for now -- rdnSequence RDNSequence } * RDNSequence ::= SEQUENCE OF RelativeDistinguishedName * DistinguishedName ::= RDNSequence **/ public class Name extends ASN1Object { private final RelativeDistinguishedName[] rdnSequence; /** * EFFECT: Initialize the Name with the given tags and rdnSequence. For tag and parentTag, consult * {@link ASN1Object}. * REQUIRES: Items should have SET tag. */ public Name(Tag tag, Tag parentTag, RelativeDistinguishedName[] rdnSequence) { super(tag, parentTag); this.rdnSequence = rdnSequence; } /** * EFFECT: Parse the Name from input DER bytes. For details on parsing, refer to {@link ASN1Object}. * Throws {@link ParseException} for invalid input. * MODIFIES: this, encoded */ public Name(BytesReader encoded, boolean hasParentTag) throws ParseException { super(encoded, hasParentTag); final List