Copyright | (c) Marcel Fourné 20[14..] |
---|---|
License | BSD3 |
Maintainer | Marcel Fourné (haskell@marcelfourne.de) |
Stability | alpha |
Portability | Bad |
Safe Haskell | Trustworthy |
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 :: CryptoRandomGen g => g -> Either String (SecKey, PubKey)
- genkeysSimple :: 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 :: CryptoRandomGen g => g -> Either String (SecKey, PubKey) Source #
generate a new key pair (secret and derived public key) using the supplied randomness-generator
genkeysSimple :: 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 it's better to use the genkeys function and supply a random number generator which is secure for your usage case!
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