ASN1PrivateKeyInfo.fromPkcs1RsaPem constructor

ASN1PrivateKeyInfo.fromPkcs1RsaPem(
  1. String pem
)

Creates an instance of PrivateKeyInfo for the given pem. The pem should represent a RSA private key in PKCS1.

Implementation

ASN1PrivateKeyInfo.fromPkcs1RsaPem(String pem) {
  var bytes = ASN1Utils.getBytesFromPEMString(pem);
  var asn1Parser = ASN1Parser(bytes);
  var privateKeySeq = asn1Parser.nextObject();
  privateKey = ASN1OctetString(octets: privateKeySeq.encode());
  version = ASN1Integer.fromtInt(0);
  privateKeyAlgorithm =
      ASN1AlgorithmIdentifier.fromIdentifier('1.2.840.113549.1.1.1');
}