feat: read flot meta
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
use p256::{ecdh::EphemeralSecret, EncodedPoint, PublicKey};
|
||||
use p256::elliptic_curve::sec1::{FromEncodedPoint, ToEncodedPoint};
|
||||
use rand::rngs::OsRng;
|
||||
use rust_util::{failure_and_exit, information, XResult};
|
||||
use rust_util::{failure_and_exit, information, warning, XResult};
|
||||
use yubikey::Context;
|
||||
use yubikey::piv::{AlgorithmId, decrypt_data, RetiredSlotId, SlotId};
|
||||
use yubikey::piv::{AlgorithmId, decrypt_data, metadata, RetiredSlotId, SlotId};
|
||||
|
||||
// const EPK_BYTES: usize = 33;
|
||||
|
||||
@@ -57,7 +57,14 @@ fn main() -> XResult<()> {
|
||||
let shared_secret = esk.diffie_hellman(&public_key);
|
||||
information!("Shared secret: {}", hex::encode(shared_secret.raw_secret_bytes()));
|
||||
|
||||
// yubikey.verify_pin(b"123456").expect("Verify pin!");
|
||||
let meta_result = metadata(&mut yubikey, SlotId::Retired(RetiredSlotId::R1));
|
||||
match meta_result {
|
||||
Ok(meta) => {
|
||||
information!("{:?}", meta)
|
||||
}
|
||||
Err(e) => warning!("Get slot meta failed: {}", e)
|
||||
}
|
||||
yubikey.verify_pin(b"123456").expect("Verify pin!");
|
||||
let decrypted_shared_secret = decrypt_data(
|
||||
&mut yubikey,
|
||||
epk_bytes.decompress().as_bytes(),
|
||||
|
||||
Reference in New Issue
Block a user