cryptonite-0.21: Cryptography Primitives sink

Safe HaskellNone
LanguageHaskell2010

Crypto.PubKey.ECC.ECDSA

Description

WARNING: Signature operations may leak the private key. Signature verification should be safe.

Synopsis

Documentation

data Signature

Represent a ECDSA signature namely R and S.

Constructors

Signature 

Fields

sign_r :: Integer

ECDSA r

sign_s :: Integer

ECDSA s

type PublicPoint = Point

ECC Public Point

data PublicKey

ECDSA Public Key.

Constructors

PublicKey 

type PrivateNumber = Integer

ECC Private Number

data PrivateKey

ECDSA Private Key.

data KeyPair

ECDSA Key Pair.

toPublicKey :: KeyPair -> PublicKey

Public key of a ECDSA Key pair.

toPrivateKey :: KeyPair -> PrivateKey

Private key of a ECDSA Key pair.

signWith

Arguments

:: (ByteArrayAccess msg, HashAlgorithm hash) 
=> Integer

k random number

-> PrivateKey

private key

-> hash

hash function

-> msg

message to sign

-> Maybe Signature 

Sign message using the private key and an explicit k number.

WARNING: Vulnerable to timing attacks.

sign :: (ByteArrayAccess msg, HashAlgorithm hash, MonadRandom m) => PrivateKey -> hash -> msg -> m Signature

Sign message using the private key.

WARNING: Vulnerable to timing attacks.

verify :: (ByteArrayAccess msg, HashAlgorithm hash) => hash -> PublicKey -> Signature -> msg -> Bool

Verify a bytestring using the public key.