feat: pgp-card-list
This commit is contained in:
@@ -50,19 +50,19 @@ impl Command for CommandImpl {
|
||||
debugging!("Fingerprints: {:?}", application_related_data.fingerprints());
|
||||
if json_output {
|
||||
if let Ok(application_identifier) = application_related_data.application_id() {
|
||||
json.insert("application", format!("{}", application_identifier.application()));
|
||||
json.insert("version", format!("{}", application_identifier.version()));
|
||||
json.insert("serial", format!("{}", application_identifier.serial()));
|
||||
json.insert("manufacturer", format!("{}", application_identifier.manufacturer()));
|
||||
json.insert("ident", application_identifier.ident());
|
||||
json.insert("application".to_string(), format!("{}", application_identifier.application()));
|
||||
json.insert("version".to_string(), format!("{}", application_identifier.version()));
|
||||
json.insert("serial".to_string(), format!("{}", application_identifier.serial()));
|
||||
json.insert("manufacturer".to_string(), format!("{}", application_identifier.manufacturer()));
|
||||
json.insert("ident".to_string(), application_identifier.ident());
|
||||
}
|
||||
}
|
||||
}
|
||||
information!("Feature pin pad, verify: {}, modify: {}",
|
||||
trans.feature_pinpad_verify(), trans.feature_pinpad_modify());
|
||||
if json_output {
|
||||
json.insert("feature_pinpad_verify", format!("{}", trans.feature_pinpad_verify()));
|
||||
json.insert("feature_pinpad_modify", format!("{}", trans.feature_pinpad_modify()));
|
||||
json.insert("feature_pinpad_verify".to_string(), format!("{}", trans.feature_pinpad_verify()));
|
||||
json.insert("feature_pinpad_modify".to_string(), format!("{}", trans.feature_pinpad_modify()));
|
||||
}
|
||||
|
||||
if let Ok(security_supported_template) = trans.security_support_template() {
|
||||
@@ -98,64 +98,31 @@ impl Command for CommandImpl {
|
||||
}
|
||||
if let Ok(application_related_data) = trans.application_related_data() {
|
||||
if let Ok(fingerprints) = application_related_data.fingerprints() {
|
||||
if let Some(a) = fingerprints.authentication() {
|
||||
if let Ok(algo) = application_related_data.algorithm_attributes(KeyType::Authentication) {
|
||||
information!("Authentication algo: {:?}", algo);
|
||||
let fingerprints = vec![
|
||||
("Authentication", "authentication", KeyType::Authentication, fingerprints.authentication()),
|
||||
("Decryption", "encryption", KeyType::Decryption, fingerprints.decryption()),
|
||||
("Signature", "signature", KeyType::Signing, fingerprints.signature()),
|
||||
];
|
||||
for (tag1, tag2, key_type, fingerprint) in fingerprints {
|
||||
let fingerprint = match fingerprint {
|
||||
Some(fingerprint) => fingerprint,
|
||||
None => continue
|
||||
};
|
||||
if let Ok(algo) = application_related_data.algorithm_attributes(key_type) {
|
||||
information!("{} algo: {:?}", tag1, algo);
|
||||
}
|
||||
information!("Authentication fingerprint: {}", a);
|
||||
information!("{} fingerprint: {}", tag1, fingerprint);
|
||||
if json_output {
|
||||
json.insert("authentication_fingerprint", a.to_string());
|
||||
json.insert(format!("{}_fingerprint", tag2), fingerprint.to_string());
|
||||
}
|
||||
if detail_output {
|
||||
if let Ok(public_key) = trans.public_key(KeyType::Authentication) {
|
||||
if let Ok(public_key) = trans.public_key(key_type) {
|
||||
if let Some((public_key_sha256, public_key_pem)) = public_key_pem(&public_key) {
|
||||
information!("Authentication public key sha256: {}", hex::encode(&public_key_sha256));
|
||||
information!("Authentication public key: {}", public_key_pem.trim());
|
||||
information!("{} public key sha256: {}", tag1, hex::encode(&public_key_sha256));
|
||||
information!("{} public key: {}", tag1, public_key_pem.trim());
|
||||
if json_output {
|
||||
json.insert("authentication_public_key_sha256", hex::encode(&public_key_sha256));
|
||||
json.insert("authentication_public_key_pem", public_key_pem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Some(d) = fingerprints.decryption() {
|
||||
if let Ok(algo) = application_related_data.algorithm_attributes(KeyType::Decryption) {
|
||||
information!("Encryption algo: {:?}", algo);
|
||||
}
|
||||
information!("Encryption fingerprint: {}", d);
|
||||
if json_output {
|
||||
json.insert("encryption_fingerprint", d.to_string());
|
||||
}
|
||||
if detail_output {
|
||||
if let Ok(public_key) = trans.public_key(KeyType::Decryption) {
|
||||
if let Some((public_key_sha256, public_key_pem)) = public_key_pem(&public_key) {
|
||||
information!("Encryption public key sha256: {}", hex::encode(&public_key_sha256));
|
||||
information!("Encryption public key: {}", public_key_pem.trim());
|
||||
if json_output {
|
||||
json.insert("encryption_public_key_sha256", hex::encode(&public_key_sha256));
|
||||
json.insert("encryption_public_key_pem", public_key_pem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Some(s) = fingerprints.signature() {
|
||||
if let Ok(algo) = application_related_data.algorithm_attributes(KeyType::Signing) {
|
||||
information!("Signature algo: {:?}", algo);
|
||||
}
|
||||
information!("Signature fingerprint: {}", s);
|
||||
if json_output {
|
||||
json.insert("signature_fingerprint", s.to_string());
|
||||
}
|
||||
if detail_output {
|
||||
if let Ok(public_key) = trans.public_key(KeyType::Signing) {
|
||||
if let Some((public_key_sha256, public_key_pem)) = public_key_pem(&public_key) {
|
||||
information!("Signature public key sha256: {}", hex::encode(&public_key_sha256));
|
||||
information!("Signature public key: {}", public_key_pem.trim());
|
||||
if json_output {
|
||||
json.insert("signature_public_key_sha256", hex::encode(&public_key_sha256));
|
||||
json.insert("signature_public_key_pem", public_key_pem);
|
||||
json.insert(format!("{}_public_key_sha256", tag2), hex::encode(&public_key_sha256));
|
||||
json.insert(format!("{}_public_key_pem", tag2), public_key_pem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user