diff --git a/dist/build/eccrypto-testsuiteStub/eccrypto-testsuiteStub-tmp/eccrypto-testsuiteStub.hs b/dist/build/eccrypto-testsuiteStub/eccrypto-testsuiteStub-tmp/eccrypto-testsuiteStub.hs
deleted file mode 100644
--- a/dist/build/eccrypto-testsuiteStub/eccrypto-testsuiteStub-tmp/eccrypto-testsuiteStub.hs
+++ /dev/null
@@ -1,5 +0,0 @@
-module Main ( main ) where
-import Distribution.Simple.Test.LibV09 ( stubMain )
-import Tests ( tests )
-main :: IO ()
-main = stubMain tests
diff --git a/eccrypto.cabal b/eccrypto.cabal
--- a/eccrypto.cabal
+++ b/eccrypto.cabal
@@ -1,5 +1,5 @@
 Name:                eccrypto
-Version:             0.2.1
+Version:             0.2.2
 Synopsis:            Elliptic Curve Cryptography for Haskell
 Description:         Elliptic Curve Cryptography in Haskell, evolved for correctness and practical usability from higher-level libraries.
                      .
@@ -34,7 +34,8 @@
               , bytestring >= 0.10 && < 0.11
               , cryptohash-sha512 >= 0.11 && < 0.12
               , integer-gmp >= 1.0 && < 1.1
-              , random >= 1.1 && < 1.2
+  if os(windows)
+     build-depends: crypto-api >=0.13 && < 0.14
   Exposed-modules:
                   Crypto.Common
                   Crypto.Fi
diff --git a/src/Crypto/ECC/Ed25519/Sign.hs b/src/Crypto/ECC/Ed25519/Sign.hs
--- a/src/Crypto/ECC/Ed25519/Sign.hs
+++ b/src/Crypto/ECC/Ed25519/Sign.hs
@@ -12,11 +12,16 @@
 -- TODO: convert code to portable implementation and get rid of Integer
 -----------------------------------------------------------------------------
 
+{-# LANGUAGE CPP #-}
+#ifndef mingw32_HOST_OS
 {-# LANGUAGE Safe #-}
+#else
+{-# LANGUAGE Trustworthy #-}
+#endif
 {-# LANGUAGE ScopedTypeVariables #-}
 {-# LANGUAGE NoImplicitPrelude #-}
-{-# LANGUAGE CPP #-}
 
+
 module Crypto.ECC.Ed25519.Sign ( genkeys
                                , publickey
                                , dsign
@@ -38,30 +43,35 @@
 import safe Prelude ((==),($),(<),IO,return,pure,Either(Left,Right),String,(&&))
 import safe qualified Crypto.Fi as FP
 import safe qualified Data.ByteString as BS
-#ifdef linux_HOST_OS
+#ifndef mingw32_HOST_OS
 import safe qualified Data.ByteString.Lazy.Char8 as BS8
-#endif
-#ifndef linux_HOST_OS
-import safe qualified System.Random as R
-import safe Prelude (take)
+#else
+import qualified Crypto.Random as R
+import safe Prelude (show)
 #endif
 
 -- | generate a new key pair (secret and derived public key) using some external entropy
 -- | This may be insecure, depending on your environment, so for your usage case you may need to implement some better key generator!
 genkeys :: IO (Either String (SecKey,PubKey))
 genkeys = do
-#ifdef linux_HOST_OS
+#ifndef mingw32_HOST_OS
   bytes <- BS8.readFile "/dev/urandom"
   let sk = SecKeyBytes $ BS8.toStrict $ BS8.take 32 bytes
-#else
-  g <- R.getStdGen
-  let bytes = R.randoms g
-      sk = SecKeyBytes $ BS.pack $ take 32 bytes
-#endif
-  let derived = publickey sk
+      derived = publickey sk
   return $ case derived of
     Left e -> Left e
     Right pk -> Right (sk,pk)
+#else
+  g <- (R.newGenIO :: IO R.SystemRandom)
+  let prngresult = R.genBytes 32 g
+  case prngresult of
+    Left e -> return $ Left $ show e
+    Right (bytes,_) -> let sk = SecKeyBytes bytes
+                           derived = publickey sk
+                       in return $ case derived of
+                                     Left e -> Left e
+                                     Right pk -> Right (sk,pk)
+#endif
 
 -- | derive public key from secret key
 publickey :: SecKey -> Either String PubKey
