From 1b0636353b64c3fe451e98ed99b8f9239ca9f91f Mon Sep 17 00:00:00 2001 From: "Neal H. Walfield" Date: Wed, 8 Apr 2020 08:55:03 +0200 Subject: openpgp: Implement From<&Cert> for RevocationKey --- openpgp/src/types/revocation_key.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/openpgp/src/types/revocation_key.rs b/openpgp/src/types/revocation_key.rs index 79c1fc7f..4bacf5ff 100644 --- a/openpgp/src/types/revocation_key.rs +++ b/openpgp/src/types/revocation_key.rs @@ -1,6 +1,7 @@ use quickcheck::{Arbitrary, Gen}; use crate::{ + cert::prelude::*, Error, Fingerprint, Result, @@ -27,6 +28,14 @@ pub struct RevocationKey { unknown: u8, } +impl From<&Cert> for RevocationKey { + fn from(cert: &Cert) -> Self { + RevocationKey::new(cert.primary_key().pk_algo(), + cert.fingerprint(), + false) + } +} + impl RevocationKey { /// Creates a new instance. pub fn new(pk_algo: PublicKeyAlgorithm, fp: Fingerprint, sensitive: bool) -- cgit v1.2.3