From: Thomas DuBuisson <thomas.dubuisson@gmail.com>
>>class (Binary p, Serialize p) => AsymCipher p where
>> generateKeypair :: RandomGen g => g -> BitLength -> Maybe ((p,p),g)
>> encryptAsym :: p -> B.ByteString -> B.ByteString
>> decryptAsym :: p -> B.ByteString -> B.ByteString
>> asymKeyLength :: p -> BitLength
>
> Regarding AsymCipher:
> Some algorithms do not lend themselves to encryption/decryption or have
> special properties which differentiate their use in enc/dec an
> signing/verifying.
>
> I propose the following two additions for the class:
> signAsym :: p -> B.ByteString -> B.ByteString
> verifyAsym :: p -> B.ByteString -> Bool
>
> This way algorithms can leave parts undefined which do not apply to
> them or hide their different behaviour.
I am strongly against classes for which we already know instanes will
need a good deal of undefined routines.
I agree. However, you could just make separate type class for these methods.
John Lato