pub fn import_key(
encoded_key: String,
password: Option<String>,
) -> Result<SshKey, SshKeyImportError>
Expand description
Import a PKCS8 or OpenSSH encoded private key, and returns a decoded SshKey, with the public key and fingerprint, and the private key in OpenSSH format. A password can be provided for encrypted keys.
ยงReturns
- SshKeyImportError::PasswordRequired if the key is encrypted and no password is provided
- SshKeyImportError::WrongPassword if the password provided is incorrect
- SshKeyImportError::UnsupportedKeyType if the key type is not supported
- SshKeyImportError::ParsingError if the key is otherwise malformed and cannot be parsed