diff options
author | Igor Matuszewski <igor@sequoia-pgp.org> | 2020-06-17 02:19:18 +0200 |
---|---|---|
committer | Igor Matuszewski <igor@sequoia-pgp.org> | 2020-08-13 15:19:58 +0200 |
commit | d673821c1467a0ddc9ff3e1fa755ccb718e36125 (patch) | |
tree | fe6285cf80b0c3460f46821f2e78592a0d023c39 /openpgp/src/packet/pkesk.rs | |
parent | 18b00b17a57f824ad5a872fffffa54ad09444647 (diff) |
openpgp: Implement ECDH and RSA encryption
Diffstat (limited to 'openpgp/src/packet/pkesk.rs')
-rw-r--r-- | openpgp/src/packet/pkesk.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/openpgp/src/packet/pkesk.rs b/openpgp/src/packet/pkesk.rs index 3b29d960..8b914194 100644 --- a/openpgp/src/packet/pkesk.rs +++ b/openpgp/src/packet/pkesk.rs @@ -362,12 +362,21 @@ mod tests { use crate::packet::key::{Key4, UnspecifiedRole}; // 20 byte sec key - let secret_key = [ + let mut secret_key = [ 0x0,0x0, 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, 0x1,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2, 0x1,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x0,0x0 ]; + // Ensure that the key is at least somewhat valid, according to the + // generation procedure specified in "Responsibilities of the user": + // https://cr.yp.to/ecdh/curve25519-20060209.pdf#page=5 + // Only perform the bit-twiddling on the last byte. This is done so that + // we can still have somewhat defined multiplication while still testing + // the "short" key logic. + // secret_key[0] &= 0xf8; + secret_key[31] &= 0x7f; + secret_key[31] |= 0x40; let key: Key<_, UnspecifiedRole> = Key4::import_secret_cv25519( &secret_key, |