[Haskell-cafe] Re: Crypto-API is stabilizing

Thomas DuBuisson thomas.dubuisson at gmail.com
Sat Sep 4 11:22:04 EDT 2010

Sorry, the example was all messed up, even if it did communicate what
I wanted its just so broken I must fix.

Slightly contrived example:

   buildAgreementMessage :: (Monad m, CryptoRandomGen g,
ASymetricCipher k) => g -> k -> m (B.ByteString, (k,k), g)
   buildAgreementMessages g k = do
       ((p,q),g') <- eitherToFail (buildKeyPair g)
       let pBS = encode p
           msg = runPut $ do
                       putByteString agreementHeader
                       putWord16be (B.length pBS)
                       putByteString pBS
       return $ (sign msg k, (p,q), g')

Again, this is simply trying to re-enforce the fact that buildKeyPair
(formerly 'generateKeyPair') does have a place.


On Sat, Sep 4, 2010 at 7:45 AM, Thomas DuBuisson
<thomas.dubuisson at gmail.com> wrote:
> Slightly contrived example:
>    buildAgreementMessage :: (Monad m, CryptoRandomGen g,
> ASymetricCipher k) => g -> k -> m (B.ByteString,g)
>    buildAgreementMessages g k = do
>        (e,g') <- liftM eitherToFail (buildAsymKey g `asTypeOf` k)
>        let eBS = encode e
>            msg = runPut (putByteString agreementHeader >> putWord16be
> (B.length eBS) >> putByteString eBS)
>        return msg

More information about the Haskell-Cafe mailing list