mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-23 17:22:16 -05:00
create keys with fixed timestamp
This commit is contained in:
parent
724726a4fd
commit
62e65a8240
@ -156,7 +156,7 @@ public class PgpKeyOperation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Creates new secret key. */
|
/** Creates new secret key. */
|
||||||
private PGPKeyPair createKey(SubkeyAdd add, OperationLog log, int indent) {
|
private PGPKeyPair createKey(SubkeyAdd add, Date creationTime, OperationLog log, int indent) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Some safety checks
|
// Some safety checks
|
||||||
@ -254,7 +254,7 @@ public class PgpKeyOperation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// build new key pair
|
// build new key pair
|
||||||
return new JcaPGPKeyPair(algorithm, keyGen.generateKeyPair(), new Date());
|
return new JcaPGPKeyPair(algorithm, keyGen.generateKeyPair(), creationTime);
|
||||||
|
|
||||||
} catch(NoSuchProviderException | InvalidAlgorithmParameterException e) {
|
} catch(NoSuchProviderException | InvalidAlgorithmParameterException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
@ -300,8 +300,10 @@ public class PgpKeyOperation {
|
|||||||
return new PgpEditKeyResult(PgpEditKeyResult.RESULT_ERROR, log, null);
|
return new PgpEditKeyResult(PgpEditKeyResult.RESULT_ERROR, log, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Date creationTime = new Date();
|
||||||
|
|
||||||
subProgressPush(10, 30);
|
subProgressPush(10, 30);
|
||||||
PGPKeyPair keyPair = createKey(add, log, indent);
|
PGPKeyPair keyPair = createKey(add, creationTime, log, indent);
|
||||||
subProgressPop();
|
subProgressPop();
|
||||||
|
|
||||||
// return null if this failed (an error will already have been logged by createKey)
|
// return null if this failed (an error will already have been logged by createKey)
|
||||||
@ -328,7 +330,7 @@ public class PgpKeyOperation {
|
|||||||
masterSecretKey.getEncoded(), new JcaKeyFingerprintCalculator());
|
masterSecretKey.getEncoded(), new JcaKeyFingerprintCalculator());
|
||||||
|
|
||||||
subProgressPush(50, 100);
|
subProgressPush(50, 100);
|
||||||
CryptoInputParcel cryptoInput = new CryptoInputParcel(new Date(), new Passphrase(""));
|
CryptoInputParcel cryptoInput = new CryptoInputParcel(creationTime, new Passphrase(""));
|
||||||
return internal(sKR, masterSecretKey, add.mFlags, add.mExpiry, cryptoInput, saveParcel, log, indent);
|
return internal(sKR, masterSecretKey, add.mFlags, add.mExpiry, cryptoInput, saveParcel, log, indent);
|
||||||
|
|
||||||
} catch (PGPException e) {
|
} catch (PGPException e) {
|
||||||
@ -976,7 +978,7 @@ public class PgpKeyOperation {
|
|||||||
(i-1) * (100 / saveParcel.mAddSubKeys.size()),
|
(i-1) * (100 / saveParcel.mAddSubKeys.size()),
|
||||||
i * (100 / saveParcel.mAddSubKeys.size())
|
i * (100 / saveParcel.mAddSubKeys.size())
|
||||||
);
|
);
|
||||||
PGPKeyPair keyPair = createKey(add, log, indent);
|
PGPKeyPair keyPair = createKey(add, cryptoInput.getSignatureTime(), log, indent);
|
||||||
subProgressPop();
|
subProgressPop();
|
||||||
if (keyPair == null) {
|
if (keyPair == null) {
|
||||||
log.add(LogType.MSG_MF_ERROR_PGP, indent +1);
|
log.add(LogType.MSG_MF_ERROR_PGP, indent +1);
|
||||||
|
Loading…
Reference in New Issue
Block a user