feat: update pkcs11 piv

This commit is contained in:
2024-07-06 21:51:16 +08:00
parent 6002db37ae
commit baf80d52d1
2 changed files with 10 additions and 8 deletions

View File

@@ -42,6 +42,7 @@ impl Backend for YubikeyPivBackend {
fn find_all_certificates( fn find_all_certificates(
&self, &self,
) -> P11Result<Vec<Box<dyn P11Certificate>>> { ) -> P11Result<Vec<Box<dyn P11Certificate>>> {
// TODO ...
Ok(vec![]) Ok(vec![])
} }
@@ -54,6 +55,7 @@ impl Backend for YubikeyPivBackend {
KeySearchOptions::Label(label) => {} KeySearchOptions::Label(label) => {}
KeySearchOptions::PublicKeyHash(public_key_hash) => {} KeySearchOptions::PublicKeyHash(public_key_hash) => {}
} }
// TODO ...
Ok(None) Ok(None)
} }
@@ -66,18 +68,21 @@ impl Backend for YubikeyPivBackend {
KeySearchOptions::Label(label) => {} KeySearchOptions::Label(label) => {}
KeySearchOptions::PublicKeyHash(public_key_hash) => {} KeySearchOptions::PublicKeyHash(public_key_hash) => {}
} }
// TODO ...
Ok(None) Ok(None)
} }
fn find_all_private_keys( fn find_all_private_keys(
&self, &self,
) -> P11Result<Vec<Arc<dyn P11PrivateKey>>> { ) -> P11Result<Vec<Arc<dyn P11PrivateKey>>> {
// TODO ...
Ok(vec![]) Ok(vec![])
} }
fn find_all_public_keys( fn find_all_public_keys(
&self, &self,
) -> P11Result<Vec<Arc<dyn P11PublicKey>>> { ) -> P11Result<Vec<Arc<dyn P11PublicKey>>> {
// TODO ...
Ok(vec![]) Ok(vec![])
} }

View File

@@ -72,13 +72,7 @@ impl PrivateKey for YubikeyPivPrivateKey {
) -> P11Result<Vec<u8>> { ) -> P11Result<Vec<u8>> {
match algorithm { match algorithm {
SignatureAlgorithm::Ecdsa => {} SignatureAlgorithm::Ecdsa => {}
SignatureAlgorithm::RsaRaw => {} _ => return Err("RSA algorithm not supported.")?,
SignatureAlgorithm::RsaPkcs1v15Raw => {}
SignatureAlgorithm::RsaPkcs1v15Sha1 => {}
SignatureAlgorithm::RsaPkcs1v15Sha384 => {}
SignatureAlgorithm::RsaPkcs1v15Sha256 => {}
SignatureAlgorithm::RsaPkcs1v15Sha512 => {}
SignatureAlgorithm::RsaPss { .. } => {}
} }
// TODO sign data or hash?? // TODO sign data or hash??
Ok(vec![]) Ok(vec![])
@@ -152,7 +146,10 @@ impl PublicKey for YubikeyPivPublicKey {
data: &[u8], data: &[u8],
signature: &[u8], signature: &[u8],
) -> P11Result<()> { ) -> P11Result<()> {
// let algorithm = sigalg_to_seckeyalg(algorithm)?; match algorithm {
SignatureAlgorithm::Ecdsa => {}
_ => return Err("RSA algorithm not supported.")?,
}
// let result = self.sec_key.verify_signature(algorithm, data, signature)?; // let result = self.sec_key.verify_signature(algorithm, data, signature)?;
// if !result { // if !result {
// return Err("verify failed")?; // return Err("verify failed")?;