Certificate chain 证书链

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.

Figure 1. Chain of trust
This diagram shows the signature on a user certificate verified with a CA certificate that is itself verified with the root CA certificate. The certificates are on a certification path.

证书链是由一系列 CA 证书发出的证书序列,最终以根 CA 证书结束。
证书最初生成时是一个自签名证书。自签名证书是其签发者(签名者)与主题(其公共密钥由该证书进行验证的实体)相同的证书。如果拥有者向 CA 发送证书签名请求 (CSR),然后输入响应,自签名证书将被证书链替换。链的底部是由 CA 发布的、用于验证主题的公共密钥的证书(回复)。链中的下一个证书是验证 CA 的公共密钥的证书。通常,这是一个自签名证书(即,来自 CA、用于验证其自身的公共密钥的证书)并且是链中的最后一个证书。
在其他情况下,CA 可能会返回一个证书链。在此情况下,链的底部证书是相同的(由 CA 签发的证书,用于验证密钥条目的公共密钥),但是链中的第二个证书是由其他 CA 签发的证书,用于验证您向其发送了 CSR 的 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 连接中。



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值