public static boolean verify(Signature signatureAlgorithm,PublicKey publicKey,byte[] signatureBytes,byte[] contentBytes) throws InvalidKeyException, SignatureException {
  signatureAlgorithm.initVerify(publicKey);
  signatureAlgorithm.update(contentBytes);
  try {
    return signatureAlgorithm.verify(signatureBytes);
  }
 catch (  SignatureException e) {
    return false;
  }
}

public static boolean verify ( Signature signatureAlgorithm , PublicKey publicKey , byte [ ] signatureBytes , byte [ ] contentBytes ) throws InvalidKeyException , SignatureException { signatureAlgorithm . initVerify ( publicKey ) ; signatureAlgorithm . update ( contentBytes ) ; try { return signatureAlgorithm . verify ( signatureBytes ) ; } catch ( SignatureException e ) { return false ; } }
verifies the signature of signed content based on a public key .
