summaryrefslogtreecommitdiffstats
path: root/openpgp/src/crypto/mod.rs
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2019-03-25 11:01:07 +0100
committerJustus Winter <justus@sequoia-pgp.org>2019-03-25 11:01:07 +0100
commitfee8268526e7fdefe41055e7bd10a84c06b88e44 (patch)
tree86f7f5418b029e8cc9715da6bfd4207c47353a52 /openpgp/src/crypto/mod.rs
parentc36dbe6eb447239824f0014ec6beae2df9f42a7c (diff)
openpgp: Implement AsRef<[u8]> for SessionKey and Password.
Diffstat (limited to 'openpgp/src/crypto/mod.rs')
-rw-r--r--openpgp/src/crypto/mod.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/openpgp/src/crypto/mod.rs b/openpgp/src/crypto/mod.rs
index 8e56d424..5e1b0143 100644
--- a/openpgp/src/crypto/mod.rs
+++ b/openpgp/src/crypto/mod.rs
@@ -57,6 +57,12 @@ impl Deref for SessionKey {
}
}
+impl AsRef<[u8]> for SessionKey {
+ fn as_ref(&self) -> &[u8] {
+ &self.0
+ }
+}
+
impl DerefMut for SessionKey {
fn deref_mut(&mut self) -> &mut [u8] {
&mut self.0
@@ -105,6 +111,12 @@ impl PartialEq for Password {
}
}
+impl AsRef<[u8]> for Password {
+ fn as_ref(&self) -> &[u8] {
+ &self.0
+ }
+}
+
impl Deref for Password {
type Target = [u8];