createSubjectAltName static method

ASN1Sequence createSubjectAltName(
  1. List<PkiOtherName> otherNames
)

Implementation

static ASN1Sequence createSubjectAltName(List<PkiOtherName> otherNames) {
  final seq = ASN1Sequence();
  for (final otherName in otherNames) {
    final otherNameSeq = ASN1Sequence();
    otherNameSeq.add(ASN1ObjectIdentifier.fromComponentString(otherName.oid));

    final value = ASN1UTF8String(otherName.value);
    final valueWrapper = ASN1Sequence(tag: 0xA0);
    valueWrapper.add(value);
    otherNameSeq.add(valueWrapper);

    final generalNameWrapper = ASN1Sequence(tag: 0xA0);
    generalNameWrapper.add(otherNameSeq);
    seq.add(generalNameWrapper);
  }
  return seq;
}