code: boolean verifySignatureFor(String algorithm, PublicKey publicKey, byte[] headerBytes, byte[] payloadBytes, byte[] signatureBytes) throws NoSuchAlgorithmException, InvalidKeyException, SignatureException {
          final Signature s = Signature.getInstance(algorithm);
          s.initVerify(publicKey);
          s.update(headerBytes);
          s.update(JWT_PART_SEPARATOR);
          s.update(payloadBytes);
          return s.verify(signatureBytes);
      }
docs: Verify signature for JWT header and payload using a public key.
  
  @param algorithm algorithm name.
  @param publicKey the public key to use for verification.
  @param headerBytes JWT header.
  @param payloadBytes JWT payload.
  @param signatureBytes JWT signature.
  @return true if signature is valid.
  @throws NoSuchAlgorithmException if the algorithm is not supported.
  @throws InvalidKeyException if the given key is inappropriate for initializing the specified algorithm.