feat: remove generate key, since PIV key genration should use ykman

This commit is contained in:
2024-07-06 19:17:08 +08:00
parent 33f33d2aa6
commit d8a2309b95
3 changed files with 7 additions and 318 deletions

View File

@@ -29,12 +29,9 @@ use crate::{
find_all_keys,
find_key,
find_key2,
generate_key,
Algorithm,
YubikeyPivPrivateKey,
YubikeyPivPublicKey,
},
keychain,
};
#[derive(Debug, Default)]
@@ -130,16 +127,10 @@ impl Backend for YubikeyPivBackend {
#[instrument]
fn generate_key(
&self,
algorithm: native_pkcs11_traits::KeyAlgorithm,
label: Option<&str>,
_algorithm: native_pkcs11_traits::KeyAlgorithm,
_label: Option<&str>,
) -> native_pkcs11_traits::Result<Arc<dyn native_pkcs11_traits::PrivateKey>> {
let alg = match algorithm {
native_pkcs11_traits::KeyAlgorithm::Rsa => Algorithm::RSA,
native_pkcs11_traits::KeyAlgorithm::Ecc => Algorithm::ECC,
};
let label = label.unwrap_or("");
Ok(generate_key(alg, label, Some(keychain::location()?))
.map(|key| YubikeyPivPrivateKey::new(key, label, None).map(Arc::new))??)
Err("Generate key not supported, please use ykman, URL: https://hatter.in/ykman")?
}
fn find_all_private_keys(