1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2025-09-14 20:59:39 +02:00

Introduce and use DateUtil.toSecondsPrecision

This commit is contained in:
Paul Schaub 2021-12-28 01:35:12 +01:00
parent 2f44621657
commit f3b7286eaf
3 changed files with 12 additions and 2 deletions

View file

@ -157,7 +157,7 @@ public class ChangeExpirationOnKeyWithDifferentSignatureTypesTest {
throws PGPException {
Date expirationDate = new Date(new Date().getTime() + 1000 * 60 * 60 * 24 * 14);
// round date for test stability
expirationDate = DateUtil.parseUTCDate(DateUtil.formatUTCDate(expirationDate));
expirationDate = DateUtil.toSecondsPrecision(expirationDate);
PGPSecretKeyRing modded = PGPainless.modifyKeyRing(keys)
.setExpirationDate(expirationDate, protector)

View file

@ -100,7 +100,7 @@ public class RevokeKeyWithoutPreferredAlgorithmsOnPrimaryKey {
@ExtendWith(TestAllImplementations.class)
public void testChangingExpirationTimeWithKeyWithoutPrefAlgos()
throws IOException, PGPException {
Date expirationDate = DateUtil.parseUTCDate(DateUtil.formatUTCDate(new Date()));
Date expirationDate = DateUtil.toSecondsPrecision(new Date());
PGPSecretKeyRing secretKeys = PGPainless.readKeyRing().secretKeyRing(KEY);
SecretKeyRingProtector protector = new UnprotectedKeysProtector();