src/com/frohno/pseudossl/PseudoSSLServer.java
/**
     * Initializes the connection, setting up an AES key, by way of a similar-to SSL protocol
     * @return false upon error
     */
Initializes the connection, setting up an AES key, by way of a similar-to SSL protocol
@return false upon error
Initializes the connection setting up an AES key by way of a similar - to SSL protocol @return false upon error
private boolean initialize() {
        try {
            PublicKey clientPublicKey = (PublicKey) inputStream.readObject();
            outputStream.writeObject(rSAEncrypter.encrypt(clientPublicKey, ObjectParser.toByteArray(ip)));
            outputStream.writeObject(rSAEncrypter.getPubKey());
            outputStream.flush();
            InetAddress ipClient = (InetAddress) ObjectParser.toObject(rSAEncrypter.decrypt(rSAEncrypter.getPrivateKey(), (byte[]) inputStream.readObject()));
            if (!ipClient.getHostAddress().equals(socket.getInetAddress().getHostAddress())) {
                System.out.println(ipClient.getHostAddress());
                System.out.println(socket.getInetAddress().getHostAddress());
                throw new IllegalAccessException();
            }
            aESecretKey = (SecretKey) ObjectParser.toObject(rSAEncrypter.decrypt(rSAEncrypter.getPrivateKey(), (byte[]) inputStream.readObject()));
            iv = (byte[]) ObjectParser.toObject(rSAEncrypter.decrypt(rSAEncrypter.getPrivateKey(), (byte[]) inputStream.readObject()));
            outputStream.writeObject(AESEncrypter.encrypt(aESecretKey, ObjectParser.toByteArray(ip), iv));
            return true;
        } catch (Exception e) {
            return false;
        }
    }
private boolean initialize ( ) { try { PublicKey clientPublicKey = ( PublicKey ) inputStream . readObject ( ) ; outputStream . writeObject ( rSAEncrypter . encrypt ( clientPublicKey , ObjectParser . toByteArray ( ip ) ) ) ; outputStream . writeObject ( rSAEncrypter . getPubKey ( ) ) ; outputStream . flush ( ) ; InetAddress ipClient = ( InetAddress ) ObjectParser . toObject ( rSAEncrypter . decrypt ( rSAEncrypter . getPrivateKey ( ) , ( byte [ ] ) inputStream . readObject ( ) ) ) ; if ( ! ipClient . getHostAddress ( ) . equals ( socket . getInetAddress ( ) . getHostAddress ( ) ) ) { System . out . println ( ipClient . getHostAddress ( ) ) ; System . out . println ( socket . getInetAddress ( ) . getHostAddress ( ) ) ; throw new IllegalAccessException ( ) ; } aESecretKey = ( SecretKey ) ObjectParser . toObject ( rSAEncrypter . decrypt ( rSAEncrypter . getPrivateKey ( ) , ( byte [ ] ) inputStream . readObject ( ) ) ) ; iv = ( byte [ ] ) ObjectParser . toObject ( rSAEncrypter . decrypt ( rSAEncrypter . getPrivateKey ( ) , ( byte [ ] ) inputStream . readObject ( ) ) ) ; outputStream . writeObject ( AESEncrypter . encrypt ( aESecretKey , ObjectParser . toByteArray ( ip ) , iv ) ) ; return true ; } catch ( Exception e ) { return false ; } }
Initializes the connection, setting up an AES key, by way of a similar-to SSL protocol
 @return false upon error
Initializes the connection setting up an AES key by way of a similar - to SSL protocol @return false upon error
//Recieve Client Public Key
 //Send Responce
 //outputStream.flush();
 //Sending Public Key
 //Recieve Response
 //Recieve AES Secret Key
 //Send Responce
