diff options
author | Neal H. Walfield <neal@pep.foundation> | 2020-08-03 17:51:21 +0200 |
---|---|---|
committer | Neal H. Walfield <neal@pep.foundation> | 2020-08-03 17:51:21 +0200 |
commit | e18c79c37db27d138caeed67025d8b247410c3b8 (patch) | |
tree | 9ac1b245e9758d66cea18399ccde2320924c38c3 | |
parent | cb6b672a4dbb703cb92661bfa82b7089919a107b (diff) |
openpgp: Remove SignatureBuilder::set_key_expiration_time.
- Internally, we work with relative times, not absolute times.
- Working with absolute times is error prone: when setting the key
expiration should it be relative to the current value of the
Signature Creation subpacket or the one when the SignatureBuilder
is finalized?
- Just remove `SignatureBuilder::set_key_expiration_time.`
-rw-r--r-- | openpgp/src/packet/signature/subpacket.rs | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/openpgp/src/packet/signature/subpacket.rs b/openpgp/src/packet/signature/subpacket.rs index a67cf7d0..875a3a73 100644 --- a/openpgp/src/packet/signature/subpacket.rs +++ b/openpgp/src/packet/signature/subpacket.rs @@ -2529,32 +2529,6 @@ impl signature::SignatureBuilder { Ok(self) } - /// Sets the value of the Key Expiration Time subpacket. - /// - /// If `None` is given, any expiration subpacket is removed. - pub fn set_key_expiration_time<P, R>( - self, - key: &Key<P, R>, - expiration: Option<time::SystemTime>) - -> Result<Self> - where P: key::KeyParts, - R: key::KeyRole, - { - if let Some(e) = expiration.map(crate::types::normalize_systemtime) { - let ct = key.creation_time(); - let vp = match e.duration_since(ct) { - Ok(v) => v, - Err(_) => return Err(Error::InvalidArgument( - format!("Expiration time {:?} predates creation time \ - {:?}", e, ct)).into()), - }; - - self.set_key_validity_period(Some(vp)) - } else { - self.set_key_validity_period(None) - } - } - /// Sets the value of the Preferred Symmetric Algorithms /// subpacket, which contains the list of symmetric algorithms /// that the key holder prefers, ordered according by the key |