diff --git a/secp256k1.cabal b/secp256k1.cabal
--- a/secp256k1.cabal
+++ b/secp256k1.cabal
@@ -1,5 +1,5 @@
 name:                secp256k1
-version:             0.5.2
+version:             0.5.3
 synopsis:            Bindings for secp256k1 library from Bitcoin Core
 description:         Please see README.md
 homepage:            http://github.com/haskoin/secp256k1-haskell#readme
@@ -113,8 +113,8 @@
     default-language:    Haskell2010
     ghc-options:         -Wall
     cc-options:          -DHAVE_CONFIG_H
-    c-sources:           secp256k1/src/secp256k1.c, secp256k1/contrib/lax_der_parsing.c
-    include-dirs:        secp256k1, secp256k1/include
+    c-sources:           secp256k1/src/secp256k1.c, secp256k1/contrib/lax_der_parsing.c, secp256k1/contrib/lax_der_privatekey_parsing.c
+    include-dirs:        secp256k1, secp256k1/contrib, secp256k1/include
 
 test-suite secp256k1-test
     type:                exitcode-stdio-1.0
diff --git a/src/Crypto/Secp256k1.hs b/src/Crypto/Secp256k1.hs
--- a/src/Crypto/Secp256k1.hs
+++ b/src/Crypto/Secp256k1.hs
@@ -20,6 +20,7 @@
     , secKey
     , getSecKey
     , derivePubKey
+    , exportSecKey
 
     -- * Public Keys
     , PubKey
@@ -261,6 +262,18 @@
     fp <- mallocForeignPtr
     ret <- withForeignPtr fp $ \p -> ecPubKeyParse ctx p b l
     if isSuccess ret then return $ Just $ PubKey fp else return Nothing
+
+-- | Encode secret key as DER.  First argument 'True' for compressed output.
+exportSecKey :: Bool -> SecKey -> ByteString
+exportSecKey compress (SecKey fk) = withContext $ \ctx ->
+    withForeignPtr fk $ \k -> alloca $ \l -> allocaBytes 279 $ \o -> do
+        poke l 279
+        ret <- ecSecKeyExport ctx o l k c
+        unless (isSuccess ret) $ error "could not export secret key"
+        n <- peek l
+        packByteString (o, n)
+  where
+    c = if compress then compressed else uncompressed
 
 -- | Encode public key as DER. First argument 'True' for compressed output.
 exportPubKey :: Bool -> PubKey -> ByteString
diff --git a/src/Crypto/Secp256k1/Internal.hs b/src/Crypto/Secp256k1/Internal.hs
--- a/src/Crypto/Secp256k1/Internal.hs
+++ b/src/Crypto/Secp256k1/Internal.hs
@@ -480,3 +480,13 @@
     -> Ptr RecSig65
     -> Ptr Msg32
     -> IO Ret
+
+foreign import ccall
+    "lax_der_privatekey_parsing.h ec_privkey_export_der"
+    ecSecKeyExport
+    :: Ptr Ctx
+    -> Ptr CUChar -- ^ array to store DER-encoded key (allocate 279 bytes)
+    -> Ptr CSize -- ^ size of previous array, will be updated
+    -> Ptr SecKey32
+    -> SerFlags
+    -> IO Ret
