public static boolean verifySignature(PublicKey key,byte[] message,byte[] signature){
  lock.lock();
  boolean result=false;
  try {
    if (signatureEngine == null) {
      signatureEngine=Signature.getInstance("SHA1withRSA");
    }
    signatureEngine.initVerify(key);
    result=verifySignature(signatureEngine,message,signature);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  lock.unlock();
  return result;
}

public static boolean verifySignature ( PublicKey key , byte [ ] message , byte [ ] signature ) { lock . lock ( ) ; boolean result = false ; try { if ( signatureEngine == null ) { signatureEngine = Signature . getInstance ( "SHA1withRSA" ) ; } signatureEngine . initVerify ( key ) ; result = verifySignature ( signatureEngine , message , signature ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } lock . unlock ( ) ; return result ; }
verify the signature of a message .
