cryptonite-0.27: Cryptography Primitives sink

Crypto.PubKey.DH

Description

Synopsis

# Documentation

data Params Source #

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

Constructors

 Params Fieldsparams_p :: Integer params_g :: Integer params_bits :: Int
Instances
 Source # Instance detailsDefined in Crypto.PubKey.DH Methods(==) :: Params -> Params -> Bool #(/=) :: Params -> Params -> Bool # Source # Instance detailsDefined in Crypto.PubKey.DH Methodsgfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Params -> c Params #gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Params #dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Params) #dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Params) #gmapT :: (forall b. Data b => b -> b) -> Params -> Params #gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Params -> r #gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Params -> r #gmapQ :: (forall d. Data d => d -> u) -> Params -> [u] #gmapQi :: Int -> (forall d. Data d => d -> u) -> Params -> u #gmapM :: Monad m => (forall d. Data d => d -> m d) -> Params -> m Params #gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Params -> m Params #gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Params -> m Params # Source # Instance detailsDefined in Crypto.PubKey.DH Methods Source # Instance detailsDefined in Crypto.PubKey.DH MethodsshowsPrec :: Int -> Params -> ShowS #showList :: [Params] -> ShowS # Source # Instance detailsDefined in Crypto.PubKey.DH Methodsrnf :: Params -> () #

newtype PublicNumber Source #

Represent Diffie Hellman public number Y.

Constructors

 PublicNumber Integer
Instances
 Source # Instance detailsDefined in Crypto.PubKey.DH Methods Source # Instance detailsDefined in Crypto.PubKey.DH Methods Source # Instance detailsDefined in Crypto.PubKey.DH Methods Source # Instance detailsDefined in Crypto.PubKey.DH Methods Source # Instance detailsDefined in Crypto.PubKey.DH Methods Source # Instance detailsDefined in Crypto.PubKey.DH Methods Source # Instance detailsDefined in Crypto.PubKey.DH MethodsshowList :: [PublicNumber] -> ShowS # Source # Instance detailsDefined in Crypto.PubKey.DH Methodsrnf :: PublicNumber -> () #

newtype PrivateNumber Source #

Represent Diffie Hellman private number X.

Constructors

 PrivateNumber Integer
Instances
 Source # Instance detailsDefined in Crypto.PubKey.DH Methods Source # Instance detailsDefined in Crypto.PubKey.DH Methods Source # Instance detailsDefined in Crypto.PubKey.DH Methods Source # Instance detailsDefined in Crypto.PubKey.DH Methods Source # Instance detailsDefined in Crypto.PubKey.DH Methods Source # Instance detailsDefined in Crypto.PubKey.DH Methods Source # Instance detailsDefined in Crypto.PubKey.DH MethodsshowList :: [PrivateNumber] -> ShowS # Source # Instance detailsDefined in Crypto.PubKey.DH Methodsrnf :: PrivateNumber -> () #

newtype SharedKey Source #

Represent Diffie Hellman shared secret.

Constructors

 SharedKey ScrubbedBytes
Instances
 Source # Instance detailsDefined in Crypto.PubKey.DH Methods Source # Instance detailsDefined in Crypto.PubKey.DH MethodsshowList :: [SharedKey] -> ShowS # Source # Instance detailsDefined in Crypto.PubKey.DH Methodsrnf :: SharedKey -> () # Source # Instance detailsDefined in Crypto.PubKey.DH MethodswithByteArray :: SharedKey -> (Ptr p -> IO a) -> IO a #copyByteArrayToPtr :: SharedKey -> Ptr p -> IO () #

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)

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

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

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

DEPRECATED use calculatePublic

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