制作ssl的证书
Preparation :1,deploy 一个新的server 时,需要申请两个ports ,一个给http 用,一个给https 用,如:firestar 就是8099给http 用,8100给h
Preparation :
1,deploy 一个新的server 时,需要申请两个ports ,一个给http 用,一个给https 用,如:
firestar 就是8099给http 用,8100给https 用。
即使开始时还没有cert ,要先给deploy https做准备,预留出https 的port :
1), 在weblogic 控制台的servers ->myserver->general,要将http 和https (ssl )都设好。
如图:

2) 在主配置文件:fusion-config.xml 中也要将https 的内容都填了,是和http 相对应的, 都是填url 信息,只是http 的用一个port ,如:8099,而https 的都用另一个,如:8100。 (refer to :InstallFusiondm313libo.doc )刚deploy 好的server ,登陆用的都是http 的,是不能使用https 的,因为没有在weblogic 中deploy cert。具体制作和deploy cert,在本文中说明。
一、 在pc 上安装openssl 。安装后的Path :C:OpenSSL
安装Win32OpenSSL-v0.9.7i.exe ,
并手动拷贝demoCA (path :SSLWin32OpenSSL-v0.9.7i�moCA,下面有private 和newcerts 两个folders ,是gongzhi 和安装程序一起给的)到C:OpenSSLbin下面(这步,每次必须做)
Note, when you install OpenSSL in your PC, need to copy 'demoCA' folder to '{OpenSSL}bin'.
,如果已经做了一个证书,想做个新的,需要删除C:OpenSSLbin下面的jks,der,pem,client.p12,crs ,.rnd 等文件(这些是做证书执行指令是生成的,日期同做证书的时间,执行command 的结果写入这些files 中),别的exe 、CA.pl 和folder 等留着。
二、 安装JDK1.4. Path :C:j2sdk1.4.2_06
并手动配置环境变量
Need install JDK1.4. to your pc first, set environment variable(JAVA home), my computer->right key->property-> advanced-> environment variables->system variables,
1, 先add a new sys variable: [variable name: JAVA_HOME, variable value: C:j2sdk1.4.2_06(值是安装jdk 的路径,即:java home)]
2, 修改原来的变量:path ,在它的值里面加上我们新加的变量:[ variable name: Path, variable value: JAVA_HOMEbin;],原来就有个variable 叫:path ,现在是往它下面添加新的路径,直接填到value 的最后,用分号和前面的隔开,将新的路径拷上去保存即可。
Java_home这个名字是自己随便起的,因为是新加的变量。后面引用要一致。 变量Path 是系统原来就有的,不能随便改
可以在path 这个variable 的值中看到我们定义的变量:
C:Program FilesPC Connectivity Solution;JAVA_HOMEbin;C:Program FilesCommon
FilesNetSarang;C:oracleproduct.2.0client_1bin;SystemRootsystem32;SystemRoot;SystemRootSystem32Wbem;C:Program Files�tivCard�tivCard Goldresources;C:Program FilesCommon FilesThunder NetworkKanKanCodecs
用这个指令查一下:
C:Documents and Settingsbli1>java -version
java version "1.4.2_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03) Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode)
说明已经是这个version 了。
如果pc 上原来就安装了别的版本的jdk ,不必删除,继续安装新的即可。有时,一个pc 上可能安装好几个不同版本的jdk ,他们能同时存在(1.6好像是安装高版本的,会把低的先删除)。
定义环境变量,应该有两种方法,一种就是上面的,先加一个新的,然后在path 里面,用引用,加到path 里面。再一个就是直接将全路径加到path 中,不用在前面定义了。
,三、 Steps :
Run -》Cmd ,
cd C:OpenSSLbin
Execute commands:
如果给别人做cert ,要让他给我、他所要部署的server 的IP 地址(或域名,这里不用端口) ,这是我所用的最有效信息,这个不对,做好的cert 往它server 上部署后也不能用。
别的也可以按照他的要求做,如:厂家名称写成他的,但这些都不是必须的信息。而且这些信息,即使不准确也行,如:用SS 或IBM 都行,这些信息不是关键,关键是IP 或域名。
如果已经做了一个证书,想做个新的,需要删除C:OpenSSLbin下面的jks,der,pem,client.p12,crs ,.rnd 等文件(这些是做证书执行指令是生成的,日期同做证书的时间,执行command 的结果写入这些files 中),别的exe 、CA.pl 和folder 等留着。
Step 1: Creating Certificate Authority Keys
此指令执行完,会自动添加环境变量到系统:
it can create a Environment Variables
(Variable :OPENSSL_CONF,
Value: C:OpenSSLbinopenssl.cnf,在systems variables下) in your system.
在run 中执行,path 是:C:OpenSSLbin,本文档的所有指令都要在此目录下执行,如:openssl 命令等。
Run -》Cmd
cd C:OpenSSLbin
Execute command:
1,
$ openssl req -x509 -newkey rsa:1024 -keyout cakey.pem -out cacert.pem -config openssl.cnf -days 3650
,会提示填写一些信息,生成files :cakey.pem 和 cacert.pem ,并将结果写入这两个files 。–days 拷入后,会出问题:自动生成空格,需要在cmd 下手动修改,去掉空格(去掉空格、加横线时,输入法要用英文的)。
从指令可看出,period of validity is 10年
指定pass phrase在下面操作中会被调用。
输入pass phrase的地方爱出问题,最好不要拷,要输对,因为看不到,这里要用拼音加加,输入值能先看一下,再回车,输入进去。
方法二: 输入密码前, 先在cmd 下将输入法调为英文, 并且输几个字母, 如果没有问题, 就能在输入密码时使用.
这里即使输错了,现在还不报错,到第8条指令时,因为还要输这个密码,这里如果不知道输入的什么,到时就总是通不过了。而且到时用什么输入法,都看不到输入值,如果这里用了拼音加加,到时还用拼音加加,即使看不到,但还能通过,不然,到了第8条指令时,会老是输入不通过。或者到时直接拷过去就行。 反正在这里时,如果输入密码时什么都没有看见而输了,到第8条指令时,肯定过不去。
Now you will be asked a set of questions in creating the key pair as shown below:
{
C:OpenSSLbin>openssl req -x509 -newkey rsa:1024 -keyout cakey.pem -out cacert.
pem -config openssl.cnf -days 3650(expire 十年)
Loading 'screen' into random state - done
Generating a 1024 bit RSA private key
...
...
writing new private key to 'CAKey.pem'
Enter PEM pass phrase:changeme (这里要手动输入,不要拷,用拼音加加的汉字输入,先看一下输入值再回车)
Verifying - Enter PEM pass phrase:changeme
-----
You are about to be asked to enter information that will be incorporated into 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 blank. For some fields there will be a default value,If you enter '.', the field will be left
,blank.
-----
Country Name (2 letter code) [AU]:CN
State or Province Name (full name) [Some-State]:BEIJING
Locality Name (eg, city) []:BEIJING
Organization Name (eg, company) [Internet Widgits Pty Ltd]:SS Organizational Unit Name (eg, section) []:PPP
Common Name (eg, YOUR name) []:15.154.146.104 (Please input your server IP address or Domain name,这就是登陆ip 地址, 外网:219.143.232.134,这个一定不能填错)
Email Address []:bo.li@SS.com //email只输入这么一次即可,以下都是display
}
After the configure operation, automatic quit.以上info 会在做好的cert 中显示。
现在keystore 主密码是:changeme
The result of the above will be two files(执行指令的result ,是将一些信息写入下面two files ,这两个files ,是automatic 生成的。Bin 下面,at first ,there are only *.exe files in the folder,执行command 后,会陆续生成cakey.pem 等这些文件):
∙ cakey.pem
∙ cacert.pem
The cakey.pem file contains the encrypted private key and the cacert.pem file contains the public key certificate signed using the private key

(Figure 1).changeme
Figure 1: CA's private key and the self signed certificate
Step 2: Client and Service Keys
Now let ’s create the two sets of keys for the service and the client using the 'keytool' that comes with the JDK. Lets use the 'keytool -genkey' to
,create a keypair and store it in a keystore using the following command: Cmd
Cd C:OpenSSLbin
Need install JDK1.4. to your pc first, set environment variable(JAVA home)
2,
$ keytool -genkey -alias client -keyalg RSA -keystore client.jks 会提示重新填写一些信息,生成一个文件:client.jks ,并将这些信息写入这个文件,info 要和1填写的一致。
指令中parameter :alias ,是让指定别名,这里输入的叫:client 。
{
C:OpenSSLbin>keytool -genkey -alias client -keyalg RSA -keystore client.jks
输入keystore 密码: changeme(输入)
您的名字与姓氏是什么?
[Unknown]: 15.154.146.104(所配server 的IP 或域名,外网:219.143.232.134) 您的组织单位名称是什么?
[Unknown]: PPP
您的组织名称是什么?
[Unknown]: SS
您所在的城市或区域名称是什么?
[Unknown]: BEIJING
您所在的州或省份名称是什么?
[Unknown]: BEIJING
该单位的两字母国家代码是什么
[Unknown]: CN
CN=15.154.146.104, OU=PPP, O=SS, L=BEIJING, ST=BEIJING, C=CN 正确吗?
[否]: y
输入
(如果和 keystore 密码相同,按回车):回车
C:OpenSSLbin>
}
执行result 是生成了file :client.jks ,将相关信息,写入这个文件中。
,The created keys are stored in the client.jks file (Figure 2) which is

a Java keystore under the alias client.
Figure 2: Contents of a keystore with a single key entry To verify this fact we can list the contents of the keystore as shown below.
3,
$ keytool -list -v -keystore client.jks -storepass changeme
用list 命令,查看一下client file :client.jks 中的info, 这里的changeme ,是上面设置的密码。Display 的别名名称叫:client ,是执行2时指定的。 {
C:OpenSSLbin>keytool -list -v -keystore client.jks -storepass changeme
Keystore 类型: jks
Keystore 提供者: SUN
您的 keystore 包含 1 输入
别名名称: client
创建日期: 2009-5-25
输入类型:KeyEntry
认证链长度: 1
认证 [1]:
Owner: CN=15.154.146.104, OU=PPP, O=SS, L=BEIJING, ST=BEIJING, C=CN 发照者: CN=15.154.146.104, OU=PPP, O=SS, L=BEIJING, ST=BEIJING, C=CN 序号: 4a1a3a26
有效期间: Mon May 25 14:26:46 CST 2009 至: Sun Aug 23 14:26:46 CST 2009 认证指纹:
MD5: 93:3E:B4:2F:95:41:02:AB:DD:A3:FE:48:E0:80:5E:1D
SHA1: 9A:03:63:17:F7:F0:85:A5:15:8A:8D:9A:1D:9F:CD:12:00:C8:34:5A
,*******************************************
*******************************************
C:OpenSSLbin>
}
C:OpenSSLbin>
Excute 完这个带list 的command ,是display some values that be created automatic at that process ,如:指纹码、client 的别名。只是显示,没有让输入任何值。这是做了client 的,并显示一下。通过这个指令,指纹码就建好了,应是随即生成的。下面建立server 的。
4,
$ keytool -genkey -alias service -keyalg RSA -keystore service.jks Note that we will be using 'changeme' (without quotes) as the password of both keys and keystores.
会提示重新填写一些信息,生成一个文件:service.jks ,并将这些信息写入这个文件,info 要和1填写的一致。
指令中parameter :alias ,它后面是让指定别名,这里输入的叫:service ,那指定的server 的别名就叫:service 。
输入一些信息,引用changeme 。
{
C:OpenSSLbin>keytool -genkey -alias service -keyalg RSA -keystore service.jks
输入keystore 密码: changeme(输入)
您的名字与姓氏是什么?
[Unknown]: 15.154.146.104(外网:219.143.232.134)
您的组织单位名称是什么?
[Unknown]: PPP
,您的组织名称是什么?
[Unknown]: SS
您所在的城市或区域名称是什么?
[Unknown]: BEIJING
您所在的州或省份名称是什么?
[Unknown]: BEIJING
该单位的两字母国家代码是什么
[Unknown]: CN
CN=15.154.146.104, OU=PPP, O=SS, L=BEIJING, ST=BEIJING, C=CN 正确吗?
[否]: Y
输入
(如果和 keystore 密码相同,按回车):回车
C:OpenSSLbin>
}
执行完成,是建立了file :service.jks ,并往里写了上面info ,可以看一下,将上面keytool -list 指令里面的client 改为server ,密码都是changeme 。server 的别名是service ,这个是执行4时生成的,这个别名要在weblogic 的控制台deploy 这个cert 时用,因为在weblogic 中算是部署server ,不是client ,5是显示service.jks 的信息。
5,
$ keytool -list -v -keystore service.jks -storepass changeme 这command 是显示service.jks 的info 。包括在4中设置的别名。
{
C:OpenSSLbin>keytool -list -v -keystore service.jks -storepass changeme
,Keystore 类型: jks
Keystore 提供者: SUN
您的 keystore 包含 1 输入
别名名称: service
创建日期: 2009-5-25
输入类型:KeyEntry
认证链长度: 1
认证 [1]:
Owner: CN=15.154.146.104, OU=PPP, O=SS, L=BEIJING, ST=BEIJING, C=CN 发照者: CN=15.154.146.104, OU=PPP, O=SS, L=BEIJING, ST=BEIJING, C=CN 序号: 4a1a3ab7
有效期间: Mon May 25 14:29:11 CST 2009 至: Sun Aug 23 14:29:11 CST 2009 认证指纹:
MD5: 62:BE:89:60:A3:BD:E8:B1:E3:02:D6:55:EA:1B:73:C3 SHA1:
39:83:C6:B3:E8:13:BA:56:8A:8C:77:EC:83:F3:1F:6D:87:ED:F6:91
*******************************************
*******************************************
C:OpenSSLbin>
}
Step 3: Producing Signed X509 Certificates
(Please copy ‘cakey.pem ’file to ‘bin�moCAprivate’ folder and copy