perwendel / spark

A simple expressive web framework for java. Spark has a kotlin DSL https://github.com/perwendel/spark-kotlin
Apache License 2.0
9.64k stars 1.56k forks source link

Use conscrypt SSL provider #1067

Open mojo2012 opened 5 years ago

mojo2012 commented 5 years ago

Hi,

I just enabled SSL and was bummed how slow it is. After some googling I found conscrypt which improves the speed drastically. It can be used with jetty very easily. Just add

Security.addProvider(new OpenSSLProvider());
sslContextFactory.setProvider("Conscrypt");

Unfortunately there is no way to execute the second line.

It would be awesome to have an option on the secure() method, to also pass a provider name!

toyg commented 5 years ago

You can customize sslContextFactory by providing your own Jetty factory. Have a look here: https://github.com/toyg/spark-custom-jetty. I know it's not ideal, but it works.

To be honest, I don't think Spark should bend its API too much to expose interfaces that are very much Jetty-specific. The way forward is probably to have an EmbeddedJettyServer that is a bit more accessible, which is where this particular option could be set.