import mkgray.security.dh.*;
import Acme.Crypto.*;

public class Test {
  public static void main(String args[]){
    DiffieHellmanChannel atob = new mkgray.security.dh.DiffieHellmanChannel();
    DiffieHellmanChannel btoa = new mkgray.security.dh.DiffieHellmanChannel();
    atob.generateKeyPair(128);
    btoa.generateKeyPair(128);
    atob.generateSharedKey(btoa.publicKey);
    btoa.generateSharedKey(atob.publicKey);
    atob.setCipher(new IdeaCipher(atob.sharedKey.toByteArray()));
    btoa.setCipher(new IdeaCipher(btoa.sharedKey.toByteArray()));
    System.out.println("Beggining encryption");
    String encrypted = atob.encrypt("This is a test of how well this works");
    String decrypted = btoa.decrypt(encrypted);
    System.out.println("Did it work?\n"+decrypted);
  }
}
