diff --git a/src/cmd_info.rs b/src/cmd_info.rs index f134ddd..ab3fe7c 100644 --- a/src/cmd_info.rs +++ b/src/cmd_info.rs @@ -9,7 +9,7 @@ use rust_util::{iff, opt_result, success, XResult}; use rust_util::util_time::get_current_millis; use simpledateformat::format_human2; -use crate::file; +use crate::{file, util}; #[derive(Debug, Args)] pub struct CmdInfo { @@ -71,7 +71,7 @@ pub fn info(cmd_info: CmdInfo) -> XResult<()> { let encryption_algorithm = if let Some(encryption_algorithm) = &meta.encryption_algorithm { encryption_algorithm.to_string() } else { - "AES/GCM (default)".to_string() + format!("{} (default)", util::TINY_ENC_AES_GCM) }; infos.push(format!("{}: {}", header("Encryption algorithm"), encryption_algorithm)); diff --git a/src/spec.rs b/src/spec.rs index 48a84ad..03bd0d9 100644 --- a/src/spec.rs +++ b/src/spec.rs @@ -4,7 +4,7 @@ use rust_util::util_time; use rust_util::util_time::get_millis; use serde::{Deserialize, Serialize}; -use crate::util::{encode_base64, get_user_agent}; +use crate::util::{encode_base64, get_user_agent, TINY_ENC_AES_GCM}; pub const TINY_ENCRYPT_VERSION_10: &'static str = "1.0"; pub const TINY_ENCRYPT_VERSION_11: &'static str = "1.1"; @@ -96,7 +96,7 @@ impl TinyEncryptMeta { ecdh_point: None, envelop: None, envelops: Some(envelops), - encryption_algorithm: None, // use none default + encryption_algorithm: Some(TINY_ENC_AES_GCM.to_string()), nonce: encode_base64(nonce), file_length: metadata.len(), file_last_modified: match metadata.modified() { diff --git a/src/util.rs b/src/util.rs index 2bd98c2..cb4de01 100644 --- a/src/util.rs +++ b/src/util.rs @@ -12,6 +12,8 @@ pub const ENC_AES256_GCM_P256: &str = "aes256-gcm-p256"; pub const TINY_ENC_FILE_EXT: &str = ".tinyenc"; pub const TINY_ENC_CONFIG_FILE: &str = "~/.tinyencrypt/config-rs.json"; +pub const TINY_ENC_AES_GCM: &str = "AES/GCM"; + pub const TINY_ENC_MAGIC_TAG: u16 = 0x01; pub fn require_tiny_enc_file_and_exists(path: impl AsRef) -> XResult<()> {