From 1388e86302eeec3808d2b061fae6b72afdd0fc5f Mon Sep 17 00:00:00 2001 From: pho Date: Mon, 13 Jul 2009 22:47:54 +0900 Subject: [PATCH] Suggestion by Grant Monroe: Ignore-this: 5faa29886416193f711c9d7208904acd - Changed the signature of OpenSSL.EVP.Sign.signBS from signBS :: KeyPair key => Digest -> key -> Strict.ByteString -> IO String to signBS :: KeyPair key => Digest -> key -> Strict.ByteString -> IO Strict.ByteString - Changed the signature of OpenSSL.EVP.Sign.signLBS from signLBS :: KeyPair key => Digest -> key -> Lazy.ByteString -> IO String to signLBS :: KeyPair key => Digest -> key -> Lazy.ByteString -> IO Lazy.ByteString darcs-hash:20090713134754-62b54-bdc265c51f6e8403d561264ffd29a6ece64601ce.gz --- HsOpenSSL.cabal | 2 +- NEWS | 15 +++++++++++++++ OpenSSL/EVP/Sign.hsc | 12 +++++++----- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/HsOpenSSL.cabal b/HsOpenSSL.cabal index 73111d7..4e9655b 100644 --- a/HsOpenSSL.cabal +++ b/HsOpenSSL.cabal @@ -5,7 +5,7 @@ Description: can generate RSA and DSA keys, read and write PEM files, generate message digests, sign and verify messages, encrypt and decrypt messages. -Version: 0.6.2 +Version: 0.6.3 License: PublicDomain License-File: COPYING Author: Adam Langley , PHO diff --git a/NEWS b/NEWS index 71686a6..976e38f 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,20 @@ -*- Coding: utf-8 -*- +Changes from 0.6.2 to 0.6.3 +--------------------------- +* Suggestion by Grant Monroe: + + - Changed the signature of OpenSSL.EVP.Sign.signBS from + signBS :: KeyPair key => Digest -> key -> Strict.ByteString -> IO String + to + signBS :: KeyPair key => Digest -> key -> Strict.ByteString -> IO Strict.ByteString + + - Changed the signature of OpenSSL.EVP.Sign.signLBS from + signLBS :: KeyPair key => Digest -> key -> Lazy.ByteString -> IO String + to + signLBS :: KeyPair key => Digest -> key -> Lazy.ByteString -> IO Lazy.ByteString + + Chanegs from 0.6.1 to 0.6.2 --------------------------- * Applied a patch by John Van Enk and his friend: diff --git a/OpenSSL/EVP/Sign.hsc b/OpenSSL/EVP/Sign.hsc index 9d23dfe..e81c8dc 100644 --- a/OpenSSL/EVP/Sign.hsc +++ b/OpenSSL/EVP/Sign.hsc @@ -46,24 +46,26 @@ sign :: KeyPair key => -> String -- ^ input string -> IO String -- ^ the result signature sign md pkey input - = signLBS md pkey $ L8.pack input + = liftM L8.unpack $ signLBS md pkey $ L8.pack input -- |@'signBS'@ generates a signature from a chunk of data. signBS :: KeyPair key => Digest -- ^ message digest algorithm to use -> key -- ^ private key to sign the message digest -> B8.ByteString -- ^ input string - -> IO String -- ^ the result signature + -> IO B8.ByteString -- ^ the result signature signBS md pkey input = do ctx <- digestStrictly md input - signFinal ctx pkey + sig <- signFinal ctx pkey + return $ B8.pack sig -- |@'signLBS'@ generates a signature from a stream of data. signLBS :: KeyPair key => Digest -- ^ message digest algorithm to use -> key -- ^ private key to sign the message digest -> L8.ByteString -- ^ input string - -> IO String -- ^ the result signature + -> IO L8.ByteString -- ^ the result signature signLBS md pkey input = do ctx <- digestLazily md input - signFinal ctx pkey + sig <- signFinal ctx pkey + return $ L8.pack sig