Ruby on rails 3.1 特立尼达的OpenSSL密钥库生成

Ruby on rails 3.1 特立尼达的OpenSSL密钥库生成,ruby-on-rails-3.1,https,openssl,keystore,trinidad,Ruby On Rails 3.1,Https,Openssl,Keystore,Trinidad,我正在尝试使用openSSL为我的应用程序设置https连接。我正在运行一个Neo4j1.2.2数据库,带有Trinidad1.3.5Web服务器,使用Rails3.1和Ruby1.9 我有一个Thawte试用证书ca_cert.crt,它们的中间证书和根证书ca_intermediate.crt和ca_root.crt,以及我自己的私钥ca_private.pem。我需要运行什么openssl命令来创建密钥库,我可以在我的应用程序的trinidad.yaml配置文件中指定密钥库 到目前为止,我

我正在尝试使用openSSL为我的应用程序设置https连接。我正在运行一个Neo4j1.2.2数据库,带有Trinidad1.3.5Web服务器,使用Rails3.1和Ruby1.9

我有一个Thawte试用证书ca_cert.crt,它们的中间证书和根证书ca_intermediate.crt和ca_root.crt,以及我自己的私钥ca_private.pem。我需要运行什么openssl命令来创建密钥库,我可以在我的应用程序的trinidad.yaml配置文件中指定密钥库

到目前为止,我尝试过的“看起来最接近正确”的方法是:

pkcs12 –export –in ca_cert.crt inkey ca_private.pem –out keystore.p12 –name tomcat
这给了我一个错误:

unable to load certificates
6380:error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag:.\crypto\as
n1\tasn_dec.c:1319:
6380:error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error:.\
crypto\asn1\tasn_dec.c:381:Type=X509_CINF
6380:error:0D08303A:asn1 encoding routines:ASN1_TEMPLATE_NOEXP_D2I:nested asn1 e
rror:.\crypto\asn1\tasn_dec.c:751:Field=cert_info, Type=X509
6380:error:0907400D:PEM routines:PEM_X509_INFO_read_bio:ASN1 lib:.\crypto\pem\pe
m_info.c:258:
error in pkcs12
在我看来,openssl不喜欢我的文件格式,尽管我尝试了几乎所有我能想到的.pem、.crt、.cer和.key扩展的组合,但都没有用。我对SSL完全是新手,所以我希望我只是在做一些愚蠢的事情,这是一个简单的解决办法

下面是我一直试图遵循的示例:

从中可以看出,解冻证书的格式为PKCS#7,而
openssl pkcs12-export
命令。PKCS#7中的证书可以使用先前链接的答案中的修改版本的命令进行转换

$ openssl pkcs7 -in ca_cert.crt -print_certs | openssl x509 -outform PEM > ca_cert.pem
然后执行您提供的命令,创建PKCS#12密钥库

$ openssl pkcs12 –export –in ca_cert.pem -inkey ca_private.pem –out keystore.p12 –name tomcat

非常感谢你!这正是问题所在。我必须将我的ca_cert.pem文件保存为ca_cert.p7b,然后使用“openssl pkcs7-print_certs-in ca_cert.p7b-out ca_cert.pem”进行转换。一旦它被转换,我正在尝试的命令工作得非常好!