From 33dfdc57f5f785c3c28320bf45b3b267eec3a85a Mon Sep 17 00:00:00 2001 From: "Neal H. Walfield" Date: Fri, 19 Jun 2020 14:46:06 +0200 Subject: openpgp: Change how SignatureBuilder emits the sig's creation time. - Currently, `SignatureBuilder` sets the `Signature Creation Time` subpacket when it is instantiated, or uses any existing `Signature Creation Time` when it is converted using `From`. - This can be problematic: usually, we want the current time. - Change the behavior to emit a `Signature Creation Time` subpakcet when the signature is generated, unless this behavior is explicitly overridden. --- openpgp/src/cert/builder.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'openpgp/src/cert/builder.rs') diff --git a/openpgp/src/cert/builder.rs b/openpgp/src/cert/builder.rs index 4243cb2f..23c84792 100644 --- a/openpgp/src/cert/builder.rs +++ b/openpgp/src/cert/builder.rs @@ -923,7 +923,7 @@ impl CertBuilder { self.primary.flags = self.primary.flags.set_certification(true); } - // Generate & and self-sign primary key. + // Generate & self-sign primary key. let (primary, sig) = self.primary_key(creation_time)?; let mut signer = primary.clone().into_keypair().unwrap(); @@ -936,7 +936,8 @@ impl CertBuilder { })); packets.push(sig.clone().into()); - let sig = signature::SignatureBuilder::from(sig.clone()); + let sig = signature::SignatureBuilder::from(sig.clone()) + .set_signature_creation_time(creation_time)?; // Remove subpackets that needn't be copied into the binding // signatures. -- cgit v1.2.3