Handle Attestation KeyType as a type of signing key.

This commit is contained in:
Heiko Schaefer 2021-08-27 19:23:21 +02:00
parent e4eff705af
commit 0e37967200

View file

@ -60,9 +60,10 @@ impl From<&str> for AlgoSimple {
impl AlgoSimple { impl AlgoSimple {
pub(crate) fn get_algo(&self, kt: KeyType) -> Algo { pub(crate) fn get_algo(&self, kt: KeyType) -> Algo {
let et = match kt { let et = match kt {
KeyType::Signing | KeyType::Authentication => EccType::ECDSA, KeyType::Signing
| KeyType::Authentication
| KeyType::Attestation => EccType::ECDSA,
KeyType::Decryption => EccType::ECDH, KeyType::Decryption => EccType::ECDH,
_ => unimplemented!(),
}; };
match self { match self {
@ -103,18 +104,16 @@ impl AlgoSimple {
}), }),
Self::Curve25519 => Algo::Ecc(EccAttrs { Self::Curve25519 => Algo::Ecc(EccAttrs {
curve: match kt { curve: match kt {
KeyType::Signing | KeyType::Authentication => { KeyType::Signing
Curve::Ed25519 | KeyType::Authentication
} | KeyType::Attestation => Curve::Ed25519,
KeyType::Decryption => Curve::Cv25519, KeyType::Decryption => Curve::Cv25519,
_ => unimplemented!(),
}, },
ecc_type: match kt { ecc_type: match kt {
KeyType::Signing | KeyType::Authentication => { KeyType::Signing
EccType::EdDSA | KeyType::Authentication
} | KeyType::Attestation => EccType::EdDSA,
KeyType::Decryption => EccType::ECDH, KeyType::Decryption => EccType::ECDH,
_ => unimplemented!(),
}, },
import_format: None, import_format: None,
}), }),