1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-11-23 04:42:06 +01:00

Fix getExpirationDate method for keys without expiration

This commit is contained in:
Paul Schaub 2020-11-22 21:07:14 +01:00
parent 5ee17fac69
commit c266adb5a5
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311

View file

@ -210,12 +210,15 @@ public class KeyRingInfo {
} }
/** /**
* Return the date of expiration of the primary key. * Return the date of expiration of the primary key or null if the key has no expiration date.
* *
* @return expiration date * @return expiration date
*/ */
public Date getExpirationDate() { public Date getExpirationDate() {
long validSeconds = getPublicKey().getValidSeconds(); long validSeconds = getPublicKey().getValidSeconds();
if (validSeconds == 0) {
return null;
}
return new Date(getCreationDate().getTime() + (1000 * validSeconds)); return new Date(getCreationDate().getTime() + (1000 * validSeconds));
} }