1 25 package com.mysql.jdbc; 26 27 import java.io.BufferedInputStream ; 28 import java.io.BufferedOutputStream ; 29 import java.io.IOException ; 30 31 39 public class ExportControlled { 40 protected static boolean enabled() { 41 return true; 44 } 45 46 59 protected static void transformSocketToSSLSocket(MysqlIO mysqlIO) 60 throws CommunicationsException { 61 javax.net.ssl.SSLSocketFactory sslFact = (javax.net.ssl.SSLSocketFactory) javax.net.ssl.SSLSocketFactory 62 .getDefault(); 63 64 try { 65 mysqlIO.mysqlConnection = sslFact.createSocket( 66 mysqlIO.mysqlConnection, mysqlIO.host, mysqlIO.port, true); 67 68 ((javax.net.ssl.SSLSocket) mysqlIO.mysqlConnection) 71 .setEnabledProtocols(new String [] { "TLSv1" }); ((javax.net.ssl.SSLSocket) mysqlIO.mysqlConnection) 73 .startHandshake(); 74 75 if (mysqlIO.connection.getUseUnbufferedInput()) { 76 mysqlIO.mysqlInput = mysqlIO.mysqlConnection.getInputStream(); 77 } else { 78 mysqlIO.mysqlInput = new BufferedInputStream ( 79 mysqlIO.mysqlConnection.getInputStream(), 16384); 80 } 81 82 mysqlIO.mysqlOutput = new BufferedOutputStream ( 83 mysqlIO.mysqlConnection.getOutputStream(), 16384); 84 85 mysqlIO.mysqlOutput.flush(); 86 } catch (IOException ioEx) { 87 throw new CommunicationsException(mysqlIO.connection, 88 mysqlIO.lastPacketSentTimeMs, ioEx); 89 } 90 } 91 92 private ExportControlled() { 93 } 94 } | Popular Tags |