Derive attestation algorithim from public key
This commit is contained in:
parent
29fc403d81
commit
e6cbc8f7af
@ -295,13 +295,13 @@ impl AssertionRef {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn verify(&self, idx: usize, alg: CoseAlg, pubkey: PubKey) -> Result<()> {
|
pub fn verify(&self, idx: usize, pubkey: PubKey) -> Result<()> {
|
||||||
assert!(idx < self.count());
|
assert!(idx < self.count());
|
||||||
unsafe {
|
unsafe {
|
||||||
check(fido_assert_verify(
|
check(fido_assert_verify(
|
||||||
self.as_ptr(),
|
self.as_ptr(),
|
||||||
idx,
|
idx,
|
||||||
alg as i32,
|
pubkey.alg() as i32,
|
||||||
pubkey.as_ptr(),
|
pubkey.as_ptr(),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
10
src/pkey.rs
10
src/pkey.rs
@ -2,6 +2,7 @@ use std::ffi::c_void;
|
|||||||
|
|
||||||
use libfido2_sys::*;
|
use libfido2_sys::*;
|
||||||
|
|
||||||
|
use crate::CoseAlg;
|
||||||
use crate::error::Result;
|
use crate::error::Result;
|
||||||
use crate::util::check_initialized;
|
use crate::util::check_initialized;
|
||||||
|
|
||||||
@ -94,4 +95,13 @@ impl PubKey {
|
|||||||
PubKey::Rsa256PubKey(pk) => pk.as_ptr() as *const c_void,
|
PubKey::Rsa256PubKey(pk) => pk.as_ptr() as *const c_void,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn alg(&self) -> CoseAlg {
|
||||||
|
match self {
|
||||||
|
PubKey::Ec25519(_) => CoseAlg::Ed25519,
|
||||||
|
PubKey::Ecdsa256(_) => CoseAlg::Ecdsa256,
|
||||||
|
PubKey::Ecdsa384(_) => CoseAlg::Ecdsa384,
|
||||||
|
PubKey::Rsa256PubKey(_) => CoseAlg::Rsa,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user