diff --git a/src/cmd_signfile.rs b/src/cmd_signfile.rs index c1d9167..4c85d21 100644 --- a/src/cmd_signfile.rs +++ b/src/cmd_signfile.rs @@ -14,7 +14,7 @@ use crate::digest::sha256_bytes; use crate::util::base64_encode; pub const SIMPLE_SIG_V1: &str = "v1"; -pub const SIMPLE_SIG_SPECIFICATION: &str = "https://openwebstandard.org/simple-sign-file/v1"; +pub const SIMPLE_SIG_SCHEMA: &str = "https://openwebstandard.org/simple-sign-file/v1"; pub const HASH_ALGORITHM_SHA256: &str = "sha256"; pub const SIGNATURE_ALGORITHM_SHA256_WITH_ECDSA: &str = "SHA256withECDSA"; pub const CERTIFICATES_SEARCH_URL: &str = "https://hatter.ink/ca/fetch_certificates.json?fingerprint="; @@ -111,7 +111,7 @@ pub struct SimpleSignFileSignature { #[derive(Serialize)] pub struct SimpleSignFile { - pub specification: String, + pub schema: String, #[serde(skip_serializing_if = "Option::is_none")] pub filename: Option, pub digest: String, @@ -127,7 +127,7 @@ pub struct CommandImpl; // Format: // { -// "specification": "https://openwebstandard.org/simple-sign-file/v1", +// "schema": "https://openwebstandard.org/simple-sign-file/v1", // "version": "v1", // "filename": "example.zip", // "digest": "sha256-HEX(SHA256(filename-content))", @@ -149,7 +149,8 @@ impl Command for CommandImpl { fn subcommand<'a>(&self) -> App<'a, 'a> { SubCommand::with_name(self.name()).about("PIV Sign(with SHA256) subcommand") .arg(Arg::with_name("pin").short("p").long("pin").takes_value(true).help("PIV card user pin")) - .arg(Arg::with_name("slot").short("s").long("slot").takes_value(true).required(true).help("PIV slot, e.g. 82, 83 ... 95, 9a, 9c, 9d, 9e")) + .arg(Arg::with_name("slot").short("s").long("slot") + .takes_value(true).required(true).help("PIV slot, e.g. 82, 83 ... 95, 9a, 9c, 9d, 9e")) .arg(Arg::with_name("file").short("f").long("file").takes_value(true).required(true).help("Input file")) .arg(Arg::with_name("filename").short("n").long("filename").takes_value(true).help("Filename")) .arg(Arg::with_name("comment").short("c").long("comment").takes_value(true).help("Comment")) @@ -214,7 +215,7 @@ impl Command for CommandImpl { certificates, }; let simple_sig = SimpleSignFile { - specification: SIMPLE_SIG_SPECIFICATION.to_string(), + schema: SIMPLE_SIG_SCHEMA.to_string(), filename: sign_file_request.filename.clone(), digest: format!("{}-{}", HASH_ALGORITHM_SHA256, hex::encode(&sign_file_request.digest)), timestamp: sign_file_request.timestamp,