Skip to main content
Jump to: navigation, search

Jetty/Reference/SSL Connectors


There are 2 ssl connectors in jetty -- SslSocketConnector and the SslSelectChannelConnector. The SslSocketConnector is built on top of the Jetty SocketConnector which is Jetty's implementation of a blocking connector. It makes use of java's SslSocket to add the security layer. On the other hand, SslSelectChannelConnector is an extension of Jetty's SelectChannelConnector which makes use of non-blocking IO. For its security layer, it uses java nio SslEngine. Both Connectors can be configured in the same way. Only difference is in the implementation.


Starting in Jetty 7.3.1, the preferred way to configure the SSL parameters for the connector is by configuring the SslContextFactory object and passing it to the connector's constructor.

The following is an example of an SslSelectChannelConnector configuration. An SslSocketConnector may be configured the same way -- just change the value of class to "org.eclipse.jetty.server.ssl.SslSocketConnector".

  <Call name="addConnector">
      <New class="org.eclipse.jetty.server.ssl.SslSelectChannelConnector">
          <New class="org.eclipse.jetty.http.ssl.SslContextFactory">
            <Set name="port">8443</Set>
            <Set name="keyStore"><SystemProperty name="jetty.home" default="." />/etc/keystore</Set>
            <Set name="keyStorePassword">OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4</Set>
            <Set name="keyManagerPassword">OBF:1u2u1wml1z7s1z7a1wnl1u2g</Set>
            <Set name="trustStore"><SystemProperty name="jetty.home" default="." />/etc/keystore</Set>
            <Set name="trustStorePassword">OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4</Set>
        <Set name="maxIdleTime">30000</Set>

Other properties which can be set for SslContextFactory are:

  • certAlias - alias of certificate to use
  • keyStoreType - default value: "JKS"
  • keyStoreProvider - defaults to the SunJSSE provider
  • trustStoreType - default value: "JKS"
  • trustStoreProvider - defaults to the SunJSSE provider
  • sslKeyManagerFactoryAlgorithm - set to the value of the "ssl.KeyManagerFactory.algorithm" system property. If there is no such property, this defaults to "SunX509"
  • sslTrustManagerFactoryAlgorithm - set to the value of the "ssl.TrustManagerFactory.algorithm" system property. If there is no such property, this defaults to "SunX509"
  • secureRandomAlgorithm - default value is null
  • protocol - default value is "TLS"
  • provider - defaults to the first provider that supports protocol
  • includeCipherSuites - see How to configure SSL Cipher Suites page.
  • excludeCipherSuites - see How to configure SSL Cipher Suites page.
  • needClientAuth - defaults to false
  • wantClientAuth - defaults to false
  • validateCerts - defaults to false
  • allowRenegotiate - defaults to false
  • crlPath - path to certificate revocation list file for SSL certificate validation
  • maxCertPathLengh - maximum allowed number of intermediate certificates, defaults to -1 (unlimited)

If there is no value for the "truststore", it will use the "keystore" value. Passwords can be obfuscated by using Jetty password utility.

Deprecated methods

The methods of SslConnector that previously were being used to configure SSL parameters have been deprecated and will be removed in a future version of Jetty. Following is an example of configuring SslSelectChannelConnector connector in Jetty 7.3.0 and earlier.

  <Call name="addConnector">
      <New class="org.eclipse.jetty.server.ssl.SslSelectChannelConnector">
        <Set name="Port">8443</Set>
        <Set name="maxIdleTime">30000</Set>
        <Set name="keystore"><SystemProperty name="jetty.home" default="." />/etc/keystore</Set>
        <Set name="password">OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4</Set>
        <Set name="keyPassword">OBF:1u2u1wml1z7s1z7a1wnl1u2g</Set>
        <Set name="truststore"><SystemProperty name="jetty.home" default="." />/etc/keystore</Set>
        <Set name="trustPassword">OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4</Set>

Additional Resources

Back to the top