我有第三方authentication机构的SSL证书。 这是一个.cer文件。 证书在IIS7中安装并正常工作。
证书将其预期目的显示为服务器身份validation,客户端身份validation。
该网站需要通过客户端证书进行validation 我们不使用客户端证书映射,而只是使用客户端证书作为身份validation的一种手段 – 如果您拥有身份validation,则会进行身份validation。
IIS(或大多数HTTPD)中的客户端证书authentication有点复杂。 您必须将用户映射到证书。 证书本身可以由服务器信任的任何CA颁发; 您可以设置AD CS实例来颁发证书,甚至可以使用OpenSSL的本地副本创build证书(如果需要)。
在IIS.net上有一篇描述客户端证书映射的文章; 包含有关启用它并以编程方式将证书与用户关联的信息。
编辑:
用OpenSSL发布客户端证书的超短版本。
openssl genrsa -des3 -out my_ca.key 4096 openssl req -new -key my_ca.key -out my_ca.csr openssl x509 -req -days 365 -in my_ca.csr -signkey my_ca.key -out my_ca.crt openssl genrsa -des3 -out client1.key 1024 openssl req -new -key client1.key -out client1.csr 编辑你的openssl.cnf文件并填写相关的CA部分。 他们是:
[ ca ] default_ca = CA_default # The default ca section [ CA_default ] dir = ./ # top dir database = $dir/my_ca.index # index file. new_certs_dir = $dir/newcerts # new certs dir certificate = $dir/my_ca.crt # The CA cert serial = $dir/my_ca.srl # serial no file private_key = $dir/my_ca.key # CA private key RANDFILE = $dir/rand # random number file default_days = 365 # how long to certify for default_crl_days= 30 # how long before next CRL default_md = md5 # md to use policy = policy_any # default policy email_in_dn = no # Don't add the email into cert DN name_opt = ca_default # Subject name display option cert_opt = ca_default # Certificate display option copy_extensions = none # Don't copy extensions from request [ policy_any ] countryName = supplied stateOrProvinceName = optional organizationName = optional organizationalUnitName = optional commonName = supplied emailAddress = optional
使用CA证书签署密钥
openssl ca -in client1.csr -out client1.crt
openssl pkcs12 -export -in client1.crt -inkey client1.key -out client1.p12 请注意,这是颁发签名证书的不好的方法,因为它只是授予CSR指定的任何types的证书。 一定要注意你在做什么。 如果你打算发行大量的证书,你需要投入一些时间在更安全的设置上。