summaryrefslogtreecommitdiffstats
path: root/openpgp/src/keyhandle.rs
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2020-02-06 15:41:26 +0100
committerJustus Winter <justus@sequoia-pgp.org>2020-02-06 15:41:26 +0100
commit537765aea0e34dda98d8038b339162f75a4ff76d (patch)
tree60ea3275d90ff410ebf3cf0622bb375c10ce3f70 /openpgp/src/keyhandle.rs
parent7c5b91a3c6b66a2ff27940398ac5b0204223d043 (diff)
openpgp: Implement KeyHandle::to_hex.
Diffstat (limited to 'openpgp/src/keyhandle.rs')
-rw-r--r--openpgp/src/keyhandle.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/openpgp/src/keyhandle.rs b/openpgp/src/keyhandle.rs
index c5058b9d..2dea1e35 100644
--- a/openpgp/src/keyhandle.rs
+++ b/openpgp/src/keyhandle.rs
@@ -128,6 +128,14 @@ impl PartialEq for KeyHandle {
}
impl KeyHandle {
+ /// Converts the key handle to a hexadecimal number.
+ pub fn to_hex(&self) -> String {
+ match self {
+ KeyHandle::Fingerprint(i) => i.to_hex(),
+ KeyHandle::KeyID(i) => i.to_hex(),
+ }
+ }
+
/// Returns a reference to the raw identifier.
pub fn as_slice(&self) -> &[u8] {
match self {