signature

This commit is contained in:
nora 2024-08-22 21:07:57 +02:00
parent a52b6b37d7
commit 3f0b367c39
3 changed files with 16 additions and 1 deletions

11
Cargo.lock generated
View file

@ -796,6 +796,16 @@ dependencies = [
"windows-targets 0.52.6",
]
[[package]]
name = "pem"
version = "3.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e459365e590736a54c3fa561947c84837534b8e9af6fc5bf781307e82658fae"
dependencies = [
"base64",
"serde",
]
[[package]]
name = "pem-rfc7468"
version = "0.7.0"
@ -1192,6 +1202,7 @@ dependencies = [
"clap",
"eyre",
"hex",
"pem",
"rpassword",
"sha2",
"ssh-agent-client",

View file

@ -14,3 +14,4 @@ tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
rpassword = "7.3.1"
sha2 = "0.10.8"
hex = "0.4.3"
pem = "3.0.4"

View file

@ -1,4 +1,4 @@
use std::path::PathBuf;
use std::{io::Write, path::PathBuf};
use clap::Parser;
use eyre::{bail, Context};
@ -97,6 +97,9 @@ async fn main() -> eyre::Result<()> {
};
let signature = agent.sign(&key.key_blob, &file, 0).await?;
let signature = pem::encode(&pem::Pem::new("SSH SIGNATURE", signature));
std::io::stdout().write_all(signature.as_bytes())?;
}
Subcommand::Lock => {
let passphrase =