1 安装httpd-2.2.25-win32-x86-openssl-0.9.8y.msi
域名xcviie.com www.xcviie.com admin@xcviie.com 可随机选取 但生成server.csr时 需要对应一致
2 打开C:\Program Files\Apache Software Foundation\Apache2.2\bin\openssl.exe
3 自签名
server私钥 和 待签名的申请csr
1)genrsa -out server.key 20482)req -new -out server.csr -key server.key -config ../conf/openssl.cnf
-----Country Name (2 letter code) [AU]:CNState or Province Name (full name) [Some-State]:BJLocality Name (eg, city) []:BJOrganization Name (eg, company) [Internet Widgits Pty Ltd]:XCVIIEOrganizational Unit Name (eg, section) []:XCVIIECommon Name (e.g. server FQDN or YOUR name) []:XCVIIE.COMEmail Address []:ADMIN@XCVIIE.COMPlease enter the following 'extra' attributesto be sent with your certificate requestA challenge password []:An optional company name []:
自签名
3)req -x509 -days 365 -key server.key -in server.csr -out server.crt4)将server.crt server.key 放入conf目录5)去掉 LoadModule ssl_module modules/mod_ssl.so 行的注释# ; 去掉 Include conf/extra/httpd-ssl.conf 行的注释#6)重启服务器,访问https://127.0.0.1 或 配置hosts文件可访问https://www.xcviie.com
4 模拟ca给server签名
server私钥 和 待签名的申请csr
1) genrsa -out server.key 20482) req -new -out server.csr -key server.key -config ../conf/openssl.cnf
-----Country Name (2 letter code) [AU]:CNState or Province Name (full name) [Some-State]:BJLocality Name (eg, city) []:BJOrganization Name (eg, company) [Internet Widgits Pty Ltd]:HRCA //这里要和CA一致Organizational Unit Name (eg, section) []:XCVIIECommon Name (e.g. server FQDN or YOUR name) []:XCVIIE.COMEmail Address []:Please enter the following 'extra' attributesto be sent with your certificate requestA challenge password []:An optional company name []:
CA中心证书
3) genrsa -out ca.key 10244) req -new -x509 -days 365 -key ca.key -out ca.crt -config ../conf/openssl.cnf
-----Country Name (2 letter code) [AU]:CNState or Province Name (full name) [Some-State]:BJLocality Name (eg, city) []:HROrganization Name (eg, company) [Internet Widgits Pty Ltd]:HRCAOrganizational Unit Name (eg, section) []:HRCACommon Name (e.g. server FQDN or YOUR name) []:HRCA.COMEmail Address []:
为服务器签名
5) ca -in server.csr -out server.crt -cert ca.crt -keyfile ca.key -config ../conf/openssl.cnf
CA签名注意问题:
1、demoCA 问题
答:新建如下目录结构即可demoCA文件夹- newcerts文件夹- index.txt 内容空- serial 内容为 01
2、The organizationName field needed to be the same in the CA certificate (HRCA) and the request (XCVIIE)
答:重新生成server.csr 名字改为和CA一致 即可
3、另外一些问题 见网上doc 已下载
4、CA可以用1024的rsa私钥给server 2048的rsa签名 (通过测试)