feat: fix open-card-sign --algo

This commit is contained in:
2023-10-14 00:18:54 +08:00
parent b5e65cc54d
commit aadb4b0530

View File

@@ -48,7 +48,7 @@ impl Command for CommandImpl {
.arg(Arg::with_name("use-sha256").long("use-sha256").help("Use SHA256 for file in"))
.arg(Arg::with_name("use-sha384").long("use-sha384").help("Use SHA384 for file in"))
.arg(Arg::with_name("use-sha512").long("use-sha512").help("Use SHA512 for file in"))
.arg(Arg::with_name("algo").long("algo").help("Algorithm, rsa, ecdsa, eddsa"))
.arg(Arg::with_name("algo").long("algo").takes_value(true).help("Algorithm, rsa, ecdsa, eddsa"))
.arg(Arg::with_name("json").long("json").help("JSON output"))
}
@@ -82,15 +82,21 @@ impl Command for CommandImpl {
if use_sha256 {
let hash = opt_result!(calc_file_digest::<Sha256>(file_in), "Calc file: {} SHA256 failed: {}", file_in);
sha256 = Some(hex::encode(hash));
let hash_hex = hex::encode(hash);
information!("File SHA256 hex: {}", &hash_hex);
sha256 = Some(hash_hex);
}
if use_sha384 {
let hash = opt_result!(calc_file_digest::<Sha384>(file_in), "Calc file: {} SHA384 failed: {}", file_in);
sha384 = Some(hex::encode(hash));
let hash_hex = hex::encode(hash);
information!("File SHA384 hex: {}", &hash_hex);
sha384 = Some(hash_hex);
}
if use_sha512 {
let hash = opt_result!(calc_file_digest::<Sha512>(file_in), "Calc file: {} SHA512 failed: {}", file_in);
sha512 = Some(hex::encode(hash));
let hash_hex = hex::encode(hash);
information!("File SHA512 hex: {}", &hash_hex);
sha512 = Some(hash_hex);
}
let mut entry = BTreeMap::new();