17 lines
448 B
Rust
17 lines
448 B
Rust
use std::io::Read;
|
|
|
|
use openssl::x509::X509;
|
|
|
|
pub fn main() -> anyhow::Result<()> {
|
|
let mut buf = Vec::new();
|
|
std::io::stdin().read_to_end(&mut buf)?;
|
|
let cert = if buf.starts_with(b"-----BEGIN CERTIFICATE-----") {
|
|
openssl::x509::X509::from_pem(buf.as_slice())?
|
|
} else {
|
|
X509::from_der(buf.as_slice())?
|
|
};
|
|
|
|
eprint!("{}", toml::to_string(&ascertain::report::CertInfo::extract(cert.as_ref())?)?);
|
|
|
|
Ok(())
|
|
} |