Notes

ECDSA

Elliptic Curve Digital Signature Algorithm

ECDSA1 won’t encrypt the message, but just generate signature from sender’s private key.

The following example is how Alice sign the message with ECDSA on Curve25519 with her private key, and Bob can verify the message is from Alice public key.

ghci> import Crypto.PubKey.ECC.ECDSA
ghci> import Crypto.PubKey.ECC.Generate
ghci> import Crypto.Hash.Algorithms
ghci> do
ghci| (alicePublicKey, alicePrivateKey) <- generate curve
ghci| toBob <- sign alicePrivateKey SHA256 ("message to Bob"::ByteString)
ghci| return $ verify SHA256 alicePublicKey toBob ("message to Bob"::ByteString)
ghci|
True