Search in sources :

Example 1 with Handshake

use of org.teiid.net.socket.Handshake in project teiid by teiid.

the class SocketClientInstance method onConnection.

public void onConnection() throws CommunicationException {
    Handshake handshake = new Handshake();
    handshake.setAuthType(csr.getAuthenticationType());
    if (usingEncryption) {
        keyGen = new DhKeyGenerator();
        byte[] publicKey;
        try {
            handshake.setPublicKeyLarge(keyGen.createPublicKey(true));
        } catch (CryptoException e) {
        // not supported on this platform
        }
        try {
            publicKey = keyGen.createPublicKey(false);
        } catch (CryptoException e) {
            throw new CommunicationException(RuntimePlugin.Event.TEIID40051, e);
        }
        handshake.setPublicKey(publicKey);
    }
    this.objectSocket.write(handshake);
}
Also used : CommunicationException(org.teiid.net.CommunicationException) DhKeyGenerator(org.teiid.core.crypto.DhKeyGenerator) CryptoException(org.teiid.core.crypto.CryptoException) Handshake(org.teiid.net.socket.Handshake)

Aggregations

CryptoException (org.teiid.core.crypto.CryptoException)1 DhKeyGenerator (org.teiid.core.crypto.DhKeyGenerator)1 CommunicationException (org.teiid.net.CommunicationException)1 Handshake (org.teiid.net.socket.Handshake)1