diff --git a/crates/tor-keymgr/src/key_type/ssh.rs b/crates/tor-keymgr/src/key_type/ssh.rs index f80b9b868..b1b414905 100644 --- a/crates/tor-keymgr/src/key_type/ssh.rs +++ b/crates/tor-keymgr/src/key_type/ssh.rs @@ -122,39 +122,6 @@ impl HasKind for SshKeyError { } } -/// A helper for reading Ed25519 OpenSSH private keys from disk. -fn read_ed25519_keypair(key_type: KeyType, key: UnparsedOpenSshKey) -> Result { - let sk = - ssh_key::PrivateKey::from_openssh(&*key.inner).map_err(|e| SshKeyError::SshKeyParse { - // TODO: rust thinks this clone is necessary because key.path is also used below (but - // if we get to this point, we're going to return an error and never reach the other - // error handling branches where we use key.path). - path: key.path.clone(), - key_type, - err: e.into(), - })?; - - // Build the expected key type (i.e. convert ssh_key key types to the key types - // we're using internally). - let key = match sk.key_data() { - KeypairData::Ed25519(key) => { - ed25519::Keypair::from_bytes(&key.to_bytes()).map_err(|_| { - tor_error::internal!("failed to build ed25519 key out of ed25519 OpenSSH key") - })? - } - _ => { - return Err(SshKeyError::UnexpectedSshKeyType { - path: key.path, - wanted_key_algo: key_type.ssh_algorithm(), - found_key_algo: sk.algorithm().into(), - } - .boxed()); - } - }; - - Ok(key) -} - impl KeyType { /// Get the algorithm of this key type. pub(crate) fn ssh_algorithm(&self) -> SshKeyAlgorithm {