Skip to content
This repository has been archived by the owner on Jan 18, 2020. It is now read-only.

Commit

Permalink
Sort out PKey stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
depressed-pho committed Dec 31, 2014
1 parent c5fd6bd commit ee92d44
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
2014-12-31 PHO <[email protected]>

* OpenSSL/EVP/Internal.hsc (VaguePKey, PKey): Turn documentation
comments into Haddock ones.

* OpenSSL/EVP/PKey.hsc (module): Do not re-export PKey. It was
only accidentally re-exported.

* HsOpenSSL.cabal (Build-Depends): Narrow version ranges that were
unnecessarily wide.

Expand Down
18 changes: 9 additions & 9 deletions OpenSSL/EVP/Internal.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -285,25 +285,25 @@ digestLazily md lbs = do

{- EVP_PKEY ------------------------------------------------------------------ -}

-- VaguePKey is a ForeignPtr to EVP_PKEY, that is either public key or
-- a ker pair. We can't tell which at compile time.
-- | VaguePKey is a 'ForeignPtr' to 'EVP_PKEY', that is either public
-- key or a ker pair. We can't tell which at compile time.
newtype VaguePKey = VaguePKey (ForeignPtr EVP_PKEY)
data EVP_PKEY

-- Instances of class PKey can be converted back and forth to
-- VaguePKey.
-- | Instances of class 'PKey' can be converted back and forth to
-- 'VaguePKey'.
class PKey k where
-- Wrap the key (i.g. RSA) into EVP_PKEY.
-- | Wrap the key (i.g. RSA) into 'EVP_PKEY'.
toPKey :: k -> IO VaguePKey

-- Extract the concrete key from the EVP_PKEY. Returns Nothing if
-- the type mismatches.
-- | Extract the concrete key from the 'EVP_PKEY'. Returns
-- 'Nothing' if the type mismatches.
fromPKey :: VaguePKey -> IO (Maybe k)

-- Do the same as EVP_PKEY_size().
-- | Do the same as EVP_PKEY_size().
pkeySize :: k -> Int

-- Return the default digesting algorithm for the key.
-- | Return the default digesting algorithm for the key.
pkeyDefaultMD :: k -> IO Digest

foreign import ccall unsafe "EVP_PKEY_new"
Expand Down
3 changes: 1 addition & 2 deletions OpenSSL/EVP/PKey.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
#include "HsOpenSSL.h"

module OpenSSL.EVP.PKey
( PKey
, PublicKey(..)
( PublicKey(..)
, KeyPair(..)
, SomePublicKey
, SomeKeyPair
Expand Down

0 comments on commit ee92d44

Please sign in to comment.