private void receivedHahdshake(Handshake handshake) throws CommunicationException {
String clientVersion = handshake.getVersion();
this.workContext.setClientVersion(Version.getVersion(clientVersion));
if (usingEncryption) {
byte[] returnedPublicKey = handshake.getPublicKey();
byte[] returnedPublicKeyLarge = handshake.getPublicKeyLarge();
boolean large = false;
if (returnedPublicKey == null) {
if (returnedPublicKeyLarge == null) {
throw new CommunicationException(RuntimePlugin.Event.TEIID40052, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40052));
}
large = true;
returnedPublicKey = returnedPublicKeyLarge;
}
if (LogManager.isMessageToBeRecorded(LogConstants.CTX_TRANSPORT, MessageLevel.DETAIL)) {
LogManager.logDetail(LogConstants.CTX_TRANSPORT, large?"2048":"1024", "key exchange being used.");
}
boolean useCbc = handshake.isCbc();
try {
this.cryptor = keyGen.getSymmetricCryptor(returnedPublicKey, "08.03".compareTo(clientVersion) > 0, SocketClientInstance.class.getClassLoader(), large, useCbc);
} catch (CryptoException e) {
throw new CommunicationException(RuntimePlugin.Event.TEIID40053, e);
}
this.keyGen = null;
} else {
this.cryptor = new NullCryptor();
}
}