feat: init commit
This commit is contained in:
@@ -19,6 +19,8 @@ use tracing::instrument;
|
||||
use native_pkcs11_traits::{Backend, KeyAlgorithm, PrivateKey, PublicKey, SignatureAlgorithm};
|
||||
use native_pkcs11_traits::Result as P11Result;
|
||||
|
||||
use crate::piv::util::sha1_bytes;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Algorithm {
|
||||
RSA,
|
||||
@@ -107,6 +109,16 @@ pub struct YubikeyPivPublicKey {
|
||||
}
|
||||
|
||||
impl YubikeyPivPublicKey {
|
||||
#[instrument]
|
||||
pub fn new(label: String, algorithm: KeyAlgorithm, public_key_der: Vec<u8>) -> P11Result<Self> {
|
||||
let public_key_hash = sha1_bytes(&public_key_der);
|
||||
Ok(Self {
|
||||
label,
|
||||
der: public_key_der,
|
||||
public_key_hash,
|
||||
algorithm,
|
||||
})
|
||||
}
|
||||
// #[instrument]
|
||||
// pub fn new(sec_key: SecKey, label: impl Into<String> + Debug) -> Result<Self> {
|
||||
// let der = sec_key
|
||||
|
||||
Reference in New Issue
Block a user