crypto-pubkey-0.2.8: Public Key cryptography

Safe Haskell | None
Language | Haskell98

Crypto.PubKey.ECC.DH

Synopsis

- data Curve
- type PublicPoint = Point
- type PrivateNumber = Integer
- newtype SharedKey = SharedKey Integer
- generatePrivate :: CPRG g => g -> Curve -> (PrivateNumber, g)
- calculatePublic :: Curve -> PrivateNumber -> PublicPoint
- getShared :: Curve -> PrivateNumber -> PublicPoint -> SharedKey

# Documentation

data Curve Source #

Define either a binary curve or a prime curve.

#### Instances

Instances details

Eq Curve |
Instance details Defined in Crypto.Types.PubKey.ECC Methods (==) :: Curve -> Curve -> Bool (/=) :: Curve -> Curve -> Bool
Data Curve |

Instance details

Defined in Crypto.Types.PubKey.ECC

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Curve -> c Curve

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Curve

toConstr :: Curve -> Constr

dataTypeOf :: Curve -> DataType

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Curve)

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

gmapT :: (forall b. Data b => b -> b) -> Curve -> Curve

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Curve -> r

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Curve -> r

gmapQ :: (forall d. Data d => d -> u) -> Curve -> [u]

gmapQi :: Int -> (forall d. Data d => d -> u) -> Curve -> u

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Curve -> m Curve

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Curve -> m Curve

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Curve -> m Curve

Read Curve |
Instance details Defined in Crypto.Types.PubKey.ECC Methods readsPrec :: Int -> ReadS Curve readList :: ReadS [Curve] readPrec :: ReadPrec Curve readListPrec :: ReadPrec [Curve]
Show Curve |
Instance details Defined in Crypto.Types.PubKey.ECC Methods showsPrec :: Int -> Curve -> ShowS show :: Curve -> String showList :: [Curve] -> ShowS

type PublicPoint = Point Source #

ECC Public Point

type PrivateNumber = Integer Source #

ECC Private Number

newtype SharedKey Source #

Represent Diffie Hellman shared secret.

Constructors

SharedKey Integer |

#### Instances

Instances details

Enum SharedKey |
Instance details Defined in Crypto.Types.PubKey.DH Methods succ :: SharedKey -> SharedKey pred :: SharedKey -> SharedKey toEnum :: Int -> SharedKey fromEnum :: SharedKey -> Int enumFrom :: SharedKey -> [SharedKey] enumFromThen :: SharedKey -> SharedKey -> [SharedKey] enumFromTo :: SharedKey -> SharedKey -> [SharedKey] enumFromThenTo :: SharedKey -> SharedKey -> SharedKey -> [SharedKey]
Eq SharedKey |
Instance details Defined in Crypto.Types.PubKey.DH Methods (==) :: SharedKey -> SharedKey -> Bool (/=) :: SharedKey -> SharedKey -> Bool
Num SharedKey |
Instance details Defined in Crypto.Types.PubKey.DH Methods (+) :: SharedKey -> SharedKey -> SharedKey (-) :: SharedKey -> SharedKey -> SharedKey (*) :: SharedKey -> SharedKey -> SharedKey negate :: SharedKey -> SharedKey abs :: SharedKey -> SharedKey signum :: SharedKey -> SharedKey fromInteger :: Integer -> SharedKey
Ord SharedKey |
Instance details Defined in Crypto.Types.PubKey.DH Methods compare :: SharedKey -> SharedKey -> Ordering (<) :: SharedKey -> SharedKey -> Bool (<=) :: SharedKey -> SharedKey -> Bool (>) :: SharedKey -> SharedKey -> Bool (>=) :: SharedKey -> SharedKey -> Bool max :: SharedKey -> SharedKey -> SharedKey min :: SharedKey -> SharedKey -> SharedKey
Read SharedKey |
Instance details Defined in Crypto.Types.PubKey.DH Methods readsPrec :: Int -> ReadS SharedKey readList :: ReadS [SharedKey] readPrec :: ReadPrec SharedKey readListPrec :: ReadPrec [SharedKey]
Real SharedKey |
Instance details Defined in Crypto.Types.PubKey.DH Methods toRational :: SharedKey -> Rational
Show SharedKey |
Instance details Defined in Crypto.Types.PubKey.DH Methods showsPrec :: Int -> SharedKey -> ShowS show :: SharedKey -> String showList :: [SharedKey] -> ShowS

generatePrivate :: CPRG g => g -> Curve -> (PrivateNumber, g) Source #

Generating a private number d.

calculatePublic :: Curve -> PrivateNumber -> PublicPoint Source #

Generating a public point Q.

getShared :: Curve -> PrivateNumber -> PublicPoint -> SharedKey Source #

Generating a shared key using our private number and the other party public point.