mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-12-22 19:08:00 +01:00
Allow null as keyExpirationTime (no expiry)
This commit is contained in:
parent
4d1d8083d3
commit
2c271178cd
2 changed files with 11 additions and 7 deletions
|
@ -46,11 +46,11 @@ public interface SelfSignatureSubpackets extends BaseSignatureSubpackets {
|
|||
|
||||
SelfSignatureSubpackets setPrimaryUserId(@Nullable PrimaryUserID primaryUserId);
|
||||
|
||||
SelfSignatureSubpackets setKeyExpirationTime(@Nonnull PGPPublicKey key, @Nonnull Date keyExpirationTime);
|
||||
SelfSignatureSubpackets setKeyExpirationTime(@Nonnull PGPPublicKey key, @Nullable Date keyExpirationTime);
|
||||
|
||||
SelfSignatureSubpackets setKeyExpirationTime(@Nonnull Date keyCreationTime, @Nonnull Date keyExpirationTime);
|
||||
SelfSignatureSubpackets setKeyExpirationTime(@Nonnull Date keyCreationTime, @Nullable Date keyExpirationTime);
|
||||
|
||||
SelfSignatureSubpackets setKeyExpirationTime(boolean isCritical, @Nonnull Date keyCreationTime, @Nonnull Date keyExpirationTime);
|
||||
SelfSignatureSubpackets setKeyExpirationTime(boolean isCritical, @Nonnull Date keyCreationTime, @Nullable Date keyExpirationTime);
|
||||
|
||||
SelfSignatureSubpackets setKeyExpirationTime(boolean isCritical, long secondsFromCreationToExpiration);
|
||||
|
||||
|
|
|
@ -271,18 +271,22 @@ public class SignatureSubpackets
|
|||
}
|
||||
|
||||
@Override
|
||||
public SignatureSubpackets setKeyExpirationTime(@Nonnull PGPPublicKey key, @Nonnull Date keyExpirationTime) {
|
||||
public SignatureSubpackets setKeyExpirationTime(@Nonnull PGPPublicKey key, @Nullable Date keyExpirationTime) {
|
||||
return setKeyExpirationTime(key.getCreationTime(), keyExpirationTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SignatureSubpackets setKeyExpirationTime(@Nonnull Date keyCreationTime, @Nonnull Date keyExpirationTime) {
|
||||
public SignatureSubpackets setKeyExpirationTime(@Nonnull Date keyCreationTime, @Nullable Date keyExpirationTime) {
|
||||
return setKeyExpirationTime(true, keyCreationTime, keyExpirationTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SignatureSubpackets setKeyExpirationTime(boolean isCritical, @Nonnull Date keyCreationTime, @Nonnull Date keyExpirationTime) {
|
||||
return setKeyExpirationTime(isCritical, (keyExpirationTime.getTime() / 1000) - (keyCreationTime.getTime() / 1000));
|
||||
public SignatureSubpackets setKeyExpirationTime(boolean isCritical, @Nonnull Date keyCreationTime, @Nullable Date keyExpirationTime) {
|
||||
if (keyExpirationTime != null) {
|
||||
return setKeyExpirationTime(isCritical, (keyExpirationTime.getTime() / 1000) - (keyCreationTime.getTime() / 1000));
|
||||
} else {
|
||||
return setKeyExpirationTime(isCritical, 0L);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue