ASN1CertificationRequest.fromSequence constructor

ASN1CertificationRequest.fromSequence(
  1. ASN1Sequence seq
)

Implementation

ASN1CertificationRequest.fromSequence(ASN1Sequence seq) {
  if (seq.elements == null || seq.elements!.length != 3) {
    throw ArgumentError('');
  }
  if (seq.elements!.elementAt(0) is! ASN1Sequence) {
    throw ArgumentError('Element at index 0 has to be ASN1Sequence');
  }
  if (seq.elements!.elementAt(1) is! ASN1Sequence) {
    throw ArgumentError('Element at index 1 has to be ASN1Sequence');
  }
  if (seq.elements!.elementAt(2) is! ASN1BitString) {
    throw ArgumentError('Element at index 2 has to be ASN1BitString');
  }
  certificationRequestInfo = seq.elements!.elementAt(0);
  signatureAlgorithm = ASN1AlgorithmIdentifier.fromSequence(
      seq.elements!.elementAt(1) as ASN1Sequence);
  signature = seq.elements!.elementAt(2) as ASN1BitString;
}