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

Eq Curve |
Instance details Defined in Crypto.Types.PubKey.ECC Methods (==) :: Curve -> Curve -> Bool Source # (/=) :: Curve -> Curve -> Bool Source #
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 Source #

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

toConstr :: Curve -> Constr Source #

dataTypeOf :: Curve -> DataType Source #

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

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

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

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

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

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

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

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

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

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

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

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

Enum SharedKey |

Instance details

Defined in Crypto.Types.PubKey.DH

Methods

succ :: SharedKey -> SharedKey Source #

pred :: SharedKey -> SharedKey Source #

toEnum :: Int -> SharedKey Source #

fromEnum :: SharedKey -> Int Source #

enumFrom :: SharedKey -> [SharedKey] Source #

enumFromThen :: SharedKey -> SharedKey -> [SharedKey] Source #

enumFromTo :: SharedKey -> SharedKey -> [SharedKey] Source #

enumFromThenTo :: SharedKey -> SharedKey -> SharedKey -> [SharedKey] Source #

Eq SharedKey |
Instance details Defined in Crypto.Types.PubKey.DH Methods (==) :: SharedKey -> SharedKey -> Bool Source # (/=) :: SharedKey -> SharedKey -> Bool Source #
Num SharedKey |
Instance details Defined in Crypto.Types.PubKey.DH Methods (+) :: SharedKey -> SharedKey -> SharedKey Source # (-) :: SharedKey -> SharedKey -> SharedKey Source # (*) :: SharedKey -> SharedKey -> SharedKey Source # negate :: SharedKey -> SharedKey Source # abs :: SharedKey -> SharedKey Source # signum :: SharedKey -> SharedKey Source # fromInteger :: Integer -> SharedKey Source #
Ord SharedKey |

Instance details

Defined in Crypto.Types.PubKey.DH

Methods

compare :: SharedKey -> SharedKey -> Ordering Source #

(<) :: SharedKey -> SharedKey -> Bool Source #

(<=) :: SharedKey -> SharedKey -> Bool Source #

(>) :: SharedKey -> SharedKey -> Bool Source #

(>=) :: SharedKey -> SharedKey -> Bool Source #

max :: SharedKey -> SharedKey -> SharedKey Source #

min :: SharedKey -> SharedKey -> SharedKey Source #

Read SharedKey |
Instance details Defined in Crypto.Types.PubKey.DH Methods readsPrec :: Int -> ReadS SharedKey Source # readList :: ReadS [SharedKey] Source # readPrec :: ReadPrec SharedKey Source # readListPrec :: ReadPrec [SharedKey] Source #
Real SharedKey |
Instance details Defined in Crypto.Types.PubKey.DH Methods toRational :: SharedKey -> Rational Source #
Show SharedKey |
Instance details Defined in Crypto.Types.PubKey.DH Methods showsPrec :: Int -> SharedKey -> ShowS Source # show :: SharedKey -> String Source # showList :: [SharedKey] -> ShowS Source #

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.