Archive

Archive for June, 2009

HsOpenSSL Update

June 27th, 2009 John Van Enk 1 comment

The maintainer of HsOpenSSL accepted a patch Job Vranish and I put together that moves to a simple build type rather than the configure step. This has the nice side effect that, with the right libraries installed, we can get HsOpenSSL to install happily in windows without the need for Cygwin to build it.

Here’s how:

  1. First, we need to install the OpenSSL binaries and header files. The Windows build of OpenSSL depends on the Visual C++ 2008 Redistributables. Download and install them.
  2. Next we need the Win32 OpenSSL v0.9.8k package. Download and install this.
  3. Open cmd.exe to run a few commands.
  4. Now that OpenSSL is installed, lets perform a cabal update to make sure we have the most recent package.
  5. If you used the default installation options, you can call the following command to install HsOpenSSL:
    cabal install --reinstall HsOpenSSL --extra-include-dirs=C:\OpenSSL\include --extra-lib-dirs=C:\OpenSSL\lib\MinGW

    Note that I included --reinstall just to make sure we don’t terminate prematurely because of an older version.

Everything should be installed now. Lets test it. Save this into a file somewhere:

module Main where
 
import OpenSSL.RSA
 
main :: IO ()
main = do
    key <- generateRSAKey' 2048 65537
 
    print key

And lets build it…

ghc --make test.hs

…and run it…

>test.exe
RSAKeyPair {rsaN = [ZOMG BIG NUMBER], rsaE = 65537, rsaD = [ZOMG ANOTHER ONE], rsaP = [THIS ONE WASN'T AS LARGE], rsaQ = [SAME HERE, BUT STILL PRETTY HUGE] }

If you got some output that wasn’t an error from test.exe, you’ve successfully installed HsOpenSSL in Windows.

Hope this helps someone!

Categories: Uncategorized Tags: