使用主题密钥标识符创建自签名证书 [英] Create Self Signed Certificate with Subject Key Identifier

查看:84
本文介绍了使用主题密钥标识符创建自签名证书的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个带有主题密钥标识符的 RSA 算法密钥大小为 2048 的自签名证书.我知道我们在 openssl.conf 中做了一些默认更改.我想改变什么?

I want to create a self signed certificate with RSA algorithm keysize 2048 with subject key identifier. I know we made some some default change in openssl.conf. What i suppose to change?

genrsa -des3 -out mcedt.key 2048
req -new -key mcedt.key -out mcedt.csr
CN = server.test , OU =, O =, L = Toronto, S = ontario , C = can
x509 -req -days 365 -in mcedt.csr -signkey mcedt.key -out mcedt.crt
pkcs12 -export -in mcedt.crt -inkey mcedt.key -out mcedt.pfx

推荐答案

您可以创建包含以下信息的扩展文件 (extensions.cnf):

You could create an extension file (extensions.cnf) with the following information:

subjectKeyIdentifier=hash

正如 OpenSSL 所提到的:

as mentioned by OpenSSL :

这实际上是一个字符串扩展,可以采用两个可能的值.将自动遵循中的准则的单词哈希RFC3280 或给出要包含的扩展值的十六进制字符串.使用强烈建议不要使用十六进制字符串.

This is really a string extension and can take two possible values. Either the word hash which will automatically follow the guidelines in RFC3280 or a hex string giving the extension value to include. The use of the hex string is strongly discouraged.

那你应该改变

x509 -req -days 365 -in mcedt.csr -signkey mcedt.key -out mcedt.crt

进入

x509 -req -days 365 -extfile extensions.cnf -in mcedt.csr -signkey mcedt.key -out mcedt.crt

这篇关于使用主题密钥标识符创建自签名证书的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆