public static InternalRequestSignature fromHeaders(Crypto crypto, byte[] requestBody, HttpHeaders headers) {
        if (headers == null) {
            return null;
        }

        String signatureAlgorithm = headers.getHeaderString(SIGNATURE_ALGORITHM_HEADER);
        String encodedSignature = headers.getHeaderString(SIGNATURE_HEADER);
        if (signatureAlgorithm == null || encodedSignature == null) {
            return null;
        }

        Mac mac;
        try {
            mac = crypto.mac(signatureAlgorithm);
        } catch (NoSuchAlgorithmException e) {
            throw new BadRequestException(e.getMessage());
        }

        byte[] decodedSignature;
        try {
            decodedSignature = Base64.getDecoder().decode(encodedSignature);
        } catch (IllegalArgumentException e) {
            throw new BadRequestException(e.getMessage());
        }

        return new InternalRequestSignature(
            requestBody,
            mac,
            decodedSignature
        );
    }
Extract a signature from a request.

@param crypto        the cryptography library used to generate {@link Mac} instances, may not be null
@param requestBody   the body of the request; may not be null
@param headers       the headers for the request; may be null
@return the signature extracted from the request, or null if one or more request signature
headers was not present
connect/runtime/src/main/java/org/apache/kafka/connect/runtime/rest/InternalRequestSignature.java