diff --git a/src/certificate.rs b/src/certificate.rs index ba78bba..fb8261b 100644 --- a/src/certificate.rs +++ b/src/certificate.rs @@ -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::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 {