http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/index.jsp?topic=/com.ibm.mq.csqzas.doc/sy10600_.htm
How certificate chains work
When you receive the certificate for another entity, you might need to use a certificate chain to obtain the root CAcertificate. The certificate chain, also known as the certification path, is a list of certificates used to authenticate an entity. The chain, or path, begins with the certificate of that entity, and each certificate in the chain is signed by the entity identified by the next certificate in the chain. The chain terminates with a root CA certificate. The root CA certificate is always signed by the CA itself. The signatures of all certificates in the chain must be verified until the root CA certificate is reached. Figure 1 illustrates a certification path from the certificate owner to the root CA, where the chain of trust begins.
证书链是由一系列 CA 证书发出的证书序列,最终以根 CA 证书结束。
数字证书由颁发该证书的CA签名。多个证书可以绑定到一个信息或交易上形成证书链,证书链中每一个证书都由其前面的数字证书进行鉴别。最高级的CA必须是受接受者信任的、独立的机构。
生成带证书链的数字证书
http://blog.chinaunix.net/uid-79084-id-97155.html
安全SSL通信双方如果都使用自签名证书,则需要把对方的证书加入到自己的信任证书库,如果是常见的C/S结构,则需要在服务器端信任证书中加入所有的客户端证书,管理非常不方便。 可以使用证书链来实现,以简化管理,增加新的客户端无需修改服务器信任证书库。
1. http://sourceforge.net/projects/xca,下载证书生成工具,目前最新版为0.6.3,很多介绍都是使用openssl的方法,感觉 xca 的 GUI 操作方法更合我们的口味:)
2. 生成Root CA私钥与证书:
2.1 先生成RootCA私钥--》使用私钥生成CSR--》生成自签名根证书。用来给二级CA证书签名。
3. 生成二级CA 私钥与证书:(假如有两个二级CA, 分别负责管理服务器端和客户端证书)
3.1 先生成ServerCA私钥--》使用私钥生成CSR--》使用根证书签名生成二级证书。用来给服务器证书签名。
3.2 先生成ClientCA私钥--》使用私钥生成CSR--》使用根证书签名生成二级证书。用来给客户端证书签名。
4. 生成服务器端与客户端的私钥与证书:
4.1 先生成ServerA私钥--》使用私钥生成CSR--》使用ServerCA证书签名生成三级证书。
4.2 先生成ClientA私钥--》使用私钥生成CSR--》使用ClientCA证书签名生成三级证书。
4.3 先生成ClientB私钥--》使用私钥生成CSR--》使用ClientCA证书签名生成三级证书
。。。。可以生成N个客户端证书
证书结构:
RootCA
|
|-------ServerCA
| |
| |--------ServerA
|
|-------ClientCA
|
|--------ClientA
|
|--------ClientB
|
|--------...
|
5. 导出RootCA的根证书、服务器端和客户端的私钥和证书。
导出时都使用pem格式。
RootCA.pem-------根证书(PEM )
ServerA.pem------服务器端证书(PEM with Certificate chain)
ClientA.pem------客户端证书(PEM with Certificate chain)
ClientB.pem------客户端证书(PEM with Certificate chain)
ServerAKey.pem------服务器端私钥(PEM )
ClientAKey.pem------客户端私钥(PEM )
ClientBKey.pem------客户端私钥(PEM )
6.下面是最重要的一步:生成需要使用的JKS文件。keytool工具不能导入私钥,需要利用到weblogic 提供的一个工具,需要把weblogic.jar加到CLASSPATH。
6.1 生成服务器和客户端的信任证书库:
keytool -import -alias rootca -file RootCA.pem -keystore trust.jks
6.2 生成服务器端身份密钥库:
java utils.ImportPrivateKey -keystore servera.jks -storepass 123456 -storetype JKS -keypass 123456 -alias servera -certfile ServerA.pem -keyfile ServerAKey.pem
6.3 生成客户端身份密钥库:
java utils.ImportPrivateKey -keystore clienta.jks -storepass 123456 -storetype JKS -keypass 123456 -alias clienta -certfile ClientA.pem -keyfile ClientAKey.pem ...生成其他客户端身份密钥库
7. keytool -list -v -keystore clienta.jks (servera.jks) 可以查看其中的证书链关系。
至此完成所有步骤,可以将JKS应用于SSL SOCKET 连接或 WebLogic 的 https 连接中。