x509CertificateChain property

List<X509Certificate>? get x509CertificateChain

A chain of one or more PKIX certificates.

Implementation

List<x509.X509Certificate>? get x509CertificateChain =>
    (this['x5c'] as List?)?.map((v) {
      var bytes = convert.base64.decode(v);
      var p = ASN1Parser(bytes);
      var o = p.nextObject();
      if (o is! ASN1Sequence) {
        throw FormatException('Expected SEQUENCE, got ${o.runtimeType}');
      }
      var s = o;
      return x509.X509Certificate.fromAsn1(s);
    }).toList();