Skip to content

Commit

Permalink
Suggestion by Grant Monroe:
Browse files Browse the repository at this point in the history
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
  • Loading branch information
depressed-pho committed Jul 13, 2009
1 parent d4eaa84 commit 1388e86
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
2 changes: 1 addition & 1 deletion HsOpenSSL.cabal
Expand Up @@ -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 <agl at imperialviolet.org>, PHO <pho at cielonegro.org>
Expand Down
15 changes: 15 additions & 0 deletions 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:
Expand Down
12 changes: 7 additions & 5 deletions OpenSSL/EVP/Sign.hsc
Expand Up @@ -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

0 comments on commit 1388e86

Please sign in to comment.