mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
+ Sort and group the imports + Normalize and format comments (100 characters width) Command used: $ cargo +nightly fmt -- Acked-by: Steffen Eiden <seiden@linux.ibm.com> Signed-off-by: Marc Hartmayer <marc@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
28 lines
781 B
Rust
28 lines
781 B
Rust
#![allow(missing_docs)]
|
|
|
|
use std::env::args;
|
|
|
|
use pv::misc::{read_certs, read_file};
|
|
use pv::request::EcPubKeyCoord;
|
|
use pv::{Error, Result};
|
|
use pv_core::misc::encode_hex;
|
|
use s390_pv as pv;
|
|
|
|
fn main() -> Result<()> {
|
|
let hkd = args().nth(1).expect("Expect one Host-key document");
|
|
let hkd_bin = read_file(&hkd, "Host-key document")?;
|
|
let certs = read_certs(hkd_bin).map_err(|source| Error::HkdNotPemOrDer { hkd, source })?;
|
|
let hkd_cert = certs
|
|
.first()
|
|
.expect("Expect at least one certificate in the HKD file");
|
|
|
|
let pc: EcPubKeyCoord = hkd_cert
|
|
.public_key()
|
|
.expect("Expected a public key in the Host-key document")
|
|
.try_into()
|
|
.unwrap();
|
|
|
|
println!("{}", encode_hex(pc.sha256().unwrap()));
|
|
Ok(())
|
|
}
|