Specific exceptions for 0 active prot/suite
@@ -456,7 +456,7 @@ ProvSSLParameters getDefaultParameters(boolean isClient)
String[] enabledCipherSuites = sslParameters.getCipherSuitesArray();
BCAlgorithmConstraints algorithmConstraints = sslParameters.getAlgorithmConstraints();
- int[] result = new int[enabledCipherSuites.length];
+ int[] candidates = new int[enabledCipherSuites.length];
int count = 0;
for (String enabledCipherSuite : enabledCipherSuites)
@@ -477,10 +477,18 @@ ProvSSLParameters getDefaultParameters(boolean isClient)
* there must be at least one suitable NamedGroup available.
*/
- result[count++] = candidate.getCipherSuite();
+ candidates[count++] = candidate.getCipherSuite();
}
- return TlsUtils.getSupportedCipherSuites(crypto, result, count);
+ int[] result = TlsUtils.getSupportedCipherSuites(crypto, candidates, count);
+
+ if (result.length < 1)
+ {
+ // TODO[jsse] Refactor so that this can be an SSLHandshakeException?
+ throw new IllegalStateException("No usable cipher suites enabled");
+ }
+
+ return result;
}
ProtocolVersion[] getActiveProtocolVersions(ProvSSLParameters sslParameters)
@@ -516,6 +524,12 @@ public int compare(ProtocolVersion o1, ProtocolVersion o2)
result.add(candidate);
}
+ if (result.isEmpty())
+ {
+ // TODO[jsse] Refactor so that this can be an SSLHandshakeException?
+ throw new IllegalStateException("No usable protocols enabled");
+ }
+
return result.toArray(new ProtocolVersion[result.size()]);
}
