/* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththis
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use authenticator::{
authenticatorservice::{AuthenticatorService, RegisterArgs, SignArgs},
crypto::COSEAlgorithm,
ctap2::server::{
AuthenticationExtensionsClientInputs, AuthenticationExtensionsPRFInputs,
AuthenticationExtensionsPRFValues, HMACGetSecretInput, PublicKeyCredentialDescriptor,
PublicKeyCredentialParameters, PublicKeyCredentialUserEntity, RelyingParty,
ResidentKeyRequirement, Transport, UserVerificationRequirement,
},
statecallback::StateCallback,
Pin, StatusPinUv, StatusUpdate,
}; use getopts::Options; use rand::{thread_rng, RngCore}; use std::sync::mpsc::{channel, RecvError}; use std::{env, thread};
let args: Vec<String> = env::args().collect(); let program = args[0].clone();
let rp_id = "example.com".to_string();
letmut opts = Options::new();
opts.optflag("h", "help", "print this help menu").optopt( "t", "timeout", "timeout in seconds", "SEC",
);
opts.optflag("h", "help", "print this help menu");
opts.optflag( "", "hmac-secret", "Return hmac-secret outputs instead of prf outputs (i.e., do not prefix and hash the inputs)",
); let matches = match opts.parse(&args[1..]) {
Ok(m) => m,
Err(f) => panic!("{}", f.to_string()),
}; if matches.opt_present("help") {
print_usage(&program, opts); return;
}
letmut manager =
AuthenticatorService::new().expect("The auth service should initialize safely");
manager.add_u2f_usb_hid_platform_transports();
let timeout_ms = match matches.opt_get_default::<u64>("timeout", 25) {
Ok(timeout_s) => {
println!("Using {}s as the timeout", &timeout_s);
timeout_s * 1_000
}
Err(e) => {
println!("{e}");
print_usage(&program, opts); return;
}
};
let attestation_object; let (register_tx, register_rx) = channel(); let callback = StateCallback::new(Box::new(move |rv| {
register_tx.send(rv).unwrap();
}));
println!();
println!("*********************************************************************");
println!("Asking a security key to sign now, with the data from the register...");
println!("*********************************************************************");
let sign_result = sign_rx
.recv()
.expect("Problem receiving, unable to continue");
match sign_result {
Ok(assertion_object) => {
println!("Assertion Object: {assertion_object:?}");
println!("Done.");
if sign_hmac_secret.is_some() { let hmac_secret_outputs = assertion_object
.extensions
.hmac_get_secret
.as_ref()
.expect("Expected hmac-secret output");
assert_eq!(
Some(hmac_secret_outputs.output1),
hmac_secret_outputs.output2, "Expected hmac-secret outputs to be equal for equal input"
);
assert_eq!(
assertion_object.extensions.prf, None, "Expected no PRF outputs when hmacGetSecret input was present"
);
}
if sign_prf.is_some() { let prf_results = assertion_object
.extensions
.prf
.expect("Expected PRF output")
.results
.expect("Expected PRF output to contain results");
assert_eq!(
Some(prf_results.first),
prf_results.second, "Expected PRF results to be equal for equal input"
);
assert_eq!(
assertion_object.extensions.hmac_get_secret, None, "Expected no hmacGetSecret output when PRF input was present"
);
}
}
Err(e) => panic!("Signing failed: {:?}", e),
}
}
Messung V0.5 in Prozent
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.11Bemerkung:
(vorverarbeitet am 2026-06-27)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.