feat: updates
This commit is contained in:
@@ -22,7 +22,7 @@ pub const CERTIFICATES_SEARCH_URL: &str = "https://hatter.ink/ca/fetch_certifica
|
||||
pub struct SignFileRequest {
|
||||
pub filename: Option<String>,
|
||||
pub digest: Vec<u8>,
|
||||
pub timestamp: i128,
|
||||
pub timestamp: i64,
|
||||
pub attributes: Option<String>,
|
||||
pub comment: Option<String>,
|
||||
}
|
||||
@@ -54,7 +54,7 @@ impl SignFileRequest {
|
||||
|
||||
pub enum SignFileTlv {
|
||||
Filename(Option<String>),
|
||||
Timestamp(i128),
|
||||
Timestamp(i64),
|
||||
Attributes(Option<String>),
|
||||
Comment(Option<String>),
|
||||
Digest(Vec<u8>),
|
||||
@@ -67,7 +67,7 @@ impl SignFileTlv {
|
||||
SignFileTlv::Timestamp(_) => 1,
|
||||
SignFileTlv::Attributes(_) => 2,
|
||||
SignFileTlv::Comment(_) => 3,
|
||||
SignFileTlv::Digest(_) => 255,
|
||||
SignFileTlv::Digest(_) => 254,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ pub struct SimpleSignFile {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub filename: Option<String>,
|
||||
pub digest: String,
|
||||
pub timestamp: i128,
|
||||
pub timestamp: i64,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub attributes: Option<String>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
@@ -135,7 +135,8 @@ pub struct CommandImpl;
|
||||
// "attributes": "****",
|
||||
// "comment": "***",
|
||||
// "signatures": [{
|
||||
// "signature": "SHA256withECDSA:HEX(Sign(SHA256("v1"||TLV(filename)||TLV(timestamp)||TLV(attributes)||TLV(comment)||TLV(digest))))",
|
||||
// "algorithm": "SHA256withECDSA",
|
||||
// "signature": "Base64(Sign(SHA256("v1"||TLV(filename)||TLV(timestamp)||TLV(attributes)||TLV(comment)||TLV(digest))))",
|
||||
// "certificates": ["-----BEGIN CERTIFICATE-----\n*****\n-----END CERTIFICATE-----", ...]
|
||||
// }]
|
||||
// }
|
||||
@@ -194,7 +195,7 @@ impl Command for CommandImpl {
|
||||
let sign_file_request = SignFileRequest {
|
||||
filename: filename_opt,
|
||||
digest: file_digest.clone(),
|
||||
timestamp: SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).unwrap().as_millis() as i128,
|
||||
timestamp: SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).unwrap().as_millis() as i64,
|
||||
attributes: attributes_opt,
|
||||
comment: comment_opt,
|
||||
};
|
||||
@@ -223,7 +224,6 @@ impl Command for CommandImpl {
|
||||
};
|
||||
|
||||
println!("{}", serde_json::to_string_pretty(&simple_sig).unwrap());
|
||||
|
||||
Ok(None)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user