/**
 * Project ElGamal Algorithm.
 * Copyright Michał Szczygieł.
 * Created at Mar 19, 2014.
 */
package com.m4gik;

import java.math.BigInteger;
import java.security.SecureRandom;
import java.util.Random;

/**
 * This class represents implementation of ElGamal algorithm. This class contain
 * operations to sign and verify documents.
 * 
 * @author Michał Szczygieł <michal.szczygiel@wp.pl>
 * 
 */
public class ElGamal {

    /**
     * The object to code/decode public key.
     */
    private BigInteger alpha;

    /**
     * The filed to keep probable prime value.
     */
    private BigInteger p;

    /**
     * The variable keeping the public key.
     */
    private BigInteger publicKey;

    /**
     * The variable keeping the private key.
     */
    private BigInteger secretKey;

    /**
     * The random instance for generating secure random values.
     */
    private Random secureRandom = new SecureRandom();

    /**
     * The constructor for {@link ElGamal} class, which creates the instance.
     * 
     * @param secretKey
     *            The private key.
     */
    public ElGamal(String secretKey) {
        setPrivateKey(secretKey);
        generatePublicKey(this.secretKey);

    }

    /**
     * This method generates public key from private key.
     * 
     * @param secretKey
     */
    private void generatePublicKey(BigInteger secretKey) {
        this.p = BigInteger.probablePrime(64, this.secureRandom);
        this.alpha = new BigInteger(Integer.toString(secureRandom.nextInt()));
        this.publicKey = alpha.modPow(secretKey, p);
    }

    /**
     * @param secretKey
     */
    private void setPrivateKey(String secretKey) {
        this.secretKey = new BigInteger(secretKey);
    }

    /**
     * 
     * @return
     */
    public Boolean sign(String message) {
        // TODO Auto-generated method stub
        return null;
    }

    /**
     * 
     * @return
     */
    public Boolean verify() {
        // TODO Auto-generated method stub
        return null;
    }

}

@@ -418,16 +418,114 @@
 amal %7B%0A%0A
+    /**%0A     * The length for ElGamal key.%0A     */%0A    private static final int KEY_LENGTH = 64;%0A%0A
     /**%0A
@@ -1516,18 +1516,26 @@
 lePrime(
-64
+KEY_LENGTH
 , this.s
@@ -1691,24 +1691,73 @@
  %7D%0A%0A    /**%0A
+     * This method sets the private key.%0A     * %0A
      * @para
@@ -1937,22 +1937,25 @@
 public B
-oolean
+igInteger
  sign(St
@@ -1982,86 +1982,625 @@
     
-// TODO Auto-generated method stub%0A        return null;%0A    %7D%0A%0A    /**%0A     * 
+BigInteger messageToEncrypt = new BigInteger(message, 16);%0A        BigInteger k = new BigInteger(KEY_LENGTH, this.secureRandom);%0A%0A        while (this.p.subtract(BigInteger.ONE).gcd(k).intValue() != 1) %7B%0A            k = new BigInteger(KEY_LENGTH, this.secureRandom);%0A        %7D%0A%0A        BigInteger r = this.alpha.modPow(k, this.p);%0A        BigInteger encryptedMessage = (messageToEncrypt.subtract(this.secretKey%0A                .multiply(r))).multiply(k.modInverse(this.p%0A                .subtract(BigInteger.ONE)));%0A%0A        return encryptedMessage;%0A    %7D%0A%0A    /**%0A     * %0A     * @param object%0A     * @param bigInteger
 %0A   
@@ -2645,16 +2645,52 @@
  verify(
+BigInteger bigInteger, Object object
 ) %7B%0A    

Add implementation for sign message