    [javax.crypto.spec SecretKeySpec]
    [org.apache.commons.codec.binary Base64]
    [org.joda.time DateTime DateTimeZone]))
-
 
 (def ^:const hmac-sha256-algorithm  "HmacSHA256")
 (def ^:const new-line "\n")

       (generate-query-string query-params)))

(defn- generate-signature [method uri query-params]
  (let [url (URL. uri)
        host (lower-case (.getHost url))
        path (get-path url)
        data (url-to-sign method host path query-params)]

(defn- bytes [str]
  (.getBytes str "UTF-8"))

(defn- base64 [b]
  (Base64/encodeBase64String b))

(defn- get-mac []
  (let [signing-key (SecretKeySpec. (bytes (aws-secret)) hmac-sha256-algorithm)
        mac (Mac/getInstance hmac-sha256-algorithm)]
    (.init mac signing-key)
    mac))

(defn- calculate-hmac [data]
  (try
    (let [mac (get-mac)
          raw-mac (.doFinal mac (bytes data))]
      (base64 raw-mac))
    (catch Exception e
