S
S
Soslan Aldatov2013-12-05 07:46:17
Java
Soslan Aldatov, 2013-12-05 07:46:17

Setting up SSL in Jetty?

Good afternoon!

My problem is this: I can't get the certificate I bought from Register.com to work with Jetty Server.
The configuration was carried out according to the official instructions , the addition of certificates was carried out in accordance with how-to from Register.com .
As a result, when trying to open a page via HTTPS, we get the error sec_error_ca_cert_invalid ("The certificate is not trusted, since it is self-signed"). Just in case, root certificates were added to cacerts as well - it didn't change anything.
The error is excluded - the actions described in the docks were performed many times, I had to start from scratch 20 times.
Everything is in order with the certificate itself - it worked perfectly on Apache.

If anyone has any ideas about what I might be missing, I'd be very grateful.
Thank you for your attention.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
ybotok, 2015-08-08
@ybotok

In order not to write a lot, I will answer right away with the code, how it is used on my project

Logger.logMessage("Using SSL (https) for the API server");
                HttpConfiguration https_config = new HttpConfiguration();
                https_config.setSecureScheme("https");
                https_config.setSecurePort(port);
                https_config.addCustomizer(new SecureRequestCustomizer());
                SslContextFactory sslContextFactory = new SslContextFactory();
                sslContextFactory.setKeyStorePath(Nxt.getStringProperty("keystore"));
                sslContextFactory.setKeyStorePassword(Nxt.getStringProperty("password"));
                sslContextFactory.setExcludeCipherSuites("SSL_RSA_WITH_DES_CBC_SHA", "SSL_DHE_RSA_WITH_DES_CBC_SHA",
                        "SSL_DHE_DSS_WITH_DES_CBC_SHA", "SSL_RSA_EXPORT_WITH_RC4_40_MD5", "SSL_RSA_EXPORT_WITH_DES40_CBC_SHA",
                        "SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA", "SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA");
                connector = new ServerConnector(apiServer, new SslConnectionFactory(sslContextFactory, "http/1.1"),
                        new HttpConnectionFactory(https_config));

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question