authentication - 创建服务器证书时出错 - 在 IBM Worklight 6.2 中基于 X509 证书的身份验证

标签 authentication ssl ibm-mobilefirst

我正在 IBM Worklight 6.2 中开发一个针对 Android 和 IOS 的项目。我的项目应该使用基于 X509 证书的身份验证。我正在使用 Windows 7 操作系统,并按照此 PDF 转到

  1. 创建根 CA
  2. 创建签名 CA
  3. 创建服务器证书
  4. 为服务器证书创建证书链
  5. 为签名 CA 导出 PKCS12 文件
  6. 导出服务器证书的 PKCS12 文件

我在 windows 中安装了 openssl-0.9.8h-1-setup,所以我在 C:\Program Files (x86)\GnuWin32\share 中得到了 openssl.cnf。借助此配置文件,我已成功创建根 CA。接下来,当我尝试签署 Signing CA 时,它会抛出消息。命令和消息如下:

openssl ca -in signingca\signing_ca.csr -out signingca\signing_ca.crt -keyfile rootca\root_ca_key.pem -cert rootca\root_ca.crt -config openssl.cnf -name root_authority_ca_config -extensions signing_authority -md sha512 -days 365 -passin pass:passRoot

Using configuration from openssl.cnf
Check that the request matches the signature
Signature ok
The Subject's Distinguished Name is as follows
commonName            :PRINTABLE:'Development Signing CA'
The mandatory countryName field was missing

通过此消息,它创建了签名 CA 的标志。

接下来,我将尝试创建服务器证书,其中会显示错误消息。代码和报错信息如下:

#REM Sign the CSR with the signing CA
openssl ca -in server\server.csr -out server\server.crt -keyfile signingca\signing_ca_key.pem -cert signingca\signing_ca.crt -config openssl.cnf -name signing_authority_ca_config -extensions server_identity -md sha512 -days 365 -passin pass:passSigning

它抛出以下消息,并且无法签署服务器 CA。

Using configuration from openssl.cnf
unable to load certificate
4716:error:0906D06C:PEM routines:PEM_read_bio:no start line:pem_lib.c:647:Expecting:
TRUSTED CERTIFICATE

我需要知道如何解决这个问题!

最佳答案

出现第二个错误是因为根 CA 证书未能正确生成,所以它说它无法为其找到受信任的证书,所以在您修复第一个错误后,其他的应该可以工作。

第一个错误的发生是因为您的 openssl.cnf 文件中缺少某些内容。在您的配置中,您必须指定哪些字段对您来说是可选的,哪些是必需的。 As shown in slide 18 in the User Certificate Authentication Getting started guide ,您在 policy_match 部分中指定每一个,如下所示:

[ policy_match ]
countryName = optional
stateOrProvinceName = optional
localityName = optional
organizationName = optional
organizationalUnitName = optional
commonName = supplied
emailAddress = optional

确保将每张单独幻灯片中指定的所有配置选项添加到您的 openssl.cnf,或者使用已提供所有配置的示例项目中提供的 openssl.cnf。

关于authentication - 创建服务器证书时出错 - 在 IBM Worklight 6.2 中基于 X509 证书的身份验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24647800/

相关文章:

web-services - Wcf 服务引发异常 : Could not establish trust relationship for the SSL/TLS secure channel with authority

Git 卡在 POST git-receive-pack 上

java - SSL VPN 连接到使用 Java 的 Fortinet 防火墙

iOS Worklight 推送通知处理

ibm-mobilefirst - WL.JSONStore.push 不执行任何操作

ruby-on-rails-3 - 使用 before_filter 检查管理员或用户是否已登录

java - Java 客户端如何使用 native Windows-MY 存储在 SSL 握手期间按要求提供其客户端证书?

android - Worklight - WL.Device.Geo.acquirePosition 或 navigator.geolocation?

php - Symfony2 中的多个动态防火墙和 CAS 服务器

asp.net - 跨 MVC 5 和 ASP.NET Core 应用程序的基于 Cookie 的表单例份验证