diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2019-03-25 14:59:58 +0100 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2019-03-25 16:54:11 +0100 |
commit | 5d7d51ef0d8a40f230567b8c33e92b6bceded1a9 (patch) | |
tree | 8392052881cba40b287842f35214085d0262bf0c | |
parent | 9e2122b6a2b8e12c64457e39d3330ce95e819612 (diff) |
openpgp: New constructors for SessionKey and Password.
-rw-r--r-- | openpgp/src/crypto/mod.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/openpgp/src/crypto/mod.rs b/openpgp/src/crypto/mod.rs index 5e1b0143..362c1e58 100644 --- a/openpgp/src/crypto/mod.rs +++ b/openpgp/src/crypto/mod.rs @@ -81,6 +81,12 @@ impl From<Box<[u8]>> for SessionKey { } } +impl From<&[u8]> for SessionKey { + fn from(v: &[u8]) -> Self { + Vec::from(v).into() + } +} + impl Drop for SessionKey { fn drop(&mut self) { unsafe { @@ -149,6 +155,12 @@ impl<'a> From<&'a str> for Password { } } +impl From<&[u8]> for Password { + fn from(v: &[u8]) -> Self { + Vec::from(v).into() + } +} + impl Drop for Password { fn drop(&mut self) { unsafe { |