貝寶已更新其沙盒API端點和證書,以使用sha256而不是sha1。 要遷移我的應用程序(它連接到貝寶快速結賬)使用SHA256,貝寶證書升級到sha256
一)刪除,並從我的PayPal帳戶下載新的證書,並轉換 它的.p12格式 使用OpenSSL證實,該證書是使用sha256withRsa
b)中確認了/etc/ssl/certs/ca-certs.crt由具有威瑞G5 CA證書作爲從我的Java代碼中的鏈接 https://gist.github.com/robglas/3ef9582c6292470a1743
仍然無法連接到貝寶沙箱給定它使用HttpClient。握手
期間未能在Java代碼中 - 使用SSLContext.getInstance( 「SSL」)
使用自定義信任庫
Class CustomTrustManager implements X509TrustManager {
public boolean checkClientTrusted(java.security.cert.X509Certificate[] chain) {
return true;
}
public boolean isServerTrusted(java.security.cert.X509Certificate[] chain) {
return true;
}
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return null;
}
public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) {
}
public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) {
}
}
我使用實例SunX509的的KeyManagerFactory和將其初始化爲pkcs12密鑰庫。
我錯過了什麼。請幫忙!
你不需要一個自定義的TrustManager,而且這個並不是什麼好事,但是你經常會看到它發佈爲'解決方案'。不要使用此代碼。 'getAcceptedIssuers()'不能返回null,並且整個事情都是100%不安全的。你也可以使用明文。 – EJP