summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2023-05-24 14:17:17 +0200
committerJustus Winter <justus@sequoia-pgp.org>2023-06-20 12:09:05 +0200
commit1056f917553f0c6a231c240251548f982b81b31d (patch)
tree388d59baee30f626d69224f96dc58a45719f5953
parent8e2dcd5287b24d246ae2083821fb83f39b34e1bc (diff)
openpgp: Add SessionKey::as_protected.
-rw-r--r--openpgp/NEWS1
-rw-r--r--openpgp/src/crypto/mod.rs5
2 files changed, 6 insertions, 0 deletions
diff --git a/openpgp/NEWS b/openpgp/NEWS
index 0b889aab..9902943f 100644
--- a/openpgp/NEWS
+++ b/openpgp/NEWS
@@ -9,6 +9,7 @@
keys. Being lenient in this case helps the user recover their
valuable key material.
** New functionality
+ - crypto::SessionKey::as_protected
- types::AEADAlgorithm::GCM
** Deprecated functionality
- types::Curve::len, use types::Curve::bits instead
diff --git a/openpgp/src/crypto/mod.rs b/openpgp/src/crypto/mod.rs
index 74a5c860..1c136102 100644
--- a/openpgp/src/crypto/mod.rs
+++ b/openpgp/src/crypto/mod.rs
@@ -117,6 +117,11 @@ impl SessionKey {
random(&mut sk);
Self(sk)
}
+
+ /// Returns a reference to the inner [`mem::Protected`].
+ pub fn as_protected(&self) -> &mem::Protected {
+ &self.0
+ }
}
impl Deref for SessionKey {