public static void generateKeyPair(boolean overwrite) {
		if ((pubK == null && privK == null) || overwrite == true) {
			BigInteger paramBigInteger1 = g512;
			BigInteger paramBigInteger2 = p512;
			int paramInt2 = 0;

			System.out.println("length of keys " + g512.bitLength() + " " + p512.bitLength());

			// Elgamal magic
			ElGamalParameters localElGamalParameters = new ElGamalParameters(paramBigInteger2, paramBigInteger1, paramInt2);
			ElGamalKeyGenerationParameters localElGamalKeyGenerationParameters = new ElGamalKeyGenerationParameters(new SecureRandom(), localElGamalParameters);
			ElGamalKeyPairGenerator localElGamalKeyPairGenerator = new ElGamalKeyPairGenerator();
			localElGamalKeyPairGenerator.init(localElGamalKeyGenerationParameters);
			AsymmetricCipherKeyPair localAsymmetricCipherKeyPair = localElGamalKeyPairGenerator.generateKeyPair();

			// Get the two keys
			ElGamalPublicKeyParameters localElGamalPublicKeyParameters = (ElGamalPublicKeyParameters) localAsymmetricCipherKeyPair.getPublic();
			ElGamalPrivateKeyParameters localElGamalPrivateKeyParameters = (ElGamalPrivateKeyParameters) localAsymmetricCipherKeyPair.getPrivate();

			pubK = localElGamalPublicKeyParameters;
			privK = localElGamalPrivateKeyParameters;
		}
	}