publicKey property

RSAPublicKey publicKey

The Public Key Algorithm of the certificate.

Implementation

RSAPublicKey get publicKey {
  switch (publicKeyAlgorithmOI.objectIdentifierAsString) {
    case Pkcs.RsaesPkcs1:
      final s = ASN1Parser(publicKeyBytes).nextObject() as ASN1Sequence;
      final asn1Modulus = s.elements![0] as ASN1Integer;
      final modulus = asn1Modulus.integer!;
      final asn1Exponent = s.elements![1] as ASN1Integer;
      final exponent = asn1Exponent.integer!;
      return RSAPublicKey(modulus, exponent);
  }
  throw UnimplementedError('Unknown algorithm ${publicKeyAlgorithmOI.name}');
}