cryptonite-0.27: Cryptography Primitives sink
License BSD-style
Maintainer Vincent Hanquez <vincent@snarc.org>
Stability experimental
Portability Good
Safe Haskell None
Language Haskell2010

Crypto.PubKey.DH

Description

Synopsis

Documentation

data Params Source #

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

Instances

Instances details
Eq Params Source #
Instance details

Defined in Crypto.PubKey.DH

Data Params Source #
Instance details

Defined in Crypto.PubKey.DH

Methods

gfoldl :: ( forall d b. Data d => c (d -> b) -> d -> c b) -> ( forall g. g -> c g) -> Params -> c Params Source #

gunfold :: ( forall b r. Data b => c (b -> r) -> c r) -> ( forall r. r -> c r) -> Constr -> c Params Source #

toConstr :: Params -> Constr Source #

dataTypeOf :: Params -> DataType Source #

dataCast1 :: Typeable t => ( forall d. Data d => c (t d)) -> Maybe (c Params ) Source #

dataCast2 :: Typeable t => ( forall d e. ( Data d, Data e) => c (t d e)) -> Maybe (c Params ) Source #

gmapT :: ( forall b. Data b => b -> b) -> Params -> Params Source #

gmapQl :: (r -> r' -> r) -> r -> ( forall d. Data d => d -> r') -> Params -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> ( forall d. Data d => d -> r') -> Params -> r Source #

gmapQ :: ( forall d. Data d => d -> u) -> Params -> [u] Source #

gmapQi :: Int -> ( forall d. Data d => d -> u) -> Params -> u Source #

gmapM :: Monad m => ( forall d. Data d => d -> m d) -> Params -> m Params Source #

gmapMp :: MonadPlus m => ( forall d. Data d => d -> m d) -> Params -> m Params Source #

gmapMo :: MonadPlus m => ( forall d. Data d => d -> m d) -> Params -> m Params Source #

Read Params Source #
Instance details

Defined in Crypto.PubKey.DH

Show Params Source #
Instance details

Defined in Crypto.PubKey.DH

NFData Params Source #
Instance details

Defined in Crypto.PubKey.DH

newtype PublicNumber Source #

Represent Diffie Hellman public number Y.

Instances

Instances details
Enum PublicNumber Source #
Instance details

Defined in Crypto.PubKey.DH

Eq PublicNumber Source #
Instance details

Defined in Crypto.PubKey.DH

Num PublicNumber Source #
Instance details

Defined in Crypto.PubKey.DH

Ord PublicNumber Source #
Instance details

Defined in Crypto.PubKey.DH

Read PublicNumber Source #
Instance details

Defined in Crypto.PubKey.DH

Real PublicNumber Source #
Instance details

Defined in Crypto.PubKey.DH

Show PublicNumber Source #
Instance details

Defined in Crypto.PubKey.DH

NFData PublicNumber Source #
Instance details

Defined in Crypto.PubKey.DH

newtype PrivateNumber Source #

Represent Diffie Hellman private number X.

Instances

Instances details
Enum PrivateNumber Source #
Instance details

Defined in Crypto.PubKey.DH

Eq PrivateNumber Source #
Instance details

Defined in Crypto.PubKey.DH

Num PrivateNumber Source #
Instance details

Defined in Crypto.PubKey.DH

Ord PrivateNumber Source #
Instance details

Defined in Crypto.PubKey.DH

Read PrivateNumber Source #
Instance details

Defined in Crypto.PubKey.DH

Real PrivateNumber Source #
Instance details

Defined in Crypto.PubKey.DH

Show PrivateNumber Source #
Instance details

Defined in Crypto.PubKey.DH

NFData PrivateNumber Source #
Instance details

Defined in Crypto.PubKey.DH

generateParams Source #

Arguments

:: MonadRandom m
=> Int

number of bits

-> Integer

generator

-> m Params

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