cxf建立https连接
客户端添加证书的代码(这段代码是cxf 官方提供的demo里面的) :
String contextPath = "./certs";
System.out.println("contextPath=" + contextPath);
HTTPConduit httpConduit = (HTTPConduit) ClientProxy.getClient(port)
.getConduit();
TLSClientParameters tlsCP = new TLSClientParameters();
// 服务器证书库
String keyPassword = "password";
KeyStore keyStore = KeyStore.getInstance("JKS");
String keyStoreLoc = contextPath + "/wibble.jks";
keyStore.load(new FileInputStream(keyStoreLoc),
keyPassword.toCharArray());
KeyManager[] myKeyManagers = getKeyManagers(keyStore, keyPassword);
tlsCP.setKeyManagers(myKeyManagers);
// 证书信任库
KeyStore trustStore = KeyStore.getInstance("JKS");
String trustStoreLoc = contextPath + "/truststore.jks";
trustStore.load(new FileInputStream(trustStoreLoc),
keyPassword.toCharArray());
TrustManager[] myTrustStoreKeyManagers = getTrustManagers(trustStore);
tlsCP.setTrustManagers(myTrustStoreKeyManagers);
// The following is not recommended and would not be done in a
// prodcution environment,
// this is just for illustrative purpose
tlsCP.setDisableCNCheck(true);
httpConduit.setTlsClientParameters(tlsCP);
里面的证书也是官方例子里面提供的脚本生成的,现在报 No trusted certificate found
查看了两个证书多是有的,
不知道问题在哪里
相关推荐
CFX构建webservice实例,与Spring整合;以及调用https协议的webservice,附带源码,及其证书
CFX构建webservice实例,与Spring整合;以及调用https协议的webservice,附带源码,及其证书
Spring 5.0与CXF 3.2集成的HTTPS Web服务实战
Apache CXF 是一个开源的面向服务的架构(SOA)的服务框架。CXF提供了完整的服务开发和部署工具集合,用于简化和快速构建Web服务。CXF的核心组件包括前端API、核心运行时和插件系统。前端API:提供编程模型,支持多种服务描述语言,比如JAX-WS、XML Schema等,允许开发者以编程方式创建服务。核心运行时:处理底层消息传输和消息编码,支持多种传输协议(如HTTP、JMS等)和消息协议(如SOAP、XML等)。插件系统。
使用Java通过CXF发布HTTPS Web服务的完整指南
Web服务是基于Web技术的一种服务架构,它允许不同系统之间的通信和数据交换。现代Web服务通常遵循简单对象访问协议(SOAP)或代表性状态传输(REST)原则,为异构环境提供了灵活的通信手段。Apache CXF是一个强大的开源服务框架,用于构建和开发服务导向架构(SOA)环境中的Web服务。CXF起源于Object Oriented Systems公司开发的 Celtix 和 Codehaus的 XFire,最终在2007年归入Apache软件基金会,成为如今广泛使用的开源项目。
cxf外部调用jar
提供cxf外部调用所需要的jar
4.CXF安全访问之单向SSL或者双向SSL(三)
NULL 博文链接:https://wangwengcn.iteye.com/blog/1881535


Web 开发
