summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@pep.foundation>2020-04-08 08:55:03 +0200
committerNeal H. Walfield <neal@pep.foundation>2020-04-08 21:37:42 +0200
commit1b0636353b64c3fe451e98ed99b8f9239ca9f91f (patch)
tree21a83b0ae69069454e0f1fa73a9093a9ca762470
parentd0b2249d635c70d5d42a38733dcdf971d3dfe346 (diff)
openpgp: Implement From<&Cert> for RevocationKey
-rw-r--r--openpgp/src/types/revocation_key.rs9
1 files changed, 9 insertions, 0 deletions
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)