feat: update u2f
This commit is contained in:
@@ -18,7 +18,7 @@ impl Command for CommandImpl {
|
|||||||
fn subcommand<'a>(&self) -> App<'a, 'a> {
|
fn subcommand<'a>(&self) -> App<'a, 'a> {
|
||||||
SubCommand::with_name(self.name()).about("FIDO U2F Register subcommand")
|
SubCommand::with_name(self.name()).about("FIDO U2F Register subcommand")
|
||||||
.arg(Arg::with_name("app-id").short("a").long("app-id").default_value("https://example.com").help("App id"))
|
.arg(Arg::with_name("app-id").short("a").long("app-id").default_value("https://example.com").help("App id"))
|
||||||
.arg(Arg::with_name("timeout").short("t").long("timeout").default_value("10").help("Timeout in seconds"))
|
.arg(Arg::with_name("timeout").short("t").long("timeout").default_value("30").help("Timeout in seconds"))
|
||||||
.arg(Arg::with_name("json").long("json").help("JSON output"))
|
.arg(Arg::with_name("json").long("json").help("JSON output"))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,13 +72,13 @@ impl Command for CommandImpl {
|
|||||||
println!("{}", serde_json::to_string_pretty(&u2f_registration_data).unwrap());
|
println!("{}", serde_json::to_string_pretty(&u2f_registration_data).unwrap());
|
||||||
} else {
|
} else {
|
||||||
success!("Device info: {}", u2f_registration_data.device_info);
|
success!("Device info: {}", u2f_registration_data.device_info);
|
||||||
success!("Register challenge: {}", u2fv2_challenge_str);
|
information!("Register challenge: {}", u2fv2_challenge_str);
|
||||||
success!("Register challenge base64: {}", base64::encode(&u2fv2_challenge_str));
|
information!("Register challenge base64: {}", base64::encode(&u2fv2_challenge_str));
|
||||||
if let Some(cert) = u2f_registration_data.attestation_cert_pem {
|
if let Some(cert) = u2f_registration_data.attestation_cert_pem {
|
||||||
success!("Attestation certificate: {}", cert);
|
information!("Attestation certificate: {}", cert);
|
||||||
}
|
}
|
||||||
if let Some(device_name) = u2f_registration_data.device_name {
|
if let Some(device_name) = u2f_registration_data.device_name {
|
||||||
success!("Device name: {}", device_name);
|
information!("Device name: {}", device_name);
|
||||||
}
|
}
|
||||||
success!("Public key: {}", u2f_registration_data.pub_key);
|
success!("Public key: {}", u2f_registration_data.pub_key);
|
||||||
success!("Key handle: {}", u2f_registration_data.key_handle);
|
success!("Key handle: {}", u2f_registration_data.key_handle);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ impl Command for CommandImpl {
|
|||||||
fn subcommand<'a>(&self) -> App<'a, 'a> {
|
fn subcommand<'a>(&self) -> App<'a, 'a> {
|
||||||
SubCommand::with_name(self.name()).about("FIDO U2F Sign subcommand")
|
SubCommand::with_name(self.name()).about("FIDO U2F Sign subcommand")
|
||||||
.arg(Arg::with_name("app-id").short("a").long("app-id").default_value("https://example.com").help("App id"))
|
.arg(Arg::with_name("app-id").short("a").long("app-id").default_value("https://example.com").help("App id"))
|
||||||
.arg(Arg::with_name("timeout").short("t").long("timeout").default_value("10").help("Timeout in seconds"))
|
.arg(Arg::with_name("timeout").short("t").long("timeout").default_value("30").help("Timeout in seconds"))
|
||||||
.arg(Arg::with_name("public-key-hex").long("public-key-hex").takes_value(true).help("Public key hex"))
|
.arg(Arg::with_name("public-key-hex").long("public-key-hex").takes_value(true).help("Public key hex"))
|
||||||
.arg(Arg::with_name("key-handle").short("k").long("key-handle").takes_value(true).multiple(true).help("Key handle"))
|
.arg(Arg::with_name("key-handle").short("k").long("key-handle").takes_value(true).multiple(true).help("Key handle"))
|
||||||
}
|
}
|
||||||
@@ -83,14 +83,14 @@ impl Command for CommandImpl {
|
|||||||
let signature = &sign_data[5..];
|
let signature = &sign_data[5..];
|
||||||
|
|
||||||
success!("Device info: {}", &device_info);
|
success!("Device info: {}", &device_info);
|
||||||
success!("Sign challenge: {}", u2fv2_challenge_str);
|
information!("Sign challenge: {}", u2fv2_challenge_str);
|
||||||
success!("Sign challenge base64: {}", base64::encode(&u2fv2_challenge_str));
|
information!("Sign challenge base64: {}", base64::encode(&u2fv2_challenge_str));
|
||||||
success!("Sign result : {}", base64::encode(&sign_data));
|
information!("Sign result : {}", base64::encode(&sign_data));
|
||||||
success!("- presence : {}", user_presence_flag);
|
information!("- presence : {}", user_presence_flag);
|
||||||
success!("- counter : {}", u32::from_be_bytes([counter[0], counter[1], counter[2], counter[3]]));
|
information!("- counter : {}", u32::from_be_bytes([counter[0], counter[1], counter[2], counter[3]]));
|
||||||
success!("- signature: {}", base64::encode(&signature));
|
information!("- signature: {}", base64::encode(&signature));
|
||||||
// success!("Key handle used: {}", base64::encode(&handle_used));
|
// success!("Key handle used: {}", base64::encode(&handle_used));
|
||||||
success!("Key handle: {}", hex::encode(&handle_used));
|
information!("Key handle: {}", hex::encode(&handle_used));
|
||||||
|
|
||||||
if let Some(public_key_hex) = sub_arg_matches.value_of("public-key-hex") {
|
if let Some(public_key_hex) = sub_arg_matches.value_of("public-key-hex") {
|
||||||
let public_key = opt_result!(hex::decode(public_key_hex), "Parse public key hex failed: {}");
|
let public_key = opt_result!(hex::decode(public_key_hex), "Parse public key hex failed: {}");
|
||||||
|
|||||||
Reference in New Issue
Block a user