diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2022-01-21 15:42:59 +0100 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2022-01-21 15:48:56 +0100 |
commit | 827ee8254d194106809aea25090921c8d7802de7 (patch) | |
tree | 1ae62eaca5e913bf3b27496490fce55726fe26cb /openpgp/src/serialize.rs | |
parent | de209ea8a2593be7a45b81f86a8d82cf441640d2 (diff) |
openpgp: Fix parsing and serializing keys on 32-bit time_t systems.
- Previously, during parsing and serialization, OpenPGP's unsigned
32-bit timestamps were converted to Rust's SystemTime, which uses
time_t. On platforms where that is a signed 32-bit value, the time
was truncated. See #668.
- One way to fix that is to make Rust's SystemTime independent of
time_t. See https://github.com/rust-lang/rust/issues/44394.
- The other way is not to convert to SystemTime at the API
boundary. See
https://gitlab.com/sequoia-pgp/sequoia/-/issues/806.
- This fixes handling during parsing and serialization, but doesn't
address the API issue.
- Fixes #802.
Diffstat (limited to 'openpgp/src/serialize.rs')
-rw-r--r-- | openpgp/src/serialize.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/openpgp/src/serialize.rs b/openpgp/src/serialize.rs index 08b9cc40..6656e439 100644 --- a/openpgp/src/serialize.rs +++ b/openpgp/src/serialize.rs @@ -1807,7 +1807,7 @@ impl<P, R> Marshal for Key4<P, R> let have_secret_key = P::significant_secrets() && self.has_secret(); write_byte(o, 4)?; // Version. - write_be_u32(o, Timestamp::try_from(self.creation_time())?.into())?; + write_be_u32(o, self.creation_time_raw().into())?; write_byte(o, self.pk_algo().into())?; self.mpis().serialize(o)?; |