Initial & final commit
commit
018eab99c0
|
@ -0,0 +1 @@
|
||||||
|
/target
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,7 @@
|
||||||
|
[package]
|
||||||
|
name = "simple-age-encryptor"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
age = "0.7.0"
|
|
@ -0,0 +1,21 @@
|
||||||
|
use age::{secrecy::SecretString, Encryptor};
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let passphrase = std::env::args()
|
||||||
|
.nth(1)
|
||||||
|
.expect("Failed to retrieve the passphrase from the CLI arguments");
|
||||||
|
let passphrase = SecretString::new(passphrase);
|
||||||
|
|
||||||
|
let encryptor = Encryptor::with_user_passphrase(passphrase);
|
||||||
|
|
||||||
|
let stdout = std::io::stdout();
|
||||||
|
let mut reader = std::io::stdin();
|
||||||
|
|
||||||
|
let mut writer = encryptor
|
||||||
|
.wrap_output(stdout.lock())
|
||||||
|
.expect("Failed to wrap standard output in encryption");
|
||||||
|
|
||||||
|
std::io::copy(&mut reader, &mut writer).expect("Failed to pipe from stdin to stdout");
|
||||||
|
|
||||||
|
writer.finish().expect("Failed to finish writing");
|
||||||
|
}
|
Loading…
Reference in New Issue