encode Pem Private Key
Encode a KeyPair to PEM format.
RSA keys are encoded as PKCS#1 (
BEGIN RSA PRIVATE KEY)EC keys are encoded as SEC1 (
BEGIN EC PRIVATE KEY)Ed25519 keys are encoded as PKCS#8 (
BEGIN PRIVATE KEY)
Return
PEM-encoded private key string
Parameters
key Pair
JCA key pair to encode
password
Optional passphrase to encrypt the key. RSA and EC use legacy PEM AES-256-CBC encryption; Ed25519 uses PBES2 encrypted PKCS#8.
Throws
if the key type is unsupported