Server:
TLS Version: v1.2
Cipher Suite: TLS_RSA_WITH_AES_256_CBC_SHA256
Client:
JRE 1.7
sto ricevendo l'errore sotto quando provo a connettersi al server dal client tramite SSL direttamente:Abilita TLSv1.2 e TLS_RSA_WITH_AES_256_CBC_SHA256 Cipher Suite
Caused by: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
at sun.security.ssl.Alerts.getSSLException(Alerts.java:154)
Il codice di seguito consente TLSv1.2
Set<String> enabledTLSSet = new HashSet<String>(Arrays.asList(sslsocket.getEnabledProtocols()));
enabledTLSSet.add("TLSv1.2");
sslsocket.setEnabledProtocols(enabledTLSSet.toArray(new String[enabledTLSSet.size()]));
Il codice di seguito consente TLS_RSA_WITH_AES_256_CBC_SHA256 Cipher Suite:
Set<String> enabledCipherSuitesSet = new HashSet<String>(Arrays.asList(sslsocket.getEnabledCipherSuites()));
enabledCipherSuitesSet.add("TLS_RSA_WITH_AES_256_CBC_SHA256");
sslsocket.setEnabledCipherSuites(enabledCipherSuitesSet.toArray(new String[enabledCipherSuitesSet.size()]));
Dopo aver eseguito entrambi i suddetti dal codice Java, sono in grado di connettersi al server correttamente tramite SSL.
E 'possibile abilitare/forzare TLSv1.2
e TLS_RSA_WITH_AES_256_CBC_SHA256
in Java 7 senza modificare alcun codice Java tramite proprietà, parametri o oggetti di debug?
Ho provato tutte le proprietà sottostanti in tutte le forme e combinazioni (abilitazione e disabilitazione) e non riuscito.
-Dhttps.protocols=TLSv1.2
-Dhttps.cipherSuites=TLS_RSA_WITH_AES_256_CBC_SHA256
-Ddeployment.security.TLSv1.2=true
sto eseguendo il programma simile a quello qui sotto:
java -jar -Dhttps.protocols=TLSv1.2 -Dhttps.cipherSuites=TLS_RSA_WITH_AES_256_CBC_SHA256 Ddeployment.security.TLSv1.2=true -Djavax.net.debug=ssl:handshake SSLPoker.jar <SERVER> 443
SSLPoker contiene il codice qui sotto:
package com.ashok.ssl;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import java.io.*;
/**
* Establish a SSL connection to a host and port, writes a byte and prints the response - Ashok Goli. See
* http://confluence.atlassian.com/display/JIRA/Connecting+to+SSL+services
*/
public class SSLPoke {
/**
* The main method.
* Usage: $java -jar SSLPoker.jar <host> <port>
*
* @param args the arguments
*/
public static void main(String[] args) {
if (args.length != 2) {
System.out.println("Usage: " + SSLPoke.class.getName() + " <host> <port>");
System.exit(1);
}
try {
SSLSocketFactory sslsocketfactory = (SSLSocketFactory) SSLSocketFactory.getDefault();
SSLSocket sslsocket =
(SSLSocket) sslsocketfactory.createSocket(args[0], Integer.parseInt(args[1]));
InputStream in = sslsocket.getInputStream();
OutputStream out = sslsocket.getOutputStream();
// Write a test byte to get a reaction :)
out.write(1);
while (in.available() > 0) {
System.out.print(in.read());
}
System.out.println("Successfully connected");
} catch (Exception exception) {
exception.printStackTrace();
}
}
}
Tutti gli indicatori come raggiungere questo obiettivo senza modifiche al codice Java sarebbe essere molto apprezzato
Non è possibile aggiungere suite di crittografia TLS senza aggiungere un intero fornitore di sicurezza, come Bouncy Castle, che in effetti potrebbe supportare quello. – EJP
Quali sono le impostazioni con le quali ho bisogno di giocare per raggiungere questo obiettivo? –
Ho aggiunto TLS e connesso correttamente al server con il codice sopra. Sto solo cercando un modo per farlo tramite la configurazione. –