问题:我想通过使用泽西客户端来使用HTTPS Restful Webservice。如何使用泽西客户端使用https RestFul Webservice
1)我从第三方CAROOT证书并安装在浏览器(Mozilla的),我能够从RESTClient实现访问Mozilla浏览这些服务。
ⅰ)RootCA.pem ⅱ)SUBCA-Client.pem ⅲ)abc_sdsdllkl_p12.pfx
2)I想要通过使用Jersey客户端配置此web服务中的Java代码。
3)我需要做的是如何在java代码中配置这些证书。
4)我不想在本地JRE中配置这些。
PAttributes pd = new PAttributes();
ClassLoader classLoader = pd.getClass().getClassLoader();
File file = new File(classLoader.getResource("cacerts").getFile());
System.setProperty("javax.net.ssl.trustStore",file.getAbsolutePath());
System.setProperty("javax.net.ssl.trustStorePassword", "changeit");
Client client = Client.create();
WebResource webResource = client.resource("https://xyz/abc/getAttributes");
String input = new PAttributes().getRequestBody();
ClientResponse clientResponse = webResource.accept("application/xml").type("application/xml").post(ClientResponse.class, input);
String output = clientResponse.getEntity(String.class);
System.out.println("output"+output);
我已经从浏览器下载了.crt文件,需要配置,不知道该怎么做?
我没有得到如何做到这一点,我有两个.crt文件'RootCA.crt'和SubCA-Cli ent.crt,放置这些文件的位置以及如何配置为Java代码。 – user3676578
您使用的是Linux还是Windows? – Schlangguru
我正在使用Windows 10操作系统。我是SSL证书的新手。 – user3676578