diff --git a/Crypto/Cipher/AES.hs b/Crypto/Cipher/AES.hs
--- a/Crypto/Cipher/AES.hs
+++ b/Crypto/Cipher/AES.hs
@@ -1,5 +1,12 @@
 {-# LANGUAGE ForeignFunctionInterface #-}
 {-# LANGUAGE ViewPatterns #-}
+-- |
+-- Module      : Crypto.Cipher.AES
+-- License     : BSD-style
+-- Maintainer  : Vincent Hanquez <vincent@snarc.org>
+-- Stability   : stable
+-- Portability : good
+--
 module Crypto.Cipher.AES
     (
     -- * data types
@@ -8,6 +15,7 @@
 
     -- * creation
     , initKey
+    , keyOfCtx
 
     -- * misc
     , genCTR
@@ -85,6 +93,15 @@
                 c_aes_init ptr (castPtr ikey) (fromIntegral len)
                 fptr <- newForeignPtr c_free_finalizer (castPtr ptr)
                 return $ Key $ fromForeignPtr fptr 0 (16+2*2*16*nbR)
+
+-- | return the user key from the Key context
+keyOfCtx :: Key -> ByteString
+keyOfCtx (Key bs) = B.take sz (B.drop 8 bs)
+    where nbRound            = unsafeHead $ B.take 1 bs
+          sz | nbRound == 10 = 16
+             | nbRound == 12 = 24
+             | nbRound == 14 = 32
+             | otherwise     = error "not a valid key"
 
 -- | encrypt using Electronic Code Book (ECB)
 {-# NOINLINE encryptECB #-}
diff --git a/Tests/Tests.hs b/Tests/Tests.hs
--- a/Tests/Tests.hs
+++ b/Tests/Tests.hs
@@ -52,6 +52,8 @@
     deriving (Show,Eq)
 data GCMUnit = GCMUnit B.ByteString B.ByteString B.ByteString B.ByteString
     deriving (Show,Eq)
+data KeyUnit = KeyUnit B.ByteString
+    deriving (Show,Eq)
 
 generateKeyOf size = B.pack <$> replicateM size arbitrary
 generateKey = elements [16,24,32] >>= generateKeyOf
@@ -91,6 +93,9 @@
                 <*> generateIv
                 <*> generatePlaintextMultiple16
 
+instance Arbitrary KeyUnit where
+    arbitrary = KeyUnit <$> generateKey
+
 idECBTests (ECBUnit (AES.initKey -> key) plaintext) =
     plaintext `assertEq` AES.decryptECB key (AES.encryptECB key plaintext)
 
@@ -108,6 +113,8 @@
     let (plaintext2, tag2) = AES.decryptGCM key iv aad cipherText in
     (plaintext `assertEq` plaintext2) && (tag == tag2)
 
+idKey (KeyUnit keyBs) = keyBs == AES.keyOfCtx (AES.initKey keyBs)
+
 assertEq expected got
 	| expected == got = True
 	| otherwise       = error ("expected: " ++ showhex expected ++ " got: " ++ showhex got)
@@ -119,7 +126,8 @@
                   | otherwise          = '_'
 
 tests =
-    [ testGroup "KAT-ECB-Encrypt" $ katECBTests KATECB.vectors_encrypt AES.encryptECB
+    [ testProperty "key-id" idKey
+    , testGroup "KAT-ECB-Encrypt" $ katECBTests KATECB.vectors_encrypt AES.encryptECB
     , testGroup "KAT-ECB-Decrypt" $ katECBTests KATECB.vectors_decrypt AES.decryptECB
     , testGroup "KAT-CBC-Encrypt" $ katCBCTests KATCBC.vectors_encrypt AES.encryptCBC
     , testGroup "KAT-CBC-Decrypt" $ katCBCTests KATCBC.vectors_decrypt AES.decryptCBC
diff --git a/cipher-aes.cabal b/cipher-aes.cabal
--- a/cipher-aes.cabal
+++ b/cipher-aes.cabal
@@ -1,5 +1,5 @@
 Name:                cipher-aes
-Version:             0.1.5
+Version:             0.1.6
 Description:
     Fast AES cipher implementation with advanced mode of operations.
     .
