summaryrefslogtreecommitdiffstats
path: root/openpgp/src/crypto/mod.rs
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2019-06-24 16:54:51 +0200
committerJustus Winter <justus@sequoia-pgp.org>2019-06-24 17:57:53 +0200
commit0d2e6c904dff8f13fd5f5360da4ff6ef79fca9a8 (patch)
tree2586fcb9663245f60beb615a942c9613545dfea8 /openpgp/src/crypto/mod.rs
parent23bb80eb6dd540d7af47235c6ba0ca3565c3c68f (diff)
openpgp: Add a function to convert SessionKeys back to Vec<u8>.
Diffstat (limited to 'openpgp/src/crypto/mod.rs')
-rw-r--r--openpgp/src/crypto/mod.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/openpgp/src/crypto/mod.rs b/openpgp/src/crypto/mod.rs
index b2a4cdd4..63f32393 100644
--- a/openpgp/src/crypto/mod.rs
+++ b/openpgp/src/crypto/mod.rs
@@ -49,6 +49,11 @@ impl SessionKey {
rng.random(&mut sk);
sk.into()
}
+
+ /// Converts to a buffer for modification.
+ pub unsafe fn into_vec(mut self) -> Vec<u8> {
+ std::mem::replace(&mut self.0, vec![].into()).into()
+ }
}
impl Deref for SessionKey {