Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSL and Amazon AWS java SDK

i have a problem with my application: i must integrate a request to Amazon EC2 in a flow that use an own SSL connection. So to launch my application i must use this command:

java -cp . -Djavax.net.ssl.keyStore=config/serverkeys -Djavax.net.ssl.keyStorePassword=mypass -Djavax.net.ssl.trustStore=config/serverkeys -Djavax.net.ssl.trustStorePassword=mypass -jar app.jar

but Amazon EC2 answer with : Unable to execute HTTP request: peer not authenticated

If i remove the trusstore part, so i use only java -cp . -Djavax.net.ssl.keyStore=config/serverkeys -Djavax.net.ssl.keyStorePassword=mypass, everything goes well. It seems that i need an Amazon EC2 certificate in my trusstore...

Anyone has good idea about this? Thanks, Sorry for my english

like image 802
Max Avatar asked May 23 '26 19:05

Max


1 Answers

You shouldn't use the same file for both keystore and truststore. You need a private key and a certificate that Amazon will trust in your keystore. Your truststore contains public certificates that you trust, i.e. Amazon's in this case, and this is what you presently don't have, hence the error. If the SSL server uses a CA-signed certificate, you don't need your own truststore at all, the default one that comes with the JRE will do.

like image 129
user207421 Avatar answered May 25 '26 08:05

user207421



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!