Function makiko::keys::decode_pem_privkey_nopass
source · pub fn decode_pem_privkey_nopass(
pem_data: &[u8]
) -> Result<DecodedPrivkeyNopass>
Expand description
Decode a private key from any supported PEM format without a password.
This function attempts to auto-detect the private key format from the PEM header. If the format is recognized, then one of three options occurs:
- The key is not encrypted, so we return a
DecodedPrivkeyNopass::Privkey
that contains the key. - The private key is encrypted, but the public key is stored unencrypted, so we return a
DecodedPrivkeyNopass::Pubkey
. This is only possible with private keys in the OpenSSH format. - The key is encrypted and the public key cannot be decoded, so we return a
DecodedPrivkeyNopass::Encrypted
.