implement FromStr for Fingerprint
This commit is contained in:
parent
1e93fbb5c1
commit
84cbdb35c4
@ -63,6 +63,17 @@ impl Display for Fingerprint {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::str::FromStr for Fingerprint {
|
||||
type Err = Error;
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Error> {
|
||||
let mut tmp = s.to_string();
|
||||
tmp.retain(|c| c != ':');
|
||||
let bytes = proxmox::tools::hex_to_digest(&tmp)?;
|
||||
Ok(Fingerprint::new(bytes))
|
||||
}
|
||||
}
|
||||
|
||||
/// Encryption Configuration with secret key
|
||||
///
|
||||
/// This structure stores the secret key and provides helpers for
|
||||
|
Loading…
Reference in New Issue
Block a user