1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-12-22 19:08:00 +01:00

SecretKeyRingEditor: referenceTime cannot be null anymore

This commit is contained in:
Paul Schaub 2023-05-03 17:14:18 +02:00
parent 21ae48d8c1
commit 09bacd40d1
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311

View file

@ -124,9 +124,7 @@ public class SecretKeyRingEditor implements SecretKeyRingEditorInterface {
} }
SelfSignatureBuilder builder = new SelfSignatureBuilder(primaryKey, protector); SelfSignatureBuilder builder = new SelfSignatureBuilder(primaryKey, protector);
if (referenceTime != null) {
builder.getHashedSubpackets().setSignatureCreationTime(referenceTime); builder.getHashedSubpackets().setSignatureCreationTime(referenceTime);
}
builder.setSignatureType(SignatureType.POSITIVE_CERTIFICATION); builder.setSignatureType(SignatureType.POSITIVE_CERTIFICATION);
// Retain signature subpackets of previous signatures // Retain signature subpackets of previous signatures
@ -351,16 +349,12 @@ public class SecretKeyRingEditor implements SecretKeyRingEditorInterface {
.getV4FingerprintCalculator(), false, subkeyProtector.getEncryptor(subkey.getKeyID())); .getV4FingerprintCalculator(), false, subkeyProtector.getEncryptor(subkey.getKeyID()));
SubkeyBindingSignatureBuilder skBindingBuilder = new SubkeyBindingSignatureBuilder(primaryKey, primaryKeyProtector, hashAlgorithm); SubkeyBindingSignatureBuilder skBindingBuilder = new SubkeyBindingSignatureBuilder(primaryKey, primaryKeyProtector, hashAlgorithm);
if (referenceTime != null) {
skBindingBuilder.getHashedSubpackets().setSignatureCreationTime(referenceTime); skBindingBuilder.getHashedSubpackets().setSignatureCreationTime(referenceTime);
}
skBindingBuilder.getHashedSubpackets().setKeyFlags(flags); skBindingBuilder.getHashedSubpackets().setKeyFlags(flags);
if (subkeyAlgorithm.isSigningCapable()) { if (subkeyAlgorithm.isSigningCapable()) {
PrimaryKeyBindingSignatureBuilder pkBindingBuilder = new PrimaryKeyBindingSignatureBuilder(secretSubkey, subkeyProtector, hashAlgorithm); PrimaryKeyBindingSignatureBuilder pkBindingBuilder = new PrimaryKeyBindingSignatureBuilder(secretSubkey, subkeyProtector, hashAlgorithm);
if (referenceTime != null) {
pkBindingBuilder.getHashedSubpackets().setSignatureCreationTime(referenceTime); pkBindingBuilder.getHashedSubpackets().setSignatureCreationTime(referenceTime);
}
PGPSignature pkBinding = pkBindingBuilder.build(primaryKey.getPublicKey()); PGPSignature pkBinding = pkBindingBuilder.build(primaryKey.getPublicKey());
skBindingBuilder.getHashedSubpackets().addEmbeddedSignature(pkBinding); skBindingBuilder.getHashedSubpackets().addEmbeddedSignature(pkBinding);
} }