Tests pass with Dummy SSL config!
This commit is contained in:
parent
3cfe434337
commit
f0bbadce84
2 changed files with 7 additions and 5 deletions
|
|
@ -251,6 +251,7 @@ class RemoteClientPipelineFactory(name: String,
|
||||||
client: RemoteClient) extends ChannelPipelineFactory {
|
client: RemoteClient) extends ChannelPipelineFactory {
|
||||||
def getPipeline: ChannelPipeline = {
|
def getPipeline: ChannelPipeline = {
|
||||||
val engine = RemoteServerSslContext.client.createSSLEngine()
|
val engine = RemoteServerSslContext.client.createSSLEngine()
|
||||||
|
engine.setEnabledCipherSuites(engine.getSupportedCipherSuites) //TODO is this sensible?
|
||||||
engine.setUseClientMode(true)
|
engine.setUseClientMode(true)
|
||||||
|
|
||||||
val ssl = new SslHandler(engine)
|
val ssl = new SslHandler(engine)
|
||||||
|
|
|
||||||
|
|
@ -289,19 +289,19 @@ object RemoteServerSslContext {
|
||||||
val protocol = "TLS"
|
val protocol = "TLS"
|
||||||
val algorithm = Option(Security.getProperty("ssl.KeyManagerFactory.algorithm")).getOrElse("SunX509")
|
val algorithm = Option(Security.getProperty("ssl.KeyManagerFactory.algorithm")).getOrElse("SunX509")
|
||||||
val store = KeyStore.getInstance("JKS")
|
val store = KeyStore.getInstance("JKS")
|
||||||
store.load(getClass.getResourceAsStream("keystore"),"keystorepassword".toCharArray)
|
store.load(DummyKeyStore.asInputStream,DummyKeyStore.getKeyStorePassword) //TODO replace with getResourceAsStream + config-pass
|
||||||
|
|
||||||
val keyMan = KeyManagerFactory.getInstance(algorithm)
|
val keyMan = KeyManagerFactory.getInstance(algorithm)
|
||||||
keyMan.init(store, "certificatepassword".toCharArray)
|
keyMan.init(store, DummyKeyStore.getCertificatePassword) //TODO replace with config-pass
|
||||||
|
|
||||||
val trustMan = TrustManagerFactory.getInstance("SunX509");
|
//val trustMan = TrustManagerFactory.getInstance("SunX509");
|
||||||
trustMan.init(store) //TODO safe to use same keystore? Or should use it's own keystore?
|
//trustMan.init(store) //TODO safe to use same keystore? Or should use it's own keystore?
|
||||||
|
|
||||||
val s = SSLContext.getInstance(protocol)
|
val s = SSLContext.getInstance(protocol)
|
||||||
s.init(keyMan.getKeyManagers, null, null)
|
s.init(keyMan.getKeyManagers, null, null)
|
||||||
|
|
||||||
val c = SSLContext.getInstance(protocol)
|
val c = SSLContext.getInstance(protocol)
|
||||||
c.init(null, trustMan.getTrustManagers, null)
|
c.init(null, DummyTrustManagerFactory.getTrustManagers, null) //TODO replace with TrustManagerFactory
|
||||||
|
|
||||||
(c,s)
|
(c,s)
|
||||||
}
|
}
|
||||||
|
|
@ -320,6 +320,7 @@ class RemoteServerPipelineFactory(
|
||||||
|
|
||||||
def getPipeline: ChannelPipeline = {
|
def getPipeline: ChannelPipeline = {
|
||||||
val engine = RemoteServerSslContext.server.createSSLEngine()
|
val engine = RemoteServerSslContext.server.createSSLEngine()
|
||||||
|
engine.setEnabledCipherSuites(engine.getSupportedCipherSuites) //TODO is this sensible?
|
||||||
engine.setUseClientMode(false)
|
engine.setUseClientMode(false)
|
||||||
|
|
||||||
val ssl = new SslHandler(engine)
|
val ssl = new SslHandler(engine)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue