Skip to content

Commit

Permalink
Bridge certificate: set end date to start date if PGP key doesn't expire
Browse files Browse the repository at this point in the history
This will of course need to be checked server-side because it's not a
standard way of using expiration information.

Signed-off-by: Daniele Ricci <[email protected]>
  • Loading branch information
daniele-athome committed Jul 8, 2014
1 parent 3acccd9 commit ba1c1ed
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/org/kontalk/crypto/X509Bridge.java
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public static X509Certificate createCertificate(PGPPublicKeyRing publicKeyRing,
* (defaults to current date and time if null)
* @param endDate
* date until which the certificate will be valid
* (defaults to current date and time if null) *
* (defaults to start date and time if null)
* @param subjAltNameURI
* URI to be placed in subjectAltName
* @return self-signed certificate
Expand Down Expand Up @@ -242,8 +242,7 @@ private static X509Certificate createCertificate(PublicKey pubKey,
}
certGenerator.setNotBefore(startDate);
if (endDate == null) {
endDate = new Date(startDate.getTime()+(365L*24L*60L*60L*1000L));
System.out.println("end date is="+ DateFormat.getDateInstance().format(endDate));
endDate = startDate;
}

certGenerator.setNotAfter(endDate);
Expand Down

0 comments on commit ba1c1ed

Please sign in to comment.