code: byte[] createSignatureFor(String algorithm, byte[] secretBytes, byte[] headerBytes, byte[] payloadBytes) throws NoSuchAlgorithmException, InvalidKeyException {
          final Mac mac = Mac.getInstance(algorithm);
          mac.init(new SecretKeySpec(secretBytes, algorithm));
          mac.update(headerBytes);
          mac.update(JWT_PART_SEPARATOR);
          return mac.doFinal(payloadBytes);
      }
docs: Create signature for JWT header and payload.
  
  @param algorithm algorithm name.
  @param secretBytes algorithm secret.
  @param headerBytes JWT header.
  @param payloadBytes JWT payload.
  @return the signature bytes.
  @throws NoSuchAlgorithmException if the algorithm is not supported.
  @throws InvalidKeyException if the given key is inappropriate for initializing the specified algorithm.