encode Open Ssh Private Key
Encode a KeyPair to OpenSSH format (BEGIN OPENSSH PRIVATE KEY). ML-DSA-44/Ed25519 composites require exportable seeds. Pure ML-DSA has no defined OpenSSH private-key layout; use encodePemPrivateKey instead.
Return
OpenSSH-formatted private key string
Parameters
key Pair
JCA key pair to encode
password
Optional passphrase to encrypt the key (AES-256-CTR with bcrypt KDF)
Throws
if the key type is unsupported