i given certificate api provider .crt file , .p12 file.
i generated ca-cert.pem file .crt file , client-cert.pem , client-key.pem file .p12 file using openssl required api.
i provided username password basic authentication api provider.
my question how can connect server url https (rest) using these certificate , credentials using java.
you have create sslsocketfactory see here example. once you've created sslsocketfactory can set when create connection url so.
sslsocketfactory sf = ... see example url url = new url("https://google.com"); httpsurlconnection connection = (httpsurlconnection) url.openconnection(); connection.setsslsocketfactory(sf); ... stuff connection or post
also fyi, going want convert certificates jks format java prefers in order load them sslsocketfactory. can use program called keytool comes java can out.
Comments
Post a Comment