When you sign the message, you should have the following code:
Signature signature = Signature.getInstance("SHA1withRSA");
signature.initSign(privKey);
signature.update(message);
byte[] signatureValue = signature.sign();
Pay attention to the byte array with the name signatureValue. This is the actual data signature. This is what you should provide to the method verify(). A signed message must be provided when the method is called update(). I.e:.
Signature signature = Signature.getInstance("SHA1withRSA");
signature.initVerify(pubKey);
signature.update(message);
bool ok = signature.verify(signatureValue);
source
share