exportPkcs8Key abstract method
Export this RSAES-OAEP private key in PKCS #8 format.
Returns the DER encoding of the PrivateKeyInfo structure specified in RFC 5208 as a list of bytes.
Example
import 'package:webcrypto/webcrypto.dart';
import 'package:pem/pem.dart';
// Generate a key-pair.
final keyPair = await RsaOaepPrivateKey.generateKey(
4096,
BigInt.from(65537),
Hash.sha256,
);
// Export the private key.
final rawPrivateKey = await keypair.privateKey.exportPkcs8Key();
// Private keys are often encoded as PEM.
// This encodes the key in base64 and wraps it with:
// '-----BEGIN PRIVATE KEY----'...
print(PemCodec(PemLabel.privateKey).encode(rawPrivateKey));
Implementation
Future<Uint8List> exportPkcs8Key();