eccrypto-0.1.0: Elliptic Curve Cryptography for Haskell

Copyright(c) Marcel Fourné 20[14..]
LicenseBSD3
MaintainerMarcel Fourné (haskell@marcelfourne.de)
Stabilityalpha
PortabilityBad
Safe HaskellTrustworthy
LanguageHaskell98

Crypto.ECC.Ed25519.Sign

Description

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

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!

publickey :: SecKey -> Either String PubKey Source #

derive public key from secret key

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)

data SecKey Source #

just a wrapper for the secret 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

data SigOK Source #

clear signal that everything is ok

Constructors

SigOK 
Instances
Eq SigOK Source # 
Instance details

Defined in Crypto.ECC.Ed25519.Internal.Ed25519

Methods

(==) :: SigOK -> SigOK -> Bool #

(/=) :: SigOK -> SigOK -> Bool #

Show SigOK Source # 
Instance details

Defined in Crypto.ECC.Ed25519.Internal.Ed25519

Methods

showsPrec :: Int -> SigOK -> ShowS #

show :: SigOK -> String #

showList :: [SigOK] -> ShowS #

type VerifyResult = Either String SigOK Source #

Result of verifying a signature should only yield if it's good or bad, not more, but contains an error string if underlying primitives failed