Created
February 16, 2014 08:49
-
-
Save wikier/9031298 to your computer and use it in GitHub Desktop.
Load Redlink SSL certificate with RESTEasy Client 3.x
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// load the certificate | |
InputStream fis = this.getClass().getResourceAsStream("/path/to/redlink-CA.crt"); | |
CertificateFactory cf = CertificateFactory.getInstance("X.509"); | |
Certificate cert = cf.generateCertificate(fis); | |
// load the keystore that includes self-signed cert as a "trusted" entry | |
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); | |
keyStore.load(null, null); | |
TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); | |
keyStore.setCertificateEntry("redlink-CA", cert); | |
tmf.init(keyStore); | |
SSLContext ctx = SSLContext.getInstance("TLS"); | |
ctx.init(null, tmf.getTrustManagers(), null); | |
// build the rest client | |
ResteasyClientBuilder clientBuilder = new ResteasyClientBuilder(); | |
clientBuilder.sslContext(ctx); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Como estas Sergio, queremos consumir un webservice de link y nos topamos con este error
java.security.cert.CertificateException: No subject alternative names present.
o aveces no da error de atributos en el namespace
si tienes algun conocimiento y puedesorientarnos te agradeceria, saludos....