DistributionPointName.fromAsn1 constructor

DistributionPointName.fromAsn1(
  1. ASN1Object obj
)

Implementation

factory DistributionPointName.fromAsn1(ASN1Object obj) {
  var choice = (0x1F & obj.tag);
  var childObj = ASN1Parser(obj.valueBytes()).nextObject();
  GeneralNames? generalNames;
  RelativeDistinguishedName? relativeName;

  switch (choice) {
    case 0:
      generalNames = GeneralNames.fromAsn1(childObj);
      break;
    case 1:
      relativeName = RelativeDistinguishedName();
      break;
    default:
      throw UnsupportedError(
          'Not supported CHOICE ($choice) by DistributionPointName.');
  }
  return DistributionPointName(choice, generalNames, relativeName);
}