一个好用的X.509证书生成工具

需要生成一个PKCS#12格式的证书,里面需要有证书和私钥,用于发送电子邮件时的签名和加密(S/MIME),同时,需要证书支持KeyUsage extension,因为需要通过检查KeyUsage来判断这个证书只能用于签名或者只能用于加密或者都可以。

关于KeyUsage extension,介绍如下:

Key usage is a multi valued extension consisting of a list of names of the permitted key usages.

 

Java X509Certificate类也有获得KeyUsage的方法:

public abstract boolean[] getKeyUsage ()
Since: API Level 1

Returns the KeyUsage extension as a boolean array.

The ASN.1 definition of KeyUsage:

 KeyUsage ::= BIT STRING {
      digitalSignature        (0),
      nonRepudiation          (1),
      keyEncipherment         (2),
      dataEncipherment        (3),
      keyAgreement            (4),
      keyCertSign             (5),
      cRLSign                 (6),
      encipherOnly            (7),
      decipherOnly            (8) }

Returns

    the KeyUsage extension or null if there's none in the certificate. 

 

openssl命令行是最强大的,但是那些参数让我头疼,特别是需要证书中含有KeyUsage。这里找到一个生成证书的GUI工具,刚好生成的证书里面也会包含KeyUsage:

 

TekCERT

http://www.yasinkaplan.com/tekcert.asp

 

 

  1. Run TekCERT from Start / Program Files / TekCERT.

  2. Click "Generate Certificate" button to create the certificate after filling necessary fields. You need to enter at least a valid "Name" for the certificate. Generated certificates are located in "Local Computer/Personal" store.

  3. You can export public key in .cer (DER encoded X.509) format or with private key in .pfx format in after creating the certificate for client deployment. Click "Browse Certificates" tab, select the generated certificate and click "Export" button.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值