private boolean resultsIdentical(String namedCurve,BigInteger badX,BigInteger badY,BigInteger secret,int iter) throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, InvalidKeySpecException, InvalidKeyException {
  for (int i=0; i < iter; i++) {
    secret=secret.add(BigInteger.ONE);
    BigInteger resultCustom=computeSecretWithCustomAlgorithm(namedCurve,badX,badY,secret);
    BigInteger resultSun=computeSecretWithSunAlgorithm(namedCurve,badX,badY,secret);
    if (resultSun != null && !resultSun.equals(resultCustom)) {
      return false;
    }
  }
  return true;
}

private boolean resultsIdentical ( String namedCurve , BigInteger badX , BigInteger badY , BigInteger secret , int iter ) throws InvalidAlgorithmParameterException , NoSuchAlgorithmException , InvalidKeySpecException , InvalidKeyException { for ( int i = 0 ; i < iter ; i ++ ) { secret = secret . add ( BigInteger . ONE ) ; BigInteger resultCustom = computeSecretWithCustomAlgorithm ( namedCurve , badX , badY , secret ) ; BigInteger resultSun = computeSecretWithSunAlgorithm ( namedCurve , badX , badY , secret ) ; if ( resultSun != null && ! resultSun . equals ( resultCustom ) ) { return false ; } } return true ; }
executes point multiplication with custom and java sun computation . in case the results differ , returns false . in case sun returns null , the result is not observed ( sun returns null , by accident ? )
