Does Jedis supports SSL client certificate authentication?

2,383 views
Skip to first unread message

e.s

unread,
May 28, 2017, 7:10:41 AM5/28/17
to Jedis
Hi,

trying to connect to redis labs resource using SSL and client certificate (this is how they work).
I created the required JKS keystore file - without success. I get the "handshake failed" error.

I suspect that Jedis not supports SSL using client certificate.




eran.s...@redislabs.com

unread,
May 28, 2017, 6:08:48 PM5/28/17
to Jedis
Jedis supports SSL with client certificate authentication.

Example on how to use it to connect to redis labs SSL enabled resource, with client certificate authentication:

import java.io.File;
import java.net.URI;

import redis.clients.jedis.Jedis;

public class testJedisSSL {

public static void main(String[] args) {
int port = 1234;
String password = "123456";
String trustStoreFilePath = "C:\\Users\\Demo\\Downloads\\Credentials\\keystore.jks";
String trustStoreType = "jks";
String trustStorePassword = "changeit";
String keyStoreFilePath = "C:\\Users\\Demo\\Downloads\\Credentials\\JedisSSL.p12";
String keyStoreType = "PKCS12";
String keyStorePassword = "changeit";
if(!new File(trustStoreFilePath).exists()) {
String.format("Could not find trust store at '%s'.", trustStoreFilePath);
return;
}
System.setProperty("javax.net.ssl.trustStore", trustStoreFilePath);
   System.setProperty("javax.net.ssl.trustStoreType", trustStoreType);
   System.setProperty("javax.net.ssl.trustStorePassword", trustStorePassword);
   
   
   System.setProperty("javax.net.ssl.keyStore", keyStoreFilePath);
   System.setProperty("javax.net.ssl.keyStorePassword", keyStorePassword);
   System.setProperty("javax.net.ssl.keyStoreType", keyStoreType);
   
   Jedis jedis = new Jedis(URI.create("rediss://" + hostName + ":" + port));
    jedis.auth(password);
System.out.println("foo = " + jedis.get("foo"));
   jedis.close();

}

}

Reply all
Reply to author
Forward
0 new messages