ASN1PrivateKeyInfo.fromPkcs1Rsa constructor

ASN1PrivateKeyInfo.fromPkcs1Rsa(
  1. ASN1Object key
)

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

Implementation

ASN1PrivateKeyInfo.fromPkcs1Rsa(ASN1Object key) {
  privateKey = ASN1OctetString(octets: key.encode());
  version = ASN1Integer.fromtInt(0);
  privateKeyAlgorithm =
      ASN1AlgorithmIdentifier.fromIdentifier('1.2.840.113549.1.1.1');
}