public ElGamal_Key(int k) {
		Random rand = new Random();
		do {
			// p waehlen
			this.p = new BigInteger(k, 400, rand);
			
			// Generator g>1 erzeugen
			factors = factorize(p.subtract(BigInteger.valueOf(1)));
		} while(factors==null);	// wiederholen falls factorize() zu lange dauert
		Boolean found;
		do {
			g = new BigInteger(k, rand); 
			g = g.remainder(p.subtract(BigInteger.valueOf(3))).add(BigInteger.ONE); // g=0 ist unguenstig
			found=true;
			for(BigInteger f: factors) {
				if(g.modPow((p.subtract(BigInteger.valueOf(1))).divide(f), p).compareTo(BigInteger.ONE)==0) {
					found=false;
					break; 
				}
			}
		} while(!found);
		
		do{
			// k_d waehlen
			this.k_d = new BigInteger(k, rand).remainder(p.subtract(BigInteger.valueOf(2)));
			// k_c berechnen
			this.k_c=g.modPow(k_d, p);
		}while(this.k_c.equals(BigInteger.ONE)); // k_c=1 ausschließen
	}