[当我使用SSL协议通过FTP传输数据时,一切正常。我目前正在使用具有特定密码的TLS。我发现Java 8忽略了一些密码。然后我将密码添加到代码中
@Override
protected void _prepareDataSocket_(final Socket socket) throws IOException {
if(socket instanceof SSLSocket) {
String[] ciphers = {
"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384",
"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256",
"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256"
};
((SSLSocket) socket).setEnabledCipherSuites(ciphers);
final SSLSession session = ((SSLSocket) _socket_).getSession();
final SSLSessionContext context = session.getSessionContext();
但是现在在调试模式下,错误显示如前,它会忽略密码。还添加了一个错误:
Cipher Suites: [Unknown 0x2a:0x2a, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, Unknown 0xcc:0xa9, Unknown 0xcc:0xa8, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_GCM_SHA384, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA, SSL_RSA_WITH_3DES_EDE_CBC_SHA] Compression Methods: { 0 } Unsupported extension type_23130, data: Extension renegotiation_info, renegotiated_connection: <empty>
[请告诉我如何正确地将密码添加到套接字,以使密码不再被忽略。我使用javax.net.ssl
请确保您的JDK版本不包含您想要的密码套件。您必须配置一些jce提供程序,例如Buoncycastle,然后您就可以使用它们。