diff --git a/Network/HTTP/Rest/Signature/EC2.hs b/Network/HTTP/Rest/Signature/EC2.hs
--- a/Network/HTTP/Rest/Signature/EC2.hs
+++ b/Network/HTTP/Rest/Signature/EC2.hs
@@ -1,8 +1,7 @@
 module Network.HTTP.Rest.Signature.EC2
-    ( -- * Re-exports
-      module Network.HTTP.QueryString
+    ( 
       -- * Types
-    , Method
+      Method
     , Endpoint
     , Path
     , SecretKey
@@ -14,5 +13,4 @@
     , signature'
     ) where
 
-import Network.HTTP.QueryString
 import Network.HTTP.Rest.Signature.EC2.Internal
diff --git a/Network/HTTP/Rest/Signature/EC2/Internal.hs b/Network/HTTP/Rest/Signature/EC2/Internal.hs
--- a/Network/HTTP/Rest/Signature/EC2/Internal.hs
+++ b/Network/HTTP/Rest/Signature/EC2/Internal.hs
@@ -5,10 +5,10 @@
 import qualified Data.ByteString.Lazy as BL
 import qualified Data.ByteString.Base64 as Base64
 import qualified Data.Digest.Pure.SHA as SHA
+import Data.List (sort)
 import Data.Monoid
 import qualified Network.HTTP.Types as HTTP
-
-import Network.HTTP.QueryString
+import Network.HTTP.Types (Query, SimpleQuery)
 
 type Method = ByteString
 type Endpoint = ByteString
@@ -20,24 +20,27 @@
 --
 -- >>> stringToSign "GET" "ec2.amazonaws.com" "/" [("key1", "value1"), ("key2", "value2")]
 -- "GET\nec2.amazonaws.com\n/\nkey1=value1&key2=value2"
-stringToSign :: Method -> Endpoint -> Path -> [(ByteString, ByteString)] -> ByteString
-stringToSign method end path = stringToSign' method end path . queryString
+stringToSign :: Method -> Endpoint -> Path -> SimpleQuery -> ByteString
+stringToSign method end path
+    = stringToSign' method end path
+    . HTTP.simpleQueryToQuery
 
-stringToSign' :: Method -> Endpoint -> Path -> QueryString -> ByteString
-stringToSign' method end path params = BS.intercalate "\n"
+stringToSign' :: Method -> Endpoint -> Path -> Query -> ByteString
+stringToSign' method end path query = BS.intercalate "\n"
     [ method
     , end
     , path
-    , toString params
+    , HTTP.renderQuery False $ sort query
     ]
 
 -- | Make signature from a parameter list.
-signature :: Method -> Endpoint -> Path -> SecretKey -> SignatureMethod -> [(ByteString, ByteString)] -> ByteString
+signature :: Method -> Endpoint -> Path -> SecretKey -> SignatureMethod -> SimpleQuery -> ByteString
 signature method end path secret sigm
-    = signature' method end path secret sigm . queryString
+    = signature' method end path secret sigm
+    . HTTP.simpleQueryToQuery
 
 -- | Make signature from a 'QueryString'.
-signature' :: Method -> Endpoint -> Path -> SecretKey -> SignatureMethod -> QueryString -> ByteString
+signature' :: Method -> Endpoint -> Path -> SecretKey -> SignatureMethod -> Query -> ByteString
 signature' method end path secret sigm params
     = HTTP.urlEncode True
     $ Base64.encode
diff --git a/ec2-signature.cabal b/ec2-signature.cabal
--- a/ec2-signature.cabal
+++ b/ec2-signature.cabal
@@ -1,5 +1,5 @@
 name:                ec2-signature
-version:             3.0
+version:             3.1
 synopsis:            The Amazon EC2 style signature calculator.
 description:         The Amazon EC2 style signature calculator.
                      <http://docs.aws.amazon.com/general/latest/gr/signature-version-2.html>
@@ -23,7 +23,6 @@
                      , base64-bytestring
                      , SHA
                      , http-types
-                     , http-querystring
 
 test-suite doctest
   type:              exitcode-stdio-1.0
@@ -32,6 +31,21 @@
   ghc-options:       -Wall
   build-depends:       base == 4.*
                      , doctest
+
+test-suite spec
+  type:              exitcode-stdio-1.0
+  hs-source-dirs:    ., test
+  main-is:           Spec.hs
+  extensions:        OverloadedStrings
+  ghc-options:       -Wall -fno-warn-unused-do-bind
+  build-depends:       base == 4.*
+                     , bytestring
+                     , base64-bytestring
+                     , SHA
+                     , http-types
+                     , hspec
+                     , HUnit
+                     , QuickCheck
 
 source-repository head
     type:            git
diff --git a/test/Spec.hs b/test/Spec.hs
new file mode 100644
--- /dev/null
+++ b/test/Spec.hs
@@ -0,0 +1,61 @@
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+import Control.Applicative
+import Data.ByteString (ByteString)
+import qualified Data.ByteString.Char8 as BC
+import Test.Hspec
+import Test.Hspec.QuickCheck
+import Test.HUnit
+import Test.QuickCheck
+
+import Network.HTTP.Types (SimpleQuery)
+import Network.HTTP.Rest.Signature.EC2
+
+instance Arbitrary ByteString where
+    arbitrary = BC.pack <$> arbitrary
+
+data KeyString = Key { toBS :: ByteString }
+
+instance Arbitrary KeyString where
+    arbitrary = Key . BC.pack <$> ((:) <$> arbitrary <*> arbitrary)
+
+data T = T SimpleQuery
+  deriving (Show)
+
+instance Arbitrary T where
+    arbitrary = T . map (\(a, b) -> (toBS a, b)) <$> arbitrary
+
+main :: IO ()
+main = hspec $ do
+    describe "Network.HTTP.Rest.Signature.EC2" $ do
+        it "calculate signature" testSignature
+        prop "calculate signature" propSignature
+
+testSignature :: IO ()
+testSignature = do
+    signature
+            "GET"
+            "ec2.amazonaws.com"
+            "/"
+            "secretKey"
+            HmacSHA256
+            [("key1", "value1"), ("key2", "value2")]
+        @=? "KkzU%2BMu0a1x8qa3uHhXBGWVVTcKV3dTLcgkCIIeAyZw%3D"
+    signature
+            "GET"
+            "ec2.amazonaws.com"
+            "/"
+            "secretKey2"
+            HmacSHA256
+            [("key1", "value1"), ("key2", "value2")]
+        @=? "TzOwg4QGXgL%2F9KFOLbddgqMH4zDIqUv9fdBMU%2F8X8Hg%3D"
+
+propSignature :: T -> Bool
+propSignature (T query) = f query == f (reverse query)
+  where
+    f = signature
+            "GET"
+            "ec2.amazonaws.com"
+            "/"
+            "secretKey"
+            HmacSHA256
