2017-11-02 4 views
2

JDBCとAWS RDSの間にSSL接続を確立しようとしています。ここで私は、次のコマンドを使用してキーストアを作成しました:MySQL RDSとJDBC SSL接続エラー:要求されたターゲットへの有効な証明書パスを見つけることができません

# convert certificate into java understandable format 
openssl x509 -outform der -in rds-combined-ca-bundle.pem -out rds-combined-ca-bundle.der 
# importing the certificate to keystore 
sudo keytool -keystore keystore -alias rds_postgresql -import -file rds-combined-ca-bundle.der 

そしてアプリケーションに直接

System.setProperty("javax.net.ssl.keyStore", "/path/of/the/keystore"); 
System.setProperty("javax.net.ssl.keyStorePassword", "******"); 

をキーストアとキーストアパスワードの値を設定する。しかし、すべてのこれらの設定を追加した後、私はエラー次取得しています

Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target 
    at sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:141) ~[?:1.8.0_131] 
    at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:126) ~[?:1.8.0_131] 
    at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:280) ~[?:1.8.0_131] 
    at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:382) ~[?:1.8.0_131] 
    at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:292) ~[?:1.8.0_131] 
    at sun.security.validator.Validator.validate(Validator.java:260) ~[?:1.8.0_131] 

ここで何が間違っていますか?

私はセットアップSSLにこのチュートリアルに従っ:

https://dev.mysql.com/doc/connector-j/5.1/en/connector-j-reference-using-ssl.html

+0

これが役立つかどうか確認してください。 http://www.mkyong.com/webservices/jax-ws/suncertpathbuilderexception-unable-to-find-valid-certification-path-to-requested-target/ –

+0

それは私の問題を解決するかもしれないが、IMHOは良い解決策になります。私は根本的な原因が私を助けるかもしれないと思う。 – pulkit

答えて

0

rds-combined-ca-bundle.pemは、証明書の束を含んでいるので、我々はそれらを分割し、すべての証明書について.pemファイルを作成し、個別にkeystoreにそれらをインポートする場合、それは動作します。

この問題は、rds証明書バンドル全体をキーストアにインポートするために発生します。

関連する問題