Copyright | (c) Marcel Fourné 20[14..] |
---|---|
License | BSD3 |
Maintainer | Marcel Fourné (haskell@marcelfourne.de) |
Stability | alpha |
Portability | Bad |
Safe Haskell | Safe |
Language | Haskell98 |
Short-time plan: custom field arithmetic TODO: optimal const time inversion in 25519, see eccss-20130911b.pdf TODO: convert code to portable implementation and get rid of Integer
Synopsis
- genkeys :: IO (Either String (SecKey, PubKey))
- publickey :: SecKey -> Either String PubKey
- dsign :: SecKey -> Message -> Either String Signature
- sign :: SecKey -> Message -> Either String SignedMessage
- dverify :: PubKey -> Signature -> Message -> VerifyResult
- verify :: PubKey -> SignedMessage -> VerifyResult
- type Message = ByteString
- type PubKey = ByteString
- data SecKey
- type Signature = ByteString
- type SignedMessage = ByteString
- data SigOK = SigOK
- type VerifyResult = Either String SigOK
Documentation
genkeys :: IO (Either String (SecKey, PubKey)) Source #
generate a new key pair (secret and derived public key) using some external entropy | This may be insecure, depending on your environment, so for your usage case you may need to implement some better key generator!
dsign :: SecKey -> Message -> Either String Signature Source #
sign the message m with secret key sk, resulting in a detached signature
sign :: SecKey -> Message -> Either String SignedMessage Source #
sign with secret key the message, resulting in message appended to the signature
dverify :: PubKey -> Signature -> Message -> VerifyResult Source #
in: public key, message and signature, out: is the signature valid for public key and message?
verify :: PubKey -> SignedMessage -> VerifyResult Source #
wrapper around dverify, in case we work with a signed message, i.e. the signature with appended message
type Message = ByteString Source #
just a newtype for the message
type PubKey = ByteString Source #
just a newtype for the public key (string of 32 bytes, b=256 bit)
type Signature = ByteString Source #
just a newtype for the signature (string of 2*32 bytes, b=256 bit)
type SignedMessage = ByteString Source #
just a newtype for the signature with appended message
clear signal that everything is ok