Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » jetty websocket certificate validation
jetty websocket certificate validation [message #1781270] Mon, 05 February 2018 11:20 Go to next message
venky m is currently offline venky mFriend
Messages: 2
Registered: February 2018
Junior Member
We have a websocket application where server code is deployed in Tomcat and client is in Jetty.

The issue we have is when a certificate is expired on Server, client is still connecting to server and communicating without any issues, we want to validate the server certificate expiry and stop the client from connecting to it.Can you please find the below code snippets and dependencies and guide us to achieve this?

Currently we have the following code snippet to establish Connection in Client:

private Future<Session> establishwebsocketConnection(String destinationURI)
throws Exception, URISyntaxException, IOException, InterruptedException {
SslContextFactory sslContextFactory = createSSLContextFactory();
if (websocketClient == null) {
websocketClient = new websocketClient(sslContextFactory);
websocketClient.setMaxIdleTimeout(99999999);
this.socket = new CustomMessageSocket();
websocketClient.start();

}
String agentId = "1234";
URI URI = new URI(destinationURI + "/" + agentId);
ClientUpgradeRequest request = new ClientUpgradeRequest();
Future<Session> objSession = websocketClient.connect(socket, URI, request);
websocketClient.getConnectionManager().
return objSession;
}

private SslContextFactory createSSLContextFactory() throws Exception {

SslContextFactory sslContextFactory = new SslContextFactory();
sslContextFactory.setKeyStorePath("/home/venkat/Downloads/downloadGIhXV063058/rna-keystore.p12");
// sslContextFactory.setCertAlias("rna-cert");
sslContextFactory.setKeyStorePassword("sample@123");
sslContextFactory.setTrustStorePath("/usr/lib/jvm/java-8-oracle/jre/lib/security/cacerts");
sslContextFactory.setTrustStorePassword("changeit");
// sslContextFactory.setWantClientAuth(true);
return sslContextFactory;
}

We are using following dependency in websocket client to communicate with Server,
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-client</artifactId>
<version>9.2.15.v20160210</version>
</dependency>
Re: jetty websocket certificate validation [message #1781283 is a reply to message #1781270] Mon, 05 February 2018 13:40 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
This isn't a JDT question. Try the user mailing list referenced by https://www.eclipse.org/jetty/mailinglists.html

Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Project cannot find resources in another project at runtime
Next Topic:swt hello world tutorial
Goto Forum:
  


Current Time: Sat Apr 27 04:45:32 GMT 2024

Powered by FUDForum. Page generated in 0.02940 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top