使用 Orbeon Forms,为什么我使用自签名证书向服务器提交失败?

发布于 2024-09-28 15:41:37 字数 698 浏览 1 评论 0原文

当通过 HTTPS 对使用自签名证书的服务器运行提交 () 时,我在日志中收到如下所示的异常:

ERROR XFormsServer  - XForms - submission - xforms-submit-error throwable: sun.security.provider.certpath.SunCertPathBuilderException 
: unable to find valid certification path to requested target 
        at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:174) 
        at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:238) 
        at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:280) 
        at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:191) 

如何解决此问题?

When running submissions (<xforms:submission>) over HTTPS against a server that use a self-signed certificate, I am getting an exception in the logs that looks like:

ERROR XFormsServer  - XForms - submission - xforms-submit-error throwable: sun.security.provider.certpath.SunCertPathBuilderException 
: unable to find valid certification path to requested target 
        at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:174) 
        at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:238) 
        at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:280) 
        at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:191) 

How can I solve this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

爱本泡沫多脆弱 2024-10-05 15:41:37

当发出 HTTPS 请求时,Java 会检查服务器的证书。由于证书是自签名的,Java 无法验证它是否是合法证书,因此会出现错误消息“无法找到请求目标的有效证书路径”。

您需要做的是:

  1. 使用“真实”证书(例如由 Verisign 签名)。
  2. 将服务器的证书添加到“信任存储”,并使用该信任存储设置应用程序服务器的 JVM。

执行上述第 2 步的具体步骤取决于您的环境,但本质上是:

  1. 如果处理请求的服务器在 Java 密钥存储中拥有其自签名密钥,请将其导出。这里 your-server 是您的服务器密钥存储的别名,mykey.cer 是您正在创建的文件,keystore 是您的密钥存储文件,your-password 是您的密钥存储的密码。

    keytool -export -alias your-server -file mykey.cer -keystore keystore -storepass your-password

  2. 在运行 Orbeon Forms 的服务器上(即发起 HTTPS 请求的服务器) ,将 mykey.cer 导入信任存储区。这里的 truststore 是您的信任存储文件,如果您没有现有的信任存储,它可能是您正在创建的新文件。

    keytool -import -v -trustcacerts -alias your-server -file mykey.cer -keystore truststore -storepass your-password

  3. 启动时添加以下-D参数运行应用程序服务器(例如 Tomcat)和 Orbeon Forms 的 VM:

    -Djavax.net.ssl.trustStore=path/to/your/truststore -Djavax.net.ssl.trustStorePassword=your-password

When making the HTTPS request, Java checks the certificate of the server. Because the certificate is self-signed, Java can't verify it is a legitimate certificate, hence the error message "unable to find valid certification path to requested target".

What you need to do is either:

  1. Use a "real" certificate (e.g. signed by Verisign).
  2. Add the certificate of your server to a "trust store", and setup your JVM of application server use that trust store.

The exact steps for doing #2 above will depend on your environment, but in essence:

  1. If the server handling the requests has its self-signed key in a Java key store, export it. Here your-server is the alias for your server the key store, mykey.cer is the file you are creating, keystore is your key store file, and your-password is the password to your key store.

    keytool -export -alias your-server -file mykey.cer -keystore keystore -storepass your-password

  2. On the server on which Orbeon Forms is running (i.e. the server that initiates the HTTPS request), import mykey.cer into a trust store. Here truststore is your trust store file, which might be a new file you are creating if you don't have an existing trust store.

    keytool -import -v -trustcacerts -alias your-server -file mykey.cer -keystore truststore -storepass your-password

  3. Add the following -D parameters when starting the VM that runs your application server (e.g. Tomcat) and Orbeon Forms:

    -Djavax.net.ssl.trustStore=path/to/your/truststore -Djavax.net.ssl.trustStorePassword=your-password

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文