Check TLS Key bits
This commit is contained in:
parent
6954359209
commit
e4af85726f
1 changed files with 7 additions and 5 deletions
|
|
@ -8,7 +8,7 @@ use std::path::Path;
|
||||||
pub struct Key<C, P> {
|
pub struct Key<C, P> {
|
||||||
file_path: P,
|
file_path: P,
|
||||||
command_runner: C,
|
command_runner: C,
|
||||||
bytes: u32,
|
bits: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<C, P> Key<C, P> {
|
impl<C, P> Key<C, P> {
|
||||||
|
|
@ -16,7 +16,7 @@ impl<C, P> Key<C, P> {
|
||||||
Self {
|
Self {
|
||||||
file_path,
|
file_path,
|
||||||
command_runner,
|
command_runner,
|
||||||
bytes: 4096,
|
bits: 4096,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -42,8 +42,10 @@ impl<C: CommandRunner, P: AsRef<Path>> Symbol for Key<C, P> {
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
// FIXME check bytes
|
Ok(
|
||||||
Ok(stdout.ends_with(b"RSA key ok\n"))
|
stdout.ends_with(b"RSA key ok\n")
|
||||||
|
&& stdout.starts_with(format!("RSA Private-Key: ({} bit, 2 primes)\n", self.bits).as_ref()),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn execute(&self) -> Result<(), Box<dyn Error>> {
|
async fn execute(&self) -> Result<(), Box<dyn Error>> {
|
||||||
|
|
@ -55,7 +57,7 @@ impl<C: CommandRunner, P: AsRef<Path>> Symbol for Key<C, P> {
|
||||||
"genrsa",
|
"genrsa",
|
||||||
"-out",
|
"-out",
|
||||||
self.file_path.as_ref(),
|
self.file_path.as_ref(),
|
||||||
self.bytes.to_string(),
|
self.bits.to_string(),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue