diff --git a/make-keypairs/Main.hs b/make-keypairs/Main.hs
index c537ae4d3420c2c0ee42f80ac67c4d3cd281cd2b..d77171e5303c5fedfedabacef1830f9c687e5581 100644
--- a/make-keypairs/Main.hs
+++ b/make-keypairs/Main.hs
@@ -1,11 +1,11 @@
 module Main where
 
-import Codec.Crypto.RSA (generateKeyPair)
-import Crypto.Random (CryptoRandomGen (newGenIO), SystemRandom)
+import qualified Crypto.PubKey.RSA as RSA
 import Data.ASN1.BinaryEncoding (DER (DER))
 import Data.ASN1.Encoding (ASN1Encoding (encodeASN1))
 import Data.ASN1.Types (ASN1Object (toASN1))
 import qualified Data.ByteString.Lazy as LB
+import Data.X509 (PrivKey (PrivKeyRSA))
 
 -- | The size of the keys to generate.
 bits :: Int
@@ -17,11 +17,12 @@ count = 5
 
 main :: IO ()
 main = do
-    g <- newGenIO :: IO SystemRandom
-    mapM_ (genKey g) [0 .. count - 1]
+    mapM_ genKey [0 .. count - 1]
 
-genKey :: (Show a, CryptoRandomGen c) => c -> a -> IO ()
-genKey g n =
-    let (_, priv, _) = generateKeyPair g bits
-        bytes = encodeASN1 DER (toASN1 priv [])
-     in LB.writeFile ("test/data/rsa-privkey-" <> show n <> ".der") bytes
+genKey :: Show a => a -> IO ()
+genKey n = do
+    (_, priv) <- RSA.generate bits e
+    let bytes = encodeASN1 DER (toASN1 (PrivKeyRSA priv) [])
+    LB.writeFile ("test/data/rsa-privkey-" <> show n <> ".der") bytes
+  where
+    e = 0x10001
diff --git a/tahoe-ssk.cabal b/tahoe-ssk.cabal
index 470d125134527d3a4445321daf0d2105c5e994b5..7a873bea65afab04a5eabd94b1b6f4a776218664 100644
--- a/tahoe-ssk.cabal
+++ b/tahoe-ssk.cabal
@@ -143,3 +143,4 @@ executable make-keypairs
     , base
     , bytestring
     , cryptonite
+    , x509