JAVA: jdk1.6.0_30
System: CentOS release 5.7
Apache:httpd-2.2.3
Openssl:openssl-0.9.8e
网络上该类文档多为指导测试用的SSL配制,商用SSL一般需要权威的第三方机构认证,IE浏览器才不提示证书无效。
1. 安装Apache与 OpenSSL:略。其中Apache需使用带有MOD_SSL模块的版本
2. KEY生成:进入/usr/local/httpd/conf/sign目录下执行按顺序执行以下命令:
1>openssl genrsa -des3 1024 > /usr/local/httpd/conf/server.key ← 建立服务器密钥 Generating RSA private key, 1024 bit long modulus................++++++...........................................................................++++++e is 65537 (0x10001)Enter pass phrase: ← 在这里输入口令
Verifying - Enter pass phrase: ← 确认口令,再次输入 2>openssl rsa -in /usr/local/httpd/conf/server.key > /usr/local/httpd/conf/server2.key ← 从密钥中删除密码(以避免系统启动后被询问口令) Enter pass phrase for ssl.key/server.key: ← 输入口令writing RSA key 3>mv /usr/local/httpd/conf/server2.key /usr/local/httpd/conf/server.key 4>openssl req -new -key /usr/local/httpd/conf/server.key -out /usr/local/httpd/conf/server.csr ← 建立服务器密钥请求文件 You are about to be asked to enter information that will be incorporatedinto your certificate request.What you are about to enter is what is called a Distinguished Name or a DN.There are quite a few fields but you can leave some blankFor some fields there will be a default value,If you enter '.', the field will be left blank.-----
Country Name (2 letter code) [GB]:CN ← 输入国名
State or Province Name (full name) [Berkshire]:GD ← 输入省名
Locality Name (eg, city) [Newbury]:Foshan ← 输入城市名
Organization Name (eg, company) [My Company Ltd]:cdcgs ← 输入组织名(任意)
Organizational Unit Name (eg, section) []: ← 不输入,直接回车
Common Name (eg, your name or your server's hostname) []: ← 输入通称(任意)
Email Address []:yourname@yourserver.com ← 输入电子邮箱地址
Please enter the following 'extra' attributesto be sent with your certificate requestA challenge password []: ← 不输入,直接回车An optional company name []: ← 不输入,直接回车
5>openssl x509 -in /usr/local/httpd/conf/server.csr -out /usr/local/httpd/conf/server.crt -req -signkey /usr/local/httpd/conf/server.key -days 365← 建立服务器证书 Signature oksubject=/C=CN/ST=GD/L=Foshan/O=cdcgs/CN=www.cdcsaas.com/\emailAddress=yourname@yourserver.comGetting Private key