Commit 72b64cf4 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Fixed NPE when handling certs with no chain. JM-940

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@6740 b35dd754-fafc-0310-a699-88a17e54d16e
parent a4187ccb
...@@ -271,7 +271,8 @@ ...@@ -271,7 +271,8 @@
// Self-signed certs are certs generated by Wildfire whose IssueDN equals SubjectDN // Self-signed certs are certs generated by Wildfire whose IssueDN equals SubjectDN
boolean isSelfSigned = c.getSubjectDN().equals(c.getIssuerDN()); boolean isSelfSigned = c.getSubjectDN().equals(c.getIssuerDN());
// Signing Request pending = not self signed certs whose chain has only 1 cert (the same cert) // Signing Request pending = not self signed certs whose chain has only 1 cert (the same cert)
boolean isSigningPending = !isSelfSigned && keyStore.getCertificateChain(a).length == 1; java.security.cert.Certificate[] certificateChain = keyStore.getCertificateChain(a);
boolean isSigningPending = !isSelfSigned && (certificateChain == null || certificateChain.length == 1);
offerUpdateIssuer = offerUpdateIssuer || isSelfSigned || isSigningPending; offerUpdateIssuer = offerUpdateIssuer || isSelfSigned || isSigningPending;
if (isSigningPending) { if (isSigningPending) {
......
...@@ -69,12 +69,15 @@ ...@@ -69,12 +69,15 @@
// Self-signed certs are certs generated by Wildfire whose IssueDN equals SubjectDN // Self-signed certs are certs generated by Wildfire whose IssueDN equals SubjectDN
boolean isSelfSigned = certificate.getSubjectDN().equals(certificate.getIssuerDN()); boolean isSelfSigned = certificate.getSubjectDN().equals(certificate.getIssuerDN());
// Signing Request pending = not self signed certs whose chain has only 1 cert (the same cert) // Signing Request pending = not self signed certs whose chain has only 1 cert (the same cert)
boolean isSigningPending = !isSelfSigned && keyStore.getCertificateChain(alias).length == 1; java.security.cert.Certificate[] certificateChain = keyStore.getCertificateChain(alias);
boolean isSigningPending = !isSelfSigned && (certificateChain == null || certificateChain.length == 1);
if (isSelfSigned || isSigningPending) { if (isSelfSigned || isSigningPending) {
if (CertificateManager.isDSACertificate(certificate)) { if (CertificateManager.isDSACertificate(certificate)) {
CertificateManager.createDSACert(keyStore, SSLConfig.getKeyPassword(), alias, issuerDN.toString(), "cn=" + domain, "*." + domain); CertificateManager.createDSACert(keyStore, SSLConfig.getKeyPassword(), alias,
issuerDN.toString(), "cn=" + domain, "*." + domain);
} else { } else {
CertificateManager.createRSACert(keyStore, SSLConfig.getKeyPassword(), alias, issuerDN.toString(), "cn=" + domain, "*." + domain); CertificateManager.createRSACert(keyStore, SSLConfig.getKeyPassword(), alias,
issuerDN.toString(), "cn=" + domain, "*." + domain);
} }
} }
} }
......
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