summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2020-01-20 15:02:20 +0100
committerJustus Winter <justus@sequoia-pgp.org>2020-01-21 14:54:21 +0100
commita3d25e6f59351d08d18097ece02981422175bb06 (patch)
tree92a4f89f497defc9e83ffa2423b3481bca39b587
parente7cf618523ebd1f136defe051cde0d984d1aea5e (diff)
openpgp: Add method to return the primary key component.
-rw-r--r--openpgp/src/cert/keyiter.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/openpgp/src/cert/keyiter.rs b/openpgp/src/cert/keyiter.rs
index b5e04fcc..bd0d648e 100644
--- a/openpgp/src/cert/keyiter.rs
+++ b/openpgp/src/cert/keyiter.rs
@@ -333,6 +333,12 @@ impl<'a, P: 'a + key::KeyParts, R: 'a + key::KeyRole> KeyIter<'a, P, R>
}
}
+ /// Returns the primary key component.
+ pub fn primary_key(&self)
+ -> &'a KeyBinding<key::PublicParts, key::PrimaryRole> {
+ &self.cert.as_ref().unwrap().primary
+ }
+
/// Changes the iterator to return subkey components.
///
/// A key component is similar to a key amalgamation, but is not