Re: [Haskell-cafe] Re: Codec.Crypto.RSA question

2010-11-21 Thread Charles-Pierre Astolfi
Thanks Mat, it works, but I still have a problem: I'm heavily using Data.Binary.encode for various types (Int32, Int8, String, Bool...) and I don't know how I should manage this using Data.ByteString.Lazy.Char8. -- Cp On Sat, Nov 20, 2010 at 22:35, Mathias Weber mat_we...@t-online.de wrote:

Re: [Haskell-cafe] Re: Codec.Crypto.RSA question

2010-11-21 Thread Mathias Weber
Then how about using encode (as in your original example) and decode (both from Data.Binary). IMO it's garanteed that decode . encode = id (at least for the standard types). ... decrypt :: Data.ByteString.Lazy.ByteString - String decrypt = decode . Crypto.decrypt privKey ... Am 21.11.2010

[Haskell-cafe] Re: Codec.Crypto.RSA question

2010-11-20 Thread Dominic Steinitz
Charles-Pierre Astolfi cpa at crans.org writes: Hi -cafe, I have a question about Codec.Crypto.RSA: how to enforce that (informally) decrypt . encrypt = id Consider this code: That's certainly what I would expect and one of the unit tests that comes with

Re: [Haskell-cafe] Re: Codec.Crypto.RSA question

2010-11-20 Thread Charles-Pierre Astolfi
Here's a working example: import qualified Codec.Crypto.RSA as Crypto import System.Random (mkStdGen) import Data.Binary (encode) import Data.ByteString.Lazy.UTF8 (toString) n = 1024 (pubKey,privKey,_) = Crypto.generateKeyPair (mkStdGen n) n encrypt :: (Data.Binary.Binary a) = a -

Re: [Haskell-cafe] Re: Codec.Crypto.RSA question

2010-11-20 Thread Dominic Steintiz
Charles-Pierre Astolfi wrote: Here's a working example: import qualified Codec.Crypto.RSA as Crypto import System.Random (mkStdGen) import Data.Binary (encode) import Data.ByteString.Lazy.UTF8 (toString) n = 1024 (pubKey,privKey,_) = Crypto.generateKeyPair (mkStdGen n) n encrypt ::

Re: [Haskell-cafe] Re: Codec.Crypto.RSA question

2010-11-20 Thread Mathias Weber
The problem in this example is the use of Data.Binary. When using Data.ByteString.Lazy.Char8 instead, the problem does not exist. import qualified Codec.Crypto.RSA as Crypto import System.Random (mkStdGen) import Data.ByteString.Lazy.UTF8 (toString) import qualified Data.ByteString.Lazy.Char8 as