public static void addToRequest(Crypto crypto, SecretKey key, byte[] requestBody, String signatureAlgorithm, Request request) {
        Mac mac;
        try {
            mac = crypto.mac(signatureAlgorithm);
        }  catch (NoSuchAlgorithmException e) {
            throw new ConnectException(e);
        }
        byte[] requestSignature = sign(mac, key, requestBody);
        request.header(InternalRequestSignature.SIGNATURE_HEADER, Base64.getEncoder().encodeToString(requestSignature))
               .header(InternalRequestSignature.SIGNATURE_ALGORITHM_HEADER, signatureAlgorithm);
    }
Add a signature to a request.

@param crypto             the cryptography library used to generate {@link Mac} instances, may not be null
@param key                the key to sign the request with; may not be null
@param requestBody        the body of the request; may not be null
@param signatureAlgorithm the algorithm to use to sign the request; may not be null
@param request            the request to add the signature to; may not be null
connect/runtime/src/main/java/org/apache/kafka/connect/runtime/rest/InternalRequestSignature.java