Throw exception if KeyManagerFactory is used with OpenSslServerContext
Motivation: We currently not supported using KeyManagerFactory with OpenSslServerContext and so should throw an exception if the user tries to do so. This will at least not give suprising and hard to debug problems later. Modifications: Throw exception if a user tries to construct a OpenSslServerContext with a KeyManagerFactory Result: Fail fast if the user tries to use something that is not supported.
This commit is contained in:
parent
0d62d4cce1
commit
57862b5771
@ -321,6 +321,7 @@ public final class OpenSslServerContext extends OpenSslContext {
|
|||||||
ClientAuth.NONE);
|
ClientAuth.NONE);
|
||||||
OpenSsl.ensureAvailability();
|
OpenSsl.ensureAvailability();
|
||||||
|
|
||||||
|
checkKeyManagerFactory(keyManagerFactory);
|
||||||
checkNotNull(keyCertChainFile, "keyCertChainFile");
|
checkNotNull(keyCertChainFile, "keyCertChainFile");
|
||||||
if (!keyCertChainFile.isFile()) {
|
if (!keyCertChainFile.isFile()) {
|
||||||
throw new IllegalArgumentException("keyCertChainFile is not a file: " + keyCertChainFile);
|
throw new IllegalArgumentException("keyCertChainFile is not a file: " + keyCertChainFile);
|
||||||
@ -420,6 +421,7 @@ public final class OpenSslServerContext extends OpenSslContext {
|
|||||||
clientAuth);
|
clientAuth);
|
||||||
OpenSsl.ensureAvailability();
|
OpenSsl.ensureAvailability();
|
||||||
|
|
||||||
|
checkKeyManagerFactory(keyManagerFactory);
|
||||||
checkNotNull(keyCertChain, "keyCertChainFile");
|
checkNotNull(keyCertChain, "keyCertChainFile");
|
||||||
checkNotNull(key, "keyFile");
|
checkNotNull(key, "keyFile");
|
||||||
|
|
||||||
@ -528,4 +530,11 @@ public final class OpenSslServerContext extends OpenSslContext {
|
|||||||
public OpenSslServerSessionContext sessionContext() {
|
public OpenSslServerSessionContext sessionContext() {
|
||||||
return sessionContext;
|
return sessionContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void checkKeyManagerFactory(KeyManagerFactory keyManagerFactory) {
|
||||||
|
if (keyManagerFactory != null) {
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
"KeyManagerFactory is currently not supported with OpenSslServerContext");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user