mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-25 13:32:07 +01:00
Fix XMPPTCPConnection.setEnabledSSL(Protocols|Ciphers)
The problem caused by opening input/ output stream before setting ssl parameters to SSLSession and fixed by changing order of this operations. Fixes SMACK-712. Minor-Modifications-By: Florian Schmaus <flo@geekplace.eu>
This commit is contained in:
parent
bcdfb5398a
commit
cf3024668e
1 changed files with 6 additions and 2 deletions
|
@ -751,12 +751,16 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
|
||||||
// Secure the plain connection
|
// Secure the plain connection
|
||||||
socket = context.getSocketFactory().createSocket(plain,
|
socket = context.getSocketFactory().createSocket(plain,
|
||||||
host, plain.getPort(), true);
|
host, plain.getPort(), true);
|
||||||
// Initialize the reader and writer with the new secured version
|
|
||||||
initReaderAndWriter();
|
|
||||||
|
|
||||||
final SSLSocket sslSocket = (SSLSocket) socket;
|
final SSLSocket sslSocket = (SSLSocket) socket;
|
||||||
|
// Immediately set the enabled SSL protocols and ciphers. See SMACK-712 why this is
|
||||||
|
// important (at least on certain platforms) and it seems to be a good idea anyways to
|
||||||
|
// prevent an accidental implicit handshake.
|
||||||
TLSUtils.setEnabledProtocolsAndCiphers(sslSocket, config.getEnabledSSLProtocols(), config.getEnabledSSLCiphers());
|
TLSUtils.setEnabledProtocolsAndCiphers(sslSocket, config.getEnabledSSLProtocols(), config.getEnabledSSLCiphers());
|
||||||
|
|
||||||
|
// Initialize the reader and writer with the new secured version
|
||||||
|
initReaderAndWriter();
|
||||||
|
|
||||||
// Proceed to do the handshake
|
// Proceed to do the handshake
|
||||||
sslSocket.startHandshake();
|
sslSocket.startHandshake();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue