impl<'a> TryFrom<&'a [u8]> for Certificate

This commit is contained in:
Jack Grigg
2019-12-11 02:44:02 +00:00
parent 2eff313064
commit d113c1f4b9
+8
View File
@@ -169,6 +169,14 @@ pub struct Certificate {
data: Buffer,
}
impl<'a> TryFrom<&'a [u8]> for Certificate {
type Error = Error;
fn try_from(bytes: &'a [u8]) -> Result<Self, Error> {
Self::from_bytes(bytes.to_vec())
}
}
impl Certificate {
/// Read a certificate from the given slot in the YubiKey
pub fn read(yubikey: &mut YubiKey, slot: SlotId) -> Result<Self, Error> {