JAVA Web服务证书配置

JAVA Webservice certificate Configuration

我对为网络服务配置证书还很陌生。目前我使用 weblogic serverJROCKET Jre。我正在尝试调用外部网络服务。为此,我在 jre/lib/security cacerts 文件中添加了所有提供的证书。我最终收到错误消息 -

"The loading of the trusted certificate list raised a certificate parsing exception PKIX: Unsupported OID in the AlgorithmIdentifier object: 1.2.840.113549.1.1.11".

请帮助我。

The loading of the trusted certificate list raised a certificate parsing exception PKIX: Unsupported OID in the AlgorithmIdentifier object: 1.2.840.113549.1.1.11

这看起来很奇怪,许多人忽略了这些错误消息。但是,如果您的策略是只显示真实的错误消息,那么您正在快速寻找解决方案。互联网上充满了可能的解决方案。有些人建议从 JDK 信任库中删除证书,有些人建议使用不同的信任库。但这是最好的解决方案吗?副作用是什么?

主要文章

我们的解决方案从理解错误消息开始。又来了。

Ignoring the trusted CA certificate “CN=Entrust Root Certification Authority – G2,OU=(c) 2009 Entrust, Inc. – for authorized use only,OU=See www.entrust.net/legal-terms,O=Entrust, Inc.,C=US”. The loading of the trusted certificate list raised a certificate parsing exception PKIX: Unsupported OID in the AlgorithmIdentifier object: 1.2.840.113549.1.1.11.

第一句是结果,第二句说明原因。查看原因,我们很快就找到了“证书解析异常”。但是 “PKIX: Unsupported OID in the AlgorithmIdentifier object: 1.2.840.113549.1.1.11” 告诉我们什么?

  • PKIX 代表 Public 密钥基础设施 (X.509)。 X.509 是 用于导出、交换和导入 SSL 证书的标准。
  • OID 代表对象标识符。对象标识符是全局的 独特且按层次结构组织。此层次结构由维护 每个国家的标准机构。每个标准机构都是 负责特定分支并可以定义和分配条目 进入层次结构。

根据这些背景信息,我们可以在 OID 存储库中查找数字 1.2.840.113549.1.1.11(请参阅 link 的参考资料)并获得此结果“iso(1) member-body(2 ) us(840) rsadsi(113549) pkcs(1) pkcs-1(1) sha256WithRSAEncryption(11)“.

结合第一句中的证书信息和 OID 查找的信息,我们得到以下结果:

The certificate from CN=Entrust Root Certification Authority – G2,OU=(c) 2009 Entrust, Inc. – for authorized use only,OU=See www.entrust.net/legal-terms,O=Entrust, Inc.,C=US uses SHA256WithRSAEncryption which is not supported by the JDK!

您可能会看到更多关于其他证书中使用的类似或不同加密算法的消息。

根本原因

这些因素导致此(和类似)错误消息:

  1. 默认情况下 Java 加密扩展 (JCE),随附 JDK,只实施有限强度的管辖政策 文件。
  2. JDK 的默认信任库,保存这个和其他 证书可以在 JAVA_HOME/jre/lib/security/cacerts.
  3. 中找到
  4. 12c 之前的 WebLogic Server 版本附带 Certicom SSL 执行。 Certicom 实施不会更新 因为所需的 JDK 已经包含在标准的 SunJSSE 中 实施。

问题

Certicom 实施与许多 SSL 证书完美配合,但不支持更新和更强大的算法。仅当您不需要安装第三方证书(例如来自知名证书颁发机构的证书)时,才可以从默认信任库中删除证书或使用新的信任库。

解决方案

要删除这些错误消息并支持更新的 SSL 证书,我们必须执行以下步骤:

  1. 使用 Java 加密技术升级管辖政策文件 扩展 (JCE) 无限强度管辖策略文件。你 可以下载适合的 Unlimites Strength Jurisdication 文件 来自 Oracle 技术网的 JDK 版本(请参阅 参考)。按照随附的安装说明进行操作 分布.
  2. 在 WebLogic Server 中启用 SunJSSE 支持

     - Login to Weblogic console
     - Go to [Select your Server] -> SSL -> Advance 
     - Set “Enable JSSE” to true.
    
  3. 完全重新启动您的域(包括 NodeManager)

如果您使用 WLST 脚本启动域:

        CONFIG_JVM_ARGS='-Dweblogic.ssl.JSSEEnabled=true -Dweblogic.security.SSL.enableJSSE=true'

如果您的域使用脚本 startWebLogic.sh、startManagedServer.sh 或 startNodeManager.sh:

        JAVA_OPTIONS='-Dweblogic.ssl.JSSEEnabled=true -Dweblogic.security.SSL.enableJSSE=true'

您的 Java 和 WebLogic 环境现在可以支持更新的 SSL 证书了!

资源Link:

  1. Improve SSL Support for Your WebLogic Domains by Olaf Heimburger
  2. Improve SSL Support for Your WebLogic Domains