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 08:55:03 +0200
commit79f7039c1267c73f73ad6edcc62b10950f58bf8a (patch)
tree7a193fdb1562adf689b15c7751b40c7abdb71704
parenta1b06c5bc4b755c3e9d7a2e79ff20c216258fdcc (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)