feat: v0.7.1, compiles without smart card(encrypt only)
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -1727,7 +1727,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tiny-encrypt"
|
||||
version = "0.7.0"
|
||||
version = "0.7.1"
|
||||
dependencies = [
|
||||
"aes-gcm-stream",
|
||||
"base64",
|
||||
|
||||
12
Cargo.toml
12
Cargo.toml
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "tiny-encrypt"
|
||||
version = "0.7.0"
|
||||
version = "0.7.1"
|
||||
edition = "2021"
|
||||
license = "MIT"
|
||||
description = "A simple and tiny file encrypt tool"
|
||||
@@ -8,6 +8,10 @@ repository = "https://git.hatter.ink/hatter/tiny-encrypt-rs"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[features]
|
||||
default = ["smartcard"]
|
||||
smartcard = ["openpgp-card", "openpgp-card-pcsc", "yubikey"]
|
||||
|
||||
[dependencies]
|
||||
aes-gcm-stream = "0.2"
|
||||
base64 = "0.21"
|
||||
@@ -18,8 +22,8 @@ flate2 = "1.0"
|
||||
fs-set-times = "0.20"
|
||||
hex = "0.4"
|
||||
indicatif = "0.17"
|
||||
openpgp-card = "0.3"
|
||||
openpgp-card-pcsc = "0.3"
|
||||
openpgp-card = { version = "0.3", optional = true }
|
||||
openpgp-card-pcsc = { version = "0.3", optional = true }
|
||||
p256 = { version = "0.13", features = ["pem", "ecdh", "pkcs8"] }
|
||||
p384 = { version = "0.13", features = ["pem", "ecdh", "pkcs8"] }
|
||||
rand = "0.8"
|
||||
@@ -35,7 +39,7 @@ simpledateformat = "0.1"
|
||||
tabled = "0.14"
|
||||
x25519-dalek = "2.0"
|
||||
x509-parser = "0.15"
|
||||
yubikey = { version = "0.8", features = ["untested"] }
|
||||
yubikey = { version = "0.8", features = ["untested"], optional = true }
|
||||
zeroize = "1.6"
|
||||
|
||||
[patch.crates-io]
|
||||
|
||||
@@ -19,6 +19,11 @@ Set default encryption algorithm:
|
||||
export TINY_ENCRYPT_DEFAULT_ALGORITHM='AES' # or CHACHA20
|
||||
```
|
||||
|
||||
Compile only encrypt:
|
||||
```shell
|
||||
cargo build --release --no-default-features
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
Encrypt config `~/.tinyencrypt/config-rs.json`:
|
||||
|
||||
@@ -7,10 +7,15 @@ use crate::util;
|
||||
pub struct CmdVersion {}
|
||||
|
||||
pub fn version(_cmd_version: CmdVersion) -> XResult<()> {
|
||||
let mut features: Vec<&str> = vec![];
|
||||
#[cfg(feature = "smartcard")]
|
||||
features.push("smartcard");
|
||||
if features.is_empty() { features.push("-"); }
|
||||
println!(
|
||||
"User-Agent: {}\n{}",
|
||||
"User-Agent: {} [ with features: {} ]\n{}",
|
||||
util::get_user_agent(),
|
||||
env!("CARGO_PKG_DESCRIPTION"),
|
||||
features.join(", "),
|
||||
env!("CARGO_PKG_DESCRIPTION")
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
@@ -1,7 +1,10 @@
|
||||
pub use cmd_config::CmdConfig;
|
||||
pub use cmd_config::config;
|
||||
#[cfg(feature = "smartcard")]
|
||||
pub use cmd_decrypt::CmdDecrypt;
|
||||
#[cfg(feature = "smartcard")]
|
||||
pub use cmd_decrypt::decrypt;
|
||||
#[cfg(feature = "smartcard")]
|
||||
pub use cmd_decrypt::decrypt_single;
|
||||
pub use cmd_directdecrypt::CmdDirectDecrypt;
|
||||
pub use cmd_directdecrypt::direct_decrypt;
|
||||
@@ -20,7 +23,9 @@ mod util;
|
||||
mod util_env;
|
||||
mod util_digest;
|
||||
mod util_progress;
|
||||
#[cfg(feature = "smartcard")]
|
||||
mod util_piv;
|
||||
#[cfg(feature = "smartcard")]
|
||||
mod util_pgp;
|
||||
mod util_p256;
|
||||
mod util_p384;
|
||||
@@ -38,6 +43,7 @@ mod util_enc_file;
|
||||
mod cmd_version;
|
||||
mod cmd_config;
|
||||
mod cmd_info;
|
||||
#[cfg(feature = "smartcard")]
|
||||
mod cmd_decrypt;
|
||||
mod cmd_encrypt;
|
||||
mod cmd_directdecrypt;
|
||||
|
||||
@@ -3,7 +3,9 @@ extern crate core;
|
||||
use clap::{Parser, Subcommand};
|
||||
use rust_util::XResult;
|
||||
|
||||
use tiny_encrypt::{CmdConfig, CmdDecrypt, CmdDirectDecrypt, CmdEncrypt, CmdInfo, CmdVersion};
|
||||
use tiny_encrypt::{CmdConfig, CmdDirectDecrypt, CmdEncrypt, CmdInfo, CmdVersion};
|
||||
#[cfg(feature = "smartcard")]
|
||||
use tiny_encrypt::CmdDecrypt;
|
||||
|
||||
#[derive(Debug, Parser)]
|
||||
#[command(name = "tiny-encrypt-rs")]
|
||||
@@ -18,6 +20,7 @@ enum Commands {
|
||||
/// Encrypt file(s)
|
||||
#[command(arg_required_else_help = true, short_flag = 'e')]
|
||||
Encrypt(CmdEncrypt),
|
||||
#[cfg(feature = "smartcard")]
|
||||
/// Decrypt file(s)
|
||||
#[command(arg_required_else_help = true, short_flag = 'd')]
|
||||
Decrypt(CmdDecrypt),
|
||||
@@ -39,6 +42,7 @@ fn main() -> XResult<()> {
|
||||
let args = Cli::parse();
|
||||
match args.command {
|
||||
Commands::Encrypt(cmd_encrypt) => tiny_encrypt::encrypt(cmd_encrypt),
|
||||
#[cfg(feature = "smartcard")]
|
||||
Commands::Decrypt(cmd_decrypt) => tiny_encrypt::decrypt(cmd_decrypt),
|
||||
Commands::DirectDecrypt(cmd_direct_decrypt) => tiny_encrypt::direct_decrypt(cmd_direct_decrypt),
|
||||
Commands::Info(cmd_info) => tiny_encrypt::info(cmd_info),
|
||||
|
||||
Reference in New Issue
Block a user