diff options
author | Neal H. Walfield <neal@pep.foundation> | 2020-07-31 17:18:03 +0200 |
---|---|---|
committer | Neal H. Walfield <neal@pep.foundation> | 2020-07-31 17:18:03 +0200 |
commit | b9fa90f13655cd7e85522be91e91456077884427 (patch) | |
tree | e4908dd3acc0f84d841c452b18789a29baca5e49 | |
parent | 2419457badd9dea9dc093b0395f947a91ed35b92 (diff) |
openpgp: Remove SignatureBuilder::set_signature_expiration_time.
- `SignatureBuilder::set_signature_expiration_time` takes an
absolute time and converts it to a duration relative to the
`Signature Creation Time` subpacket.
- Since we sometimes set the `Signature Creation Time` subpacket
lazily, this should probably also be set lazily.
- But that makes the `SignatureBuilder` more complicated. And, it
means that `SignatureBuilder::modify_hashed_area`'s behavior is
more complicated.
- Instead of adding complexity, only provide the
`SignatureBuilder::set_signature_validity_period` method, which is
what is appears to be needed in practice.
-rw-r--r-- | openpgp/src/packet/signature/subpacket.rs | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/openpgp/src/packet/signature/subpacket.rs b/openpgp/src/packet/signature/subpacket.rs index ea8d2b3a..158202ee 100644 --- a/openpgp/src/packet/signature/subpacket.rs +++ b/openpgp/src/packet/signature/subpacket.rs @@ -2459,29 +2459,6 @@ impl signature::SignatureBuilder { Ok(self) } - /// Sets the value of the Signature Expiration Time subpacket. - /// - /// If `None` is given, any expiration subpacket is removed. - pub fn set_signature_expiration_time<D>(self, expiration: D) - -> Result<Self> - where D: Into<time::SystemTime> - { - let expiration = expiration.into(); - let vp = if let Some(ct) = self.signature_creation_time() { - match expiration.duration_since(ct) { - Ok(v) => v, - Err(_) => return Err(Error::InvalidArgument( - format!("Expiration time {:?} predates creation time \ - {:?}", expiration, ct)).into()), - } - } else { - return Err(Error::MalformedPacket( - "No creation time subpacket".into()).into()); - }; - - self.set_signature_validity_period(vp) - } - /// Sets the value of the Exportable Certification subpacket, /// which contains whether the certification should be exported /// (i.e., whether the packet is *not* a local signature). |