feat: v1.1.6, pgp card make
This commit is contained in:
@@ -182,16 +182,17 @@ impl Command for CommandImpl {
|
||||
}
|
||||
|
||||
debugging!("Found PGP RSA private key set: {:?}", pgp_rsa_private_key_set);
|
||||
|
||||
if pgp_rsa_private_key_set.signing.is_none()
|
||||
|| pgp_rsa_private_key_set.encryption.is_none()
|
||||
|| pgp_rsa_private_key_set.authentication.is_none() {
|
||||
warning!("PGP RSA private keys is not complete!");
|
||||
}
|
||||
success!("Found PGP RSA private keys, signing: {}, encryption: {}, authentication: {}",
|
||||
pgp_rsa_private_key_set.signing.is_some(),
|
||||
pgp_rsa_private_key_set.encryption.is_some(),
|
||||
pgp_rsa_private_key_set.authentication.is_some());
|
||||
|
||||
if pgp_rsa_private_key_set.signing.is_none() || pgp_rsa_private_key_set.encryption.is_none() || pgp_rsa_private_key_set.authentication.is_none() {
|
||||
warning!("PGP RSA private keys is not complete!");
|
||||
return Ok(None);
|
||||
}
|
||||
|
||||
let force_make = sub_arg_matches.is_present("force-make");
|
||||
if !force_make {
|
||||
warning!("Force make is OFF, skip write private keys to card!");
|
||||
@@ -206,23 +207,26 @@ impl Command for CommandImpl {
|
||||
opt_result!(trans.verify_pw3(pin.as_ref()), "Admin pin verify failed: {}");
|
||||
success!("Admin pin verify success!");
|
||||
|
||||
let signing_key = pgp_rsa_private_key_set.signing.unwrap();
|
||||
let signing_key_id = signing_key.key_id.clone();
|
||||
information!("Prepare write PGP signing key, key id: {}", signing_key_id);
|
||||
opt_result!(trans.key_import(Box::new(signing_key), KeyType::Signing), "Write PGP signing key failed: {}");
|
||||
success!("Write PGP signing key success, key id: {}", signing_key_id);
|
||||
if let Some(signing_key) = pgp_rsa_private_key_set.signing {
|
||||
let signing_key_id = signing_key.key_id.clone();
|
||||
information!("Prepare write PGP signing key, key id: {}", signing_key_id);
|
||||
opt_result!(trans.key_import(Box::new(signing_key), KeyType::Signing), "Write PGP signing key failed: {}");
|
||||
success!("Write PGP signing key success, key id: {}", signing_key_id);
|
||||
}
|
||||
|
||||
let encryption_key = pgp_rsa_private_key_set.encryption.unwrap();
|
||||
let encryption_key_id = encryption_key.key_id.clone();
|
||||
information!("Prepare write PGP encryption key, key id: {}", signing_key_id);
|
||||
opt_result!(trans.key_import(Box::new(encryption_key), KeyType::Decryption), "Write PGP encryption key failed: {}");
|
||||
success!("Write PGP encryption key success, key id: {}", encryption_key_id);
|
||||
if let Some(encryption_key) = pgp_rsa_private_key_set.encryption {
|
||||
let encryption_key_id = encryption_key.key_id.clone();
|
||||
information!("Prepare write PGP encryption key, key id: {}", signing_key_id);
|
||||
opt_result!(trans.key_import(Box::new(encryption_key), KeyType::Decryption), "Write PGP encryption key failed: {}");
|
||||
success!("Write PGP encryption key success, key id: {}", encryption_key_id);
|
||||
}
|
||||
|
||||
let authentication_key = pgp_rsa_private_key_set.authentication.unwrap();
|
||||
let authentication_key_id = authentication_key.key_id.clone();
|
||||
information!("Prepare write PGP authentication key, key id: {}", signing_key_id);
|
||||
opt_result!(trans.key_import(Box::new(authentication_key), KeyType::Authentication), "Write PGP authentication key failed: {}");
|
||||
success!("Write PGP authentication key success, key id: {}", authentication_key_id);
|
||||
if let Some(authentication_key) = pgp_rsa_private_key_set.authentication {
|
||||
let authentication_key_id = authentication_key.key_id.clone();
|
||||
information!("Prepare write PGP authentication key, key id: {}", signing_key_id);
|
||||
opt_result!(trans.key_import(Box::new(authentication_key), KeyType::Authentication), "Write PGP authentication key failed: {}");
|
||||
success!("Write PGP authentication key success, key id: {}", authentication_key_id);
|
||||
}
|
||||
|
||||
Ok(None)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user