cryptonite-0.7: Cryptography Primitives sink

LicenseBSD-style
MaintainerVincent Hanquez <vincent@snarc.org>
Stabilityexperimental
PortabilityGood
Safe HaskellNone
LanguageHaskell2010

Crypto.PubKey.DH

Description

 

Synopsis

Documentation

data Params Source

Represent Diffie Hellman parameters namely P (prime), and G (generator).

Constructors

Params 

newtype SharedKey Source

Represent Diffie Hellman shared secret.

Constructors

SharedKey Integer 

generateParams :: MonadRandom m => Int -> Integer -> m Params Source

generate params from a specific generator (2 or 5 are common values) we generate a safe prime (a prime number of the form 2p+1 where p is also prime)

generatePrivate :: MonadRandom m => Params -> m PrivateNumber Source

generate a private number with no specific property this number is usually called X in DH text.

calculatePublic :: Params -> PrivateNumber -> PublicNumber Source

calculate the public number from the parameters and the private key this number is usually called Y in DH text.

generatePublic :: Params -> PrivateNumber -> PublicNumber Source

calculate the public number from the parameters and the private key this number is usually called Y in DH text.

DEPRECATED use calculatePublic

getShared :: Params -> PrivateNumber -> PublicNumber -> SharedKey Source

generate a shared key using our private number and the other party public number