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

时间:2014-07-09 07:34:05

标签: authentication ssl ibm-mobilefirst

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

  1. 创建根CA
  2. 创建签名CA
  3. 创建服务器证书
  4. 为服务器证书创建证书链
  5. 导出签名CA的PKCS12文件
  6. 导出服务器证书的PKCS12文件
  7. 我在windows中安装了openssl-0.9.8h-1-setup,所以我在C:\ Program Files(x86)\ GnuWin32 \ share中获得了openssl.cnf。在此配置文件的帮助下,我已成功创建了Root CA.接下来当我尝试签署签名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
    

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

1 个答案:

答案 0 :(得分:4)

出现第二个错误是因为无法正确生成根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,该项目已包含所有配置。