RSA
RSA
RSA1 is the most popular public key crypto, the following is a example of digital sign message with 2048-bit RSA key, in RSASSA-PKCS1-v1_5 scheme SHA256:
ghci> import Crypto.PubKey.RSA
ghci> import Crypto.PubKey.RSA.PKCS15
ghci> import Crypto.Hash.Algorithms
ghci> (publicKey, privateKey) <- generate 256 65537
ghci> let (Right signature) = sign Nothing (Just SHA256) privateKey ("to Bob"::ByteString)
ghci> verify (Just SHA256) publicKey ("to Bob"::ByteString) signature