如何在使用OpenSSL签署证书请求时在Windows中添加主题备用名称(如果有的话)?
我从IIS界面生成了一个基本的证书签名请求(CSR)。 现在,我想添加几个主题备用名称,用现有的根证书签名,然后返回证书来完成签名请求。
我能find的每个教程都涉及到生成一个新的私钥和一个全新的CSR,但是我的印象是私钥驻留在请求的计算机上(我不一定有权访问)。 我只想在添加备用名称的同时签署请求。 我对OpenSSL和CA主题比较陌生,所以这可能是我的一个误解。
就我个人而言,我在CSR一代中添加了alt名称,所以我知道这是可行的(在默认的conf文件中,有一点用于生成和签名)。
对于后来改变,据我记得,replace名称是扩展名,看来你可以覆盖或添加你想要的扩展名,而在签署。 我会无耻地复制:
From: Patrick Patterson @carillonis.com Newsgroups: mailing.openssl.users Subject: Re: Sign CSR after modifying data in CSR possible? Date: Tue, 5 Jan 2010 15:14:05 -0500 Message-ID: <mailpost.1262722567.7762451.82829.mailing.openssl.users@FreeBSD.cs.nctu.edu.tw>
当您使用openssl CA(奇怪的是:openssl ca)命令时,您可以给它许多选项,包括使用哪个Subject值(-subj参数)以及使用哪些扩展(通过-extfile和-extensions参数)。
所以你可以通过下面的命令设置你想要的扩展名和你想要的对象(导致CSR中的两个值都被完全忽略):
openssl ca -config /etc/myca/openssl.cnf -extfile /etc/myca/openssl-exts.cnf -extension sig-medium -subj "/C=CA/O=Example Company/OU=Engineering/CN=John Doe" -in req.csr -out john-doe.pem
哪里:
/etc/myca/openssl-ext.cnf包含:
[ sig-medium ] basicConstraints = CA:FALSE keyUsage = critical, digitalSignature extendedKeyUsage = emailProtection, anyExtendedKeyUsage nsComment = "Do Not trust - PURE TEST purposes only" subjectKeyIdentifier = hash authorityKeyIdentifier = keyid,issuer subjectAltName = @testsan authorityInfoAccess = @aia_points crlDistributionPoints = @crl_dist_points [ testsan ] email = [email protected] DNS = www.example.com dirName = test_dir URI = http://www.example.com/ IP = 172.16.0.1 otherName.0 = 1.3.6.1.4.1.311.20.2.3;UTF8:[email protected] otherName.1 = 1.3.6.1.5.5.7.8.7;IA5STRING:_mail.example.com otherName.2 = 1.3.6.1.5.5.7.8.5;UTF8:[email protected] [aia_points] caIssuers;URI.0=http://www.example.com/caops/Signing-CA.p7c caIssuers;URI.1=ldap://dir.example.com/<DN of Signing CA>?cACertificate;binary?base?objectclass=pkiCA [crl_dist_points] URI.0=http://www.example.com/caops/test-signca1-crl.crl URI.1=ldap://dir.example.com/<DN of Signing CA>?certificateRevocationList;binary?base?objectclass=pkiCA