??xml version="1.0" encoding="utf-8" standalone="yes"?> ?a >http://www.cjsdn.net/post/view?bid=6&id=27468&sty=1&tpg=1&age=0看到一比较好的文章,虽然讲的q是Tomcat 4Q但里面把SSL工作原理讲得很清楚,怿读者再l合我们上一文?用Keytool和OpenSSL生成和签发数字证?能够很好的掌握证书方面的知识?/p>
配置Tomcat 4使用SSL ---------------------- 目前介绍配置Tomcat 4使用单向SSL认证(只验证服务器证书)的资料很多,q程也比较简单。但是由于配|其使用双向SSL认证(q需要验证客L个h证书)除了需要CA对证书签名外Q还要从CA获得个h证书。有兌一问题Q目前结合具体web服务器来讲解如何操作的资料很。作者通过摸烦借助一些SSL工具在本地实C单的CA功能Qƈ在此基础上配|成功了Tomcat的双向认证,希望能把其中的一些经验与大家׃n。不q受本h水^所限,文中隑օ会有错误与不当之处,敬请大家谅解? 2QSSL(Server Socket Layer)? 3QSSL工作原理 用户览器将其SSL版本受加密设|参数、与session有关的数据以及其它一些必要信息发送到服务器? 4Q配|Tomcat 4.x 使用SSL 4.1 用到的Y件包 Tomcat 4.0.2 4.2 建立自己的CA 4.2.1 建立工作目录 4.2.2 生成CAU钥以及自签名根证书 4.2.2.2 生成待签名证? 4.2.2.3 用CAU钥q行自签? 4.3 讄Tomcat 4.x 4.3.1建立工作目录 4.3.2 生成server端证? 4.3.2.2 生成待签名证? 4.3.2.3 用CAU钥q行{ 4.3.2.4 导入信Q的CA根证书到JSSE的默认位|?%JDK_ROOT %/jre/security/cacerts) 4.3.2.5 把CA{后的server端证书导入keystore 4.3.2.6 查看server端证? 4.3.3 修改server.xml使Tomcat支持SSL clientAuth="false"? 然后把文件server\server_keystore复制到目?TCAT_HOME%\conf\下?/p>
4.4 在IE中安装个? 4.4.2 生成clientU钥q用CAU钥{ 4.4.2.1 生成clientU钥 4.4.2.2 生成待签名证? 4.4.2.3 用CAU钥q行{ -CA ca\ca-cert.pem -CAkey ca\ca-key.pem -CAcreateserial -days 365 4.4.2.4 生成client端的个h证书 4.4.2.5 安装信Q的根证书 4.4.3 安装个h证书 4.5 用IE览器用SSL协议讉KTomcat 4.5.1 启动Tomcat 4.x 4.5.2 用IE讉KTomcat 4.x 5 l论 参考资?/p>
Tomcat SSL Configuration HOW-TO original: http://apps.hi.baidu.com/share/detail/30995314 背景Q我们有个WEB服务器,比如TOMCATQ在TOMCAT上我们部|了个应?a>http://localhost:8080/sslPro, 当我们从览器以安全模式Q即https讉Kq个应用Ӟ用到的知识数字证?数字{。这里我们只讲到单向认证Q即服务器端认证。当我从览器访问服务器Ӟ我们的目的是要确认我现在讉K的就是localhost上的sslPro,反过来服务器向我证明我就是localhost. 目的Q我们要做的事是Q用keytool生成证书{hQ用openssl生成自签名证书,然后模拟CA用自q成的自签名证书对{hq行{Qƈ把根证书及签名后的证书倒入到KEYSTORE?/p>
准备QJ2SDK在目?JAVA_HOME%/bin提供了密钥库理工具KeytoolQ用于管理密钥、证书和证书链。Keytool工具的命令在JavaSE6中已l改变,不过以前的命令仍然支持。Keytool也可以用来管理对U加密算法中的密钥。有关Keytool的知识可以参考:http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/keytool.html。有关openssl的知识请参考:http://www.openssl.org?下面的准备很重要Q?1)把openssl目录下的文gopenssl.cnf文g拯到openssl的bin目录下,在bin目录下新建目录demoCA、demoCA/certs、demoCA/private?demoCA/newcerts (2) 在demoCA建立一个空文g index.txt (3) 在demoCA建立一个文本文?serial, 没有扩展名,内容是一个合法的16q制数字Q例?0011, 我曾l写q?000Q但会导致根证书跟签名证书的序列号都?Q所以不行,不写0000?4) 配置好JDK的环境变?/p>
有关SSL的工作原理读者可以参考下文章?/p> Enter pass phrase for server.key: C:\TEMP\2>openssl req -new -key server.key -out server.csr -config openssl.cfg Please enter the following 'extra' attributes C:\TEMP\2>openssl genrsa -des3 -out client.key 1024 C:\TEMP\2>openssl req -new -key client.key -out client.csr -config openssl.cfg Please enter the following 'extra' attributes C:\TEMP\2>openssl req -new -x509 -keyout ca.key -out ca.crt -config openssl.cfg C:\TEMP\2>Openssl ca -in server.csr -out server.crt -cert ca.crt -keyfile ca.key -config openssl.cfg C:\TEMP\2>Openssl ca -in server.csr -out server.crt -cert ca.crt -keyfile ca.key -config openssl.cfg Certificate is to be certified until Apr 24 02:31:47 2013 GMT (365 days) C:\TEMP\2>Openssl ca -in client.csr -out client.crt -cert ca.crt -keyfile ca.key -config openssl.cnf 1920:error:2006D080:BIO routines:BIO_new_file:no such file:.\crypto\bio\bss_file.c:129: C:\TEMP\2>Openssl ca -in client.csr -out client.crt -cert ca.crt -keyfile ca.key -config openssl.cnf 2608:error:2006D080:BIO routines:BIO_new_file:no such file:.\crypto\bio\bss_file.c:129: C:\TEMP\2>Openssl ca -in client.csr -out client.crt -cert ca.crt -keyfile ca.key -config openssl.cfg Certificate is to be certified until Apr 24 02:35:33 2013 GMT (365 days) C:\TEMP\2>type client.crt client.key > client.pem client.crt client.key C:\TEMP\2>type server.crt server.key > server.pem server.crt server.key C:\TEMP\2>openssl pkcs12 -export -clcerts -in client.crt -inkey client.key -out client.p12 C:\TEMP\2>openssl pkcs12 -export -clcerts -in server.crt -inkey server.key -out server.p12 C:\TEMP\2>C:\TEMP\2>openssl genrsa -des3 -out server.key 1024 Enter pass phrase for server.key: C:\TEMP\2>openssl req -new -key server.key -out server.csr -config openssl.cfg Please enter the following 'extra' attributes C:\TEMP\2>openssl genrsa -des3 -out client.key 1024 C:\TEMP\2>openssl req -new -key client.key -out client.csr -config openssl.cfg Please enter the following 'extra' attributes C:\TEMP\2>openssl req -new -x509 -keyout ca.key -out ca.crt -config openssl.cfg C:\TEMP\2>Openssl ca -in server.csr -out server.crt -cert ca.crt -keyfile ca.key -config openssl.cfg C:\TEMP\2>Openssl ca -in server.csr -out server.crt -cert ca.crt -keyfile ca.key -config openssl.cfg Certificate is to be certified until Apr 24 02:31:47 2013 GMT (365 days) C:\TEMP\2>Openssl ca -in client.csr -out client.crt -cert ca.crt -keyfile ca.key -config openssl.cnf 1920:error:2006D080:BIO routines:BIO_new_file:no such file:.\crypto\bio\bss_file.c:129: C:\TEMP\2>Openssl ca -in client.csr -out client.crt -cert ca.crt -keyfile ca.key -config openssl.cnf 2608:error:2006D080:BIO routines:BIO_new_file:no such file:.\crypto\bio\bss_file.c:129: C:\TEMP\2>Openssl ca -in client.csr -out client.crt -cert ca.crt -keyfile ca.key -config openssl.cfg Certificate is to be certified until Apr 24 02:35:33 2013 GMT (365 days) C:\TEMP\2>type client.crt client.key > client.pem client.crt client.key C:\TEMP\2>type server.crt server.key > server.pem server.crt server.key C:\TEMP\2>openssl pkcs12 -export -clcerts -in client.crt -inkey client.key -out client.p12 C:\TEMP\2>openssl pkcs12 -export -clcerts -in server.crt -inkey server.key -out server.p12 C:\TEMP\2>
-----------------------
内容Q?
1QTomcat?
2QSSL(Server Socket Layer)?
3QSSL工作原理
4Q配|Tomcat 4.x 使用SSL
5Q结?/p>
1QTomcat?
Tomcat是Apache Jakarta的子目之一Q作Z个优U的开源web应用服务器,全面支持jsp1.2以及servlet2.3规范。因其技术先q、性能E_Q而且免费Q因而深受Java爱好者的喜爱q得C部分软g开发商的认可,成ؓ目前比较行的web应用服务器?/p>
在网l上信息在源-宿的传递过E中会经q其它的计算机。一般情况下Q中间的计算Z会监听\q的信息。但在用网上银行或者进行信用卡交易的时候有可能被监视,从而导致个人隐U的泄露。由于Internet和Intranet体系l构的原因,L某些够读取ƈ替换用户发出的信息。随着|上支付的不断发展,Z对信息安全的要求来高。因此Netscape公司提出了SSL协议Q旨在达到在开攄l?Internet)上安全保密地传输信息的目的,q种协议在WEB上获得了q泛的应用?之后IETF(www.ietf.org)对SSL作了标准化,即RFC2246Qƈ其UCؓTLSQTransport Layer SecurityQ,从技术上ԌTLS1.0与SSL3.0的差别非常微?/p>
SSL协议使用不对U加密技术实C话双方之间信息的安全传递。可以实C息传递的保密性、完整性,q且会话双方能鉴别对方n份。不同于常用的http协议Q我们在与网站徏立SSL安全q接时用https协议Q即采用https://ip:port/的方式来讉K。当我们与一个网站徏立httpsq接Ӟ我们的浏览器与Web Server之间要经q一个握手的q程来完成n份鉴定与密钥交换Q从而徏立安全连接。具体过E如下:
服务器将其SSL版本受加密设|参数、与session有关的数据以及其它一些必要信息发送给览器,同时发给览器的q有服务器的证书。如果配|服务器的SSL需要验证用戯n份,q要发出h要求览器提供用戯书?
客户端检查服务器证书Q如果检查失败,提示不能建立SSLq接。如果成功,那么l箋。客L览器ؓ本次会话生成pre-master secretQƈ其用服务器公钥加密后发送给服务器。如果服务器要求鉴别客户w䆾Q客Lq要再对另外一些数据签名后q将其与客户端证书一起发送给服务器?
如果服务器要求鉴别客戯n份,则检查签|客戯书的CA是否可信。如果不在信d表中Q结束本ơ会话。如果检查通过Q服务器用自qU钥解密收到的pre-master secretQƈ用它通过某些法生成本次会话的master secret?
客户端与服务器均使用此master secret生成本次会话的会话密?对称密钥)。在双方SSL握手l束后传递Q何消息均使用此会话密钥。这样做的主要原因是对称加密比非对称加密的运量低一个数量以上Q能够显著提高双方会话时的运速度?
客户端通知服务器此后发送的消息都用这个会话密钥进行加密。ƈ通知服务器客L已经完成本次SSL握手?
服务器通知客户端此后发送的消息都用这个会话密钥进行加密。ƈ通知客户端服务器已经完成本次SSL握手?
本次握手q程l束Q会话已l徏立。双方用同一个会话密钥分别对发送以及接受的信息q行加、解密?/p>
用途:Web Server?
下蝲Q?http://jakarta.apache.org/builds/jakarta-tomcat-4.0/release/v4.0.3/bin/
JSSE 1.0,2
用途:用来产生Tocmcat使用的秘钥对(keystore)?
下蝲Q?http://java.sun.com/products/jsse/
Openssl 0.9.9.6
用途:用来产生CA证书、签名ƈ生成IE可导入的PKCS#12格式U钥?
下蝲Q?http://www.openssl.org/
以上工具的安装过E可以参考自带的帮助Q本文就不再详细描述了?/p>
mkdir ca
4.2.2.1 生成CAU钥
openssl genrsa -out ca\ca-key.pem 1024
openssl req -new -out ca\ca-req.csr -key ca\ca-key.pem
openssl x509 -req -in ca\ca-req.csr -out ca\ca-cert.pem -signkey ca\ca-key.pem -days 365
在本文中用符?%JDK_HOME%"来表CJDK的安装位|,用符?%TCAT_HOME%" 表示Tomcat的安装位|?/p>
mkdir server
4.3.2.1 生成KeyPair
%JDK_HOME%\bin\keytool -genkey -alias tomcat_server -validity 365 -keyalg RSA -keysize 1024 -keypass changeit -storepass changeit -dname "cn=localhost, ou=department, o=company, l=Beijing, st=Beijing, c=CN" -keystore server\server_keystore
%JDK_HOME%\bin\keytool -certreq -alias tomcat_server -sigalg MD5withRSA -file server\server.csr -keypass changeit -keystore server\server_keystore -storepass changeit
openssl x509 -req -in server\server.csr -out server\server-cert.pem -CA ca\ca-cert.pem -CAkey ca\ca-key.pem -days 365
%JDK_HOME%\bin\keytool -import -v -trustcacerts -storepass changeit -alias my_ca_root -file ca\ca-cert.pem -keystore %JDK_HOME%\jre\lib\security\cacerts
%JDK_HOME%\bin\keytool -import -v -trustcacerts -storepass changeit -alias tomcat_server -file server\server-cert.pem -keystore server\server_keystore
keytool -list -keystore %JDK_HOME%\jre\lib\security\cacerts
keytool -list -keystore server\server_keystore
首先扑ֈ以下内容Q去掉对其的注释。然后参照红色部分修攏V如果配|Tomcat不验证客戯n份,可以讄
<Connector className="org.apache.catalina.connector.http.HttpConnector"
port="8443" minProcessors="5" maxProcessors="75"
enableLookups="true"
acceptCount="10" debug="0" scheme="https" secure="true">
<Factory className="org.apache.catalina.net.SSLServerSocketFactory"
clientAuth="true" protocol="TLS"
keystoreFile="%TCAT_HOME%/conf/server_keystore" keystorePass="changeit"
/>
4.4.1 建立工作目录
mkdir client
openssl genrsa -out client\client-key.pem 1024
openssl req -new -out client\client-req.csr -key client\client-key.pem
openssl x509 -req -in client\client-req.csr -out client\client.crt -signkey client\client-key.pem
因ؓJSSE1.0.2没有完全实现了对PKCS#12格式文g的操?只能dQ不能输?Q所以在q里需要用openssl制作client端的个h证书(包含U钥)?
openssl pkcs12 -export -clcerts -in client\client.crt -inkey client\client-key.pem -out client\client.p12
把ca\ca-key.pem改名为ca\ca-key.cerQ在client端的IE中?工具 ' Internet选项 ' 内容 ' 证书 ' 导入"把我们生成的CA根证书导入,使其成ؓ用户信Q的CA?/p>
把client.p12导入到client端的IE中作Z书,导入q程?.4.2.5?/p>
执行%TCAT_HOME%\bin\startup.bat启动Tomcat 4.x
在IE览器的地址栏中输入https://localhost:8443Q如果前面的操作都正的话,应该可以看到Tomcat的欢q页面。同时状态栏上的锁处于闭合状态,表示您已l成功地与服务器建立了要求客L验证的SSL安全q接?/p>
以上我们实现了ؓTomcat 4.x配置要求客户端验证的SSL的全q程。对于其它类型的服务器,例如ApacheQNetscape Enterprise Server, WebsphereQWeblogic{,一般只是在服务器端保存证书的方式略有不同,但它们的原理都是cM的,配置时可以在本文中办法的基础上做出相应的调整?/p>
SSL3.0规范
Description of the Secure Sockets Layer (SSL) Handshake (Q257591)
keytool - Key and Certificate Management Tool
Openssl使用手册
]]>
弄了差不多两天的证书Q头都大?C很多弯\Q把知识拿出来跟大家share下,其实q不复杂?/p>
q程Q?br />a. 生成密钥?br />Keytool –genkey –alias test –keystore test.jks Ҏ提示输入信息Q记住:输入的信息必跟后面的自{证书信息一?名字与姓氏我们这里应该输入localhost?可以?list查看信息?到这一步,其实我们可以用export命o导出证书到cer文gQ然后把cer文g导入到浏览器Q这是我们自己生成的没有经q签名的证书)
b. 生成证书{h
Keytool –certreq –alias test –keystore test.jks –file test.csr?
c. 生成CA的自{证书
openssl req -new -x509 -keyout root.key -out root.crt -config openssl.cnf 输入信息
d. 把test.csr拯到openssl的bin目录下,用CAU钥q行{(当然也可以到权威机构甌CA{Q但要花很多??br /> openssl ca -in test.csr -out demo.crt -cert root.crt -keyfile root.key -notext -config openssl.cnf Q其?notext表示不要把证书文件的明文内容输出到文件中去,否则在后面用keytool导入到keystore时会出错。) 。可以用openssl x509 -noout -text -in root.crt 命o查看
e. 导入信Q的CA根证书到keystore
keytool -import -v -alias test2 -file root.crt -keystore test.jks
q一步你也可以把根证书倒入到keystore cacerts中,在目?JAVA_HOME%\jre\lib\security 目录下,有关cacerts的官方资料如下:
The "cacerts" file represents a system-wide keystore with CA certificates. System administrators can configure and manage that file using keytool, specifying "jks" as the keystore type. The initial password of the "cacerts" keystore file is "changeit". 详细信息可参考:http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/keytool.html#cacerts
f. 把CA{后的证书导入到keystore
keytool -import -v -trustcacerts -alias test –file demo.crt -keystore test.jks
好了Q把test.jks拯C应用的WEB-INF目录下。配|tomcat服务器,如下Q?br /><Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystorePass="changeit" keystoreFile="webapps\sslPro\WEB-INF\test.jks
keyAlias="test" "/>
现在当你用HTTPS讉K你的应用Ӟ?a>https://localhost:8443/proTest会出来一个框框,说此证书不在你的信用列表里,问是否信用。这个时候你q有一件事情要做,是把你信用的根证书导入C的浏览器中,下次在访问时q个框框就不会出来了,因ؓ你已l信用它了?br />q样自己{的证书就做好了。写来简?Q?但也׃不少旉?br />两个比较好的参考文章:http://zhouzhk.javaeye.com/blog/136943Q?a>http://industry.ccidnet.com/art/1078/20030709/53943_2.html
Verifying - Enter pass phrase for server.key:
Enter pass phrase for server.key:
Loading 'screen' into random state - done
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]:bj
Locality Name (eg, city) []:bj
Organization Name (eg, company) [Internet Widgits Pty Ltd]:v
Organizational Unit Name (eg, section) []:v
Common Name (eg, YOUR name) []:z
Email Address []:p@1
to be sent with your certificate request
A challenge password []:1234
An optional company name []:v
Loading 'screen' into random state - done
Generating RSA private key, 1024 bit long modulus
..........................++++++
.++++++
e is 65537 (0x10001)
Enter pass phrase for client.key:
Verifying - Enter pass phrase for client.key:
Enter pass phrase for client.key:
Loading 'screen' into random state - done
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]:bj
Locality Name (eg, city) []:bj
Organization Name (eg, company) [Internet Widgits Pty Ltd]:v
Organizational Unit Name (eg, section) []:v
Common Name (eg, YOUR name) []:z
Email Address []:p@1
to be sent with your certificate request
A challenge password []:1234
An optional company name []:v
Loading 'screen' into random state - done
Generating a 1024 bit RSA private key
.......................................++++++
................++++++
writing new private key to 'ca.key'
Enter PEM pass phrase:
Verifying - Enter PEM pass phrase:
-----
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]:bj
Locality Name (eg, city) []:bj
Organization Name (eg, company) [Internet Widgits Pty Ltd]:v
Organizational Unit Name (eg, section) []:v
Common Name (eg, YOUR name) []:z
Email Address []:p@1
Using configuration from openssl.cfg
Loading 'screen' into random state - done
Enter pass phrase for ca.key:
unable to load number from C:/TEMP/2/demoCA/serial
error while loading serial number
4176:error:0D066091:asn1 encoding routines:a2i_ASN1_INTEGER:odd number of chars:.\crypto\asn1\f_int.c:162:
Using configuration from openssl.cfg
Loading 'screen' into random state - done
Enter pass phrase for ca.key:
Check that the request matches the signature
Signature ok
Certificate Details:
Serial Number: 1 (0x1)
Validity
Not Before: Apr 24 02:31:47 2012 GMT
Not After : Apr 24 02:31:47 2013 GMT
Subject:
countryName = cn
stateOrProvinceName = bj
organizationName = v
organizationalUnitName = v
commonName = z
emailAddress = p@1
X509v3 extensions:
X509v3 Basic Constraints:
CA:FALSE
Netscape Comment:
OpenSSL Generated Certificate
X509v3 Subject Key Identifier:
E5:BE:16:C6:48:0D:91:1D:52:7C:3A:2C:7C:EF:9C:2D:FA:9A:12:32
X509v3 Authority Key Identifier:
keyid:97:6F:59:B9:97:EB:37:BB:89:54:12:7E:A3:72:BE:92:AE:83:2E:5B
Sign the certificate? [y/n]:y
1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated
Using configuration from openssl.cnf
error loading the config file 'openssl.cnf'
1920:error:02001002:system library:fopen:No such file or directory:.\crypto\bio\bss_file.c:126:fopen('openssl.cnf','rb')
1920:error:0E078072:configuration file routines:DEF_LOAD:no such file:.\crypto\conf\conf_def.c:197:
Using configuration from openssl.cnf
error loading the config file 'openssl.cnf'
2608:error:02001002:system library:fopen:No such file or directory:.\crypto\bio\bss_file.c:126:fopen('openssl.cnf','rb')
2608:error:0E078072:configuration file routines:DEF_LOAD:no such file:.\crypto\conf\conf_def.c:197:
Using configuration from openssl.cfg
Loading 'screen' into random state - done
Enter pass phrase for ca.key:
Check that the request matches the signature
Signature ok
Certificate Details:
Serial Number: 2 (0x2)
Validity
Not Before: Apr 24 02:35:33 2012 GMT
Not After : Apr 24 02:35:33 2013 GMT
Subject:
countryName = cn
stateOrProvinceName = bj
organizationName = v
organizationalUnitName = v
commonName = z
emailAddress = p@1
X509v3 extensions:
X509v3 Basic Constraints:
CA:FALSE
Netscape Comment:
OpenSSL Generated Certificate
X509v3 Subject Key Identifier:
50:61:5E:EE:38:C3:7D:41:66:C7:68:5F:29:9C:96:1E:C2:67:7C:E3
X509v3 Authority Key Identifier:
keyid:97:6F:59:B9:97:EB:37:BB:89:54:12:7E:A3:72:BE:92:AE:83:2E:5B
Sign the certificate? [y/n]:y
1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated
Loading 'screen' into random state - done
Enter pass phrase for client.key:
Enter Export Password:
Verifying - Enter Export Password:
Loading 'screen' into random state - done
Enter pass phrase for server.key:
Enter Export Password:
Verifying - Enter Export Password:
Loading 'screen' into random state - done
Generating RSA private key, 1024 bit long modulus
...++++++
.............................................................++++++
e is 65537 (0x10001)
Enter pass phrase for server.key:
5816:error:28069065:lib(40):UI_set_result:result too small:.\crypto\ui\ui_lib.c:850:You must type in 4 to 511 characters
Verifying - Enter pass phrase for server.key:
Enter pass phrase for server.key:
Loading 'screen' into random state - done
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]:bj
Locality Name (eg, city) []:bj
Organization Name (eg, company) [Internet Widgits Pty Ltd]:v
Organizational Unit Name (eg, section) []:v
Common Name (eg, YOUR name) []:z
Email Address []:p@1
to be sent with your certificate request
A challenge password []:1234
An optional company name []:v
Loading 'screen' into random state - done
Generating RSA private key, 1024 bit long modulus
..........................++++++
.++++++
e is 65537 (0x10001)
Enter pass phrase for client.key:
Verifying - Enter pass phrase for client.key:
Enter pass phrase for client.key:
Loading 'screen' into random state - done
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]:bj
Locality Name (eg, city) []:bj
Organization Name (eg, company) [Internet Widgits Pty Ltd]:v
Organizational Unit Name (eg, section) []:v
Common Name (eg, YOUR name) []:z
Email Address []:p@1
to be sent with your certificate request
A challenge password []:1234
An optional company name []:v
Loading 'screen' into random state - done
Generating a 1024 bit RSA private key
.......................................++++++
................++++++
writing new private key to 'ca.key'
Enter PEM pass phrase:
Verifying - Enter PEM pass phrase:
-----
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]:bj
Locality Name (eg, city) []:bj
Organization Name (eg, company) [Internet Widgits Pty Ltd]:v
Organizational Unit Name (eg, section) []:v
Common Name (eg, YOUR name) []:z
Email Address []:p@1
Using configuration from openssl.cfg
Loading 'screen' into random state - done
Enter pass phrase for ca.key:
unable to load number from C:/TEMP/2/demoCA/serial
error while loading serial number
4176:error:0D066091:asn1 encoding routines:a2i_ASN1_INTEGER:odd number of chars:.\crypto\asn1\f_int.c:162:
Using configuration from openssl.cfg
Loading 'screen' into random state - done
Enter pass phrase for ca.key:
Check that the request matches the signature
Signature ok
Certificate Details:
Serial Number: 1 (0x1)
Validity
Not Before: Apr 24 02:31:47 2012 GMT
Not After : Apr 24 02:31:47 2013 GMT
Subject:
countryName = cn
stateOrProvinceName = bj
organizationName = v
organizationalUnitName = v
commonName = z
emailAddress = p@1
X509v3 extensions:
X509v3 Basic Constraints:
CA:FALSE
Netscape Comment:
OpenSSL Generated Certificate
X509v3 Subject Key Identifier:
E5:BE:16:C6:48:0D:91:1D:52:7C:3A:2C:7C:EF:9C:2D:FA:9A:12:32
X509v3 Authority Key Identifier:
keyid:97:6F:59:B9:97:EB:37:BB:89:54:12:7E:A3:72:BE:92:AE:83:2E:5B
Sign the certificate? [y/n]:y
1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated
Using configuration from openssl.cnf
error loading the config file 'openssl.cnf'
1920:error:02001002:system library:fopen:No such file or directory:.\crypto\bio\bss_file.c:126:fopen('openssl.cnf','rb')
1920:error:0E078072:configuration file routines:DEF_LOAD:no such file:.\crypto\conf\conf_def.c:197:
Using configuration from openssl.cnf
error loading the config file 'openssl.cnf'
2608:error:02001002:system library:fopen:No such file or directory:.\crypto\bio\bss_file.c:126:fopen('openssl.cnf','rb')
2608:error:0E078072:configuration file routines:DEF_LOAD:no such file:.\crypto\conf\conf_def.c:197:
Using configuration from openssl.cfg
Loading 'screen' into random state - done
Enter pass phrase for ca.key:
Check that the request matches the signature
Signature ok
Certificate Details:
Serial Number: 2 (0x2)
Validity
Not Before: Apr 24 02:35:33 2012 GMT
Not After : Apr 24 02:35:33 2013 GMT
Subject:
countryName = cn
stateOrProvinceName = bj
organizationName = v
organizationalUnitName = v
commonName = z
emailAddress = p@1
X509v3 extensions:
X509v3 Basic Constraints:
CA:FALSE
Netscape Comment:
OpenSSL Generated Certificate
X509v3 Subject Key Identifier:
50:61:5E:EE:38:C3:7D:41:66:C7:68:5F:29:9C:96:1E:C2:67:7C:E3
X509v3 Authority Key Identifier:
keyid:97:6F:59:B9:97:EB:37:BB:89:54:12:7E:A3:72:BE:92:AE:83:2E:5B
Sign the certificate? [y/n]:y
1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated
Loading 'screen' into random state - done
Enter pass phrase for client.key:
Enter Export Password:
Verifying - Enter Export Password:
Loading 'screen' into random state - done
Enter pass phrase for server.key:
Enter Export Password:
Verifying - Enter Export Password:
]]>
一?/span>OpenSSL自签证书铄生成Q?/font>http://www.aygfsteel.com/zhb8015/articles/376402.htmlQ?/font>
证书下蝲cert.rar
二?/span>Tibco bw SSL加密认证?nbsp;http方式的传输实?br /> 程下蝲simple_https01.rar
三?font face="Times New Roman">SSL协议及原理(http://baike.baidu.com/view/16147.htmQ?nbsp;
Usage: tibemsadmin [<arguments>]
where <arguments> are:
-help - print this help screen
-server <server-url> - connect to specified server
-user <user-name> - use this user name to connect to server
-password <password> - use this password to connect to server
-pwdfile <passwd file> - use the password in the specified file
-script <script-file> - execute specified script file and quit
-ignore - ignore errors when executing script file
-mangle [password] - mangle the password and quit. Mangled string
in the output can be set as a value of server
password or server SSL password in the server
configuration file. If the password is not
entered it is prompted for.
SSL parameters (for SSL connection only):
-ssl_trusted <filename> - file containing trusted certificate(s).
This parameter may be entered more than
once if required.
-ssl_identity <filename> - file containing client certificate and
optionally extra issuer certificate(s) and
private key.
-ssl_issuer <filename> - file containing extra issuer certificate(s)
for client-side identity.
-ssl_password <password> - private key or PKCS12 password. If not
specified the password is prompted for
if it is required.
-ssl_pwdfile <pwd file> - use private key or PKCS12 password in this file
-ssl_key <filename> - file containing private key.
-ssl_noverifyhostname - do not verify host name against the name
in the certificate.
-ssl_hostname <name> - name expected in the certificate sent by host.
-ssl_trace - show loaded certificates and certificates
sent by the host.
-ssl_debug_trace - show additional tracing, useful for debugging.
If no trusted certificates were specified in the parameters, then tibemsadmin
will trust any server. If it is not desirable then at least one ssl_trusted
parameter must be specified.
Parameter -script may be combined with -server, -user, -password and -pwdfile.
Parameter -ignore instructs to ignore errors while executing the
script file. This only affects errors in command execution but not
syntax errors in the script.
Examples:
tibemsadmin -script config.scr
tibemsadmin -server "tcp://myhost:7222"
tibemsadmin -server "tcp://myhost:7222" -user admin -password secret
Task A Initializing FTLTask B Defining Callbacks
3. Define callbacks to process advisory messages (as needed), and to handle out-of-band notifications.Task C Sending MessagesPrograms usually call send methods in the context of a data-generation loop, or in the context of message callbacks (or both). (You can use timer callbacks to implement a data-generation loop.)Task D Receiving MessagesTask E Recovery and Clean-Up
11.