public void verify(FileInputStream ciphertext, FileInputStream cleartext) {
    int Lp = p.bitLength(); // bitlength of p (512 bit)
    int L = (Lp - 1) / 8; // blocksize

    // read ciphertext
    BigInteger C = readCipher(ciphertext);
    BigInteger M = readClear(cleartext, L);

    Boolean verified = true;
    while (C != null && M != null) {
      BigInteger r = C.mod(p);
      BigInteger s = C.divide(p);

      if ((r.compareTo(BigInteger.ONE) >= 0) && (r.compareTo(p.subtract(BigInteger.ONE)) <= 0)) {
        BigInteger yr = y.modPow(r, p); // y^r mod p
        BigInteger rs = r.modPow(s, p); // r^s mod p

        BigInteger v1 = yr.multiply(rs).mod(p); // y^r * r^s mod p

        BigInteger v2 = g.modPow(M, p);

        if (!v1.equals(v2)) {
          verified = false;
        }
      } else {
        System.out.println("Abbruch, da r >= 1 oder r <= p-1 nicht erfüllt ist!");
        verified = false;
      }

      C = readCipher(ciphertext);
      M = readClear(cleartext, L);
    }

    if (verified) {
      System.out.println("Der Text wurde verifiziert!");
    } else {
      System.out.println("Der Text konnte nicht verifiziert werden!!!");
    }
  }