code: private boolean verifyUsingPublicKey(byte[] data, byte[] signature, PublicKey pubKey)
              throws GeneralSecurityException {
          Signature sig = Signature.getInstance("SHA256withRSA");
          sig.initVerify(pubKey);
          sig.update(data);
          return sig.verify(signature);
      }
docs: Verify signature
  
  @param data
  @param signature
  @param pubKey
  @return
  @throws GeneralSecurityException