protected String signAndBase64Encode(byte[] data, String key,
            SigningAlgorithm algorithm) throws SdkClientException {
        try {
            byte[] signature = sign(data, key.getBytes(UTF8), algorithm);
            return Base64.encodeAsString(signature);
        } catch (Exception e) {
            throw new SdkClientException(
                    "Unable to calculate a request signature: "
                            + e.getMessage(), e);
        }
    }
Computes an RFC 2104-compliant HMAC signature for an array of bytes and
returns the result as a Base64 encoded string.
aws-java-sdk-core/src/main/java/com/amazonaws/auth/AbstractAWSSigner.java