rsaPrivateKeyToPEM function

String rsaPrivateKeyToPEM(
  1. RSAPrivateKey privateKey
)

Export a RSAPrivateKey as PEM String which can be reversed using RSAPrivateKey.fromPEM.

Implementation

String rsaPrivateKeyToPEM(RSAPrivateKey privateKey) {
  return '-----BEGIN RSA PRIVATE KEY-----\n${rsaPrivateKeyToString(privateKey)}\n-----END RSA PRIVATE KEY-----';
}