class Crypto {

    public static String hmac(String message, String sharedSecret) throws CryptoException {
        //this has not been optimized!
        String method = "HmacSHA256";
        byte [] bsig;
        try {
            javax.crypto.Mac hmac = javax.crypto.Mac.getInstance(method);
            javax.crypto.spec.SecretKeySpec secretKey = new javax.crypto.spec.SecretKeySpec(utf8Bytes(sharedSecret), method);
            hmac.init(secretKey);
            bsig = hmac.doFinal(message.getBytes());
            ///CLOVER:OFF
        } catch (NoSuchAlgorithmException e) {
            LOG.error("hmac: Caught NoSuchAlgorithmException, check to make sure the algorithm is supported by the provider.");
            throw new CryptoException(e);
        } catch (InvalidKeyException e) {
            LOG.error("hmac: Caught InvalidKeyException, incorrect key type is being used.");
            throw new CryptoException(e);
        }
        ///CLOVER:ON
        return ybase64(bsig);
    }

}