0

Websphere Application Server から https 経由でホストされている Web サービスにアクセスしたいと考えています。次の方法で https 接続を確立しています。

  HttpsURLConnection connection= (HttpsURLConnection) new URL(wcfUrl).openConnection();
  connection.setDoOutput(true);
  connection.setDoInput(true);
  connection.setAllowUserInteraction(false);
  connection.setInstanceFollowRedirects(false);
  connection.setRequestMethod("POST");
  connection.setRequestProperty("foo",userId );
  connection.setRequestProperty("bar", pwd);
  connection.setRequestProperty("Content-Type","application/xml");
  connection.connect(); 

このコードを実行しようとすると、次のエラーが発生します * com.ibm.jsse2.util.g: PKIX path building failed: java.security.cert.CertPathBuilderException: PKIXCertPathBuilderImpl could not build a valid CertPath.; 内部原因: java.security.cert.CertPathValidatorException: CN=GlobalSign ルート CA、OU=ルート CA、O=GlobalSign nv-sa、C=BE によって発行された証明書は信頼されていません。内部原因: java.security.cert.CertPathValidatorException: 証明書チェーン エラー * 署名者証明書をローカル サーバーにインポートした後 (このリンクhttp://pic.dhe.ibm.com/infocenter/wasinfo/v7r0/で説明されているように) index.jsp?topic=%2Fcom.ibm.websphere.base.doc%2Finfo%2Faes%2Fae%2Ftsec_sslretrievesignersport.html) リモート サーバー (https 経由でサービスが展開されている場所) に接続できました。署名者証明書をインポートせずに、Java コードを使用して同じことを行うことはできますか?

4

1 に答える 1

1

あなたはそうしない。セキュリティを検証しようとしている接続を介して、接続のセキュリティを検証するように設計されたデータをインポートすることはできません。意味がありません。証明書はオフラインでインポートする必要があります。そうしないと、セキュリティ違反が発生するだけです。

于 2013-05-07T10:14:50.390 に答える