我们正在编写一个必须使用HTTPS与几台服务器通信的应用程序.
它需要与AWS(使用AWS库)以及使用TLS 1.2的一些内部服务进行通信.
我开始通过更改我的HttpClient来使用TLS 1.2 SSLContext:
public static SchemeRegistry buildSchemeRegistry() throws Exception {
final SSLContext sslContext = SSLContext.getInstance("TLSv1.2");
sslContext.init(createKeyManager(),createTrustManager(),new SecureRandom());
final SchemeRegistry schemeRegistry = new SchemeRegistry();
schemeRegistry.register(new Scheme("https",443,new SSLSocketFactory(sslContext)));
return schemeRegistry;
}
并将此SchemeRegistry注入到DefaultHttpClient对象中(通过spring),但这样做我从AWS获得错误,因此我假设(我可能错了)AWS不支持TLS 1.2(如果我只是,我不会收到此消息使用正常的DefaultHttpClient):
AmazonServiceException: Status Code: 403,AWS Service: AmazonSimpleDB,AWS Request ID: 5d91d65f-7158-91b6-431d-56e1c76a844c,AWS Error Code: InvalidClientTokenId,AWS Error Message: The AWS Access Key