Commit a1e4c1df authored by André Berenguel's avatar André Berenguel Committed by Guus der Kinderen

Self-Signed Certificate creation with validity in days

IdentityStore.addSelfSignedDomainCertificate considers the certificate
validity in days, not in months.
parent cbfe7e43
...@@ -971,7 +971,7 @@ public class CertificateManager { ...@@ -971,7 +971,7 @@ public class CertificateManager {
* Creates an X509 version3 certificate. * Creates an X509 version3 certificate.
* *
* @param kp KeyPair that keeps the public and private keys for the new certificate. * @param kp KeyPair that keeps the public and private keys for the new certificate.
* @param months time to live * @param days time to live
* @param issuerDN Issuer string e.g "O=Grid,OU=OGSA,CN=ACME" * @param issuerDN Issuer string e.g "O=Grid,OU=OGSA,CN=ACME"
* @param subjectDN Subject string e.g "O=Grid,OU=OGSA,CN=John Doe" * @param subjectDN Subject string e.g "O=Grid,OU=OGSA,CN=John Doe"
* @param domain Domain of the server. * @param domain Domain of the server.
...@@ -980,7 +980,7 @@ public class CertificateManager { ...@@ -980,7 +980,7 @@ public class CertificateManager {
* @throws GeneralSecurityException * @throws GeneralSecurityException
* @throws IOException * @throws IOException
*/ */
public static synchronized X509Certificate createX509V3Certificate(KeyPair kp, int months, String issuerDN, public static synchronized X509Certificate createX509V3Certificate(KeyPair kp, int days, String issuerDN,
String subjectDN, String domain, String subjectDN, String domain,
String signAlgoritm) String signAlgoritm)
throws GeneralSecurityException, IOException { throws GeneralSecurityException, IOException {
...@@ -1000,7 +1000,7 @@ public class CertificateManager { ...@@ -1000,7 +1000,7 @@ public class CertificateManager {
certGenerator.setIssuerDN(new X509Name(issuerDN)); certGenerator.setIssuerDN(new X509Name(issuerDN));
certGenerator.setNotBefore(new Date(System.currentTimeMillis())); certGenerator.setNotBefore(new Date(System.currentTimeMillis()));
certGenerator.setNotAfter( certGenerator.setNotAfter(
new Date(System.currentTimeMillis() + months * (1000L * 60 * 60 * 24 * 30))); new Date(System.currentTimeMillis() + days * (1000L * 60 * 60 * 24)));
certGenerator.setSubjectDN(new X509Name(subjectDN)); certGenerator.setSubjectDN(new X509Name(subjectDN));
certGenerator.setPublicKey(pubKey); certGenerator.setPublicKey(pubKey);
certGenerator.setSignatureAlgorithm(signAlgoritm); certGenerator.setSignatureAlgorithm(signAlgoritm);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment