fromDerData static method

X509Certificate fromDerData({
  1. required Uint8List der,
})

Implementation

static X509Certificate fromDerData({required Uint8List der}) {
  var asn1 = ASN1DERDecoder.decode(data: der.toList(growable: true));
  if (asn1.length > 0) {
    var block1 = asn1.first.subAtIndex(0);
    if (block1 != null) {
      var certificate = X509Certificate();
      certificate.asn1 = asn1;
      certificate.block1 = block1;
      certificate.encoded = der;
      return certificate;
    }
  }
  throw ASN1ParseError();
}