parent
a03899a588
commit
e72ef67049
|
@ -4,6 +4,11 @@ Tool for producing identities
|
||||||
|
|
||||||
Anagram of "Gorgon".
|
Anagram of "Gorgon".
|
||||||
|
|
||||||
|
## Actions
|
||||||
|
|
||||||
|
* `cargo run -- create eli.key`: makes a new key.
|
||||||
|
* `cargo run -- sign eli.key message.txt [message.sig]`: signs a message, optionally writes the signature to a file.
|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
* Fix up the aegis generation script to ensure that I either have, or don't need, the extensions from Step CA:
|
* Fix up the aegis generation script to ensure that I either have, or don't need, the extensions from Step CA:
|
||||||
|
|
|
@ -12,6 +12,8 @@ fn main() -> std::io::Result<()>{
|
||||||
if action == "sign" {
|
if action == "sign" {
|
||||||
let keyfilepath = std::env::args().nth(2).expect("no keyfilepath given");
|
let keyfilepath = std::env::args().nth(2).expect("no keyfilepath given");
|
||||||
let messagefilepath = std::env::args().nth(3).expect("no message given");
|
let messagefilepath = std::env::args().nth(3).expect("no message given");
|
||||||
|
let maybe_signature_filepath = std::env::args().nth(4);
|
||||||
|
|
||||||
|
|
||||||
let mut keyfile = File::open(&keyfilepath).expect("no file found");
|
let mut keyfile = File::open(&keyfilepath).expect("no file found");
|
||||||
let mut keybuffer: [u8; 32] = [0; 32];
|
let mut keybuffer: [u8; 32] = [0; 32];
|
||||||
|
@ -28,7 +30,14 @@ fn main() -> std::io::Result<()>{
|
||||||
println!("Using key {keyfilepath}");
|
println!("Using key {keyfilepath}");
|
||||||
|
|
||||||
let signature: Signature = signing_key.sign(&messagebuf);
|
let signature: Signature = signing_key.sign(&messagebuf);
|
||||||
|
if maybe_signature_filepath.is_some() {
|
||||||
|
let filename = maybe_signature_filepath.expect("Not possible");
|
||||||
|
let mut file = File::create(filename.clone())?;
|
||||||
|
println!("Writing signature to {filename}");
|
||||||
|
file.write_all(&signature.to_bytes())?;
|
||||||
|
} else {
|
||||||
println!("Signture: {signature}");
|
println!("Signture: {signature}");
|
||||||
|
}
|
||||||
return Ok(())
|
return Ok(())
|
||||||
} else if action == "create" {
|
} else if action == "create" {
|
||||||
let keyfilepath = std::env::args().nth(2).expect("no keyfilepath given");
|
let keyfilepath = std::env::args().nth(2).expect("no keyfilepath given");
|
||||||
|
|
Loading…
Reference in New Issue