Crypto.PubKey.ECC.DH

crypton-1.0.1: Cryptography Primitives sink

License | BSD-style
Maintainer | Vincent Hanquez <vincent@snarc.org>
Stability | experimental
Portability | unknown
Safe Haskell | None
Language | Haskell2010

Crypto.PubKey.ECC.DH

Description

Elliptic curve Diffie Hellman

Synopsis

- data Curve
- type PublicPoint = Point
- type PrivateNumber = Integer
- newtype SharedKey = SharedKey ScrubbedBytes
- generatePrivate :: MonadRandom m => Curve -> m PrivateNumber
- calculatePublic :: Curve -> PrivateNumber -> PublicPoint
- getShared :: Curve -> PrivateNumber -> PublicPoint -> SharedKey

# Documentation

data Curve #

Define either a binary curve or a prime curve.

#### Instances

Instances details

Data Curve # |
Instance details Defined in Crypto.PubKey.ECC.Types 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.PubKey.ECC.Types Methods readsPrec :: Int -> ReadS Curve # readList :: ReadS [Curve] # readPrec :: ReadPrec Curve # readListPrec :: ReadPrec [Curve] #
Show Curve # |
Instance details Defined in Crypto.PubKey.ECC.Types Methods showsPrec :: Int -> Curve -> ShowS # show :: Curve -> String # showList :: [Curve] -> ShowS #
Eq Curve # |
Instance details Defined in Crypto.PubKey.ECC.Types Methods (==) :: Curve -> Curve -> Bool # (/=) :: Curve -> Curve -> Bool #

type PublicPoint = Point #

ECC Public Point

type PrivateNumber = Integer #

ECC Private Number

newtype SharedKey #

Represent Diffie Hellman shared secret.

Constructors

SharedKey ScrubbedBytes |

#### Instances

Instances details

NFData SharedKey # |
Instance details Defined in Crypto.PubKey.DH Methods rnf :: SharedKey -> () #
Show SharedKey # |
Instance details Defined in Crypto.PubKey.DH Methods showsPrec :: Int -> SharedKey -> ShowS # show :: SharedKey -> String # showList :: [SharedKey] -> ShowS #
Eq SharedKey # |
Instance details Defined in Crypto.PubKey.DH Methods (==) :: SharedKey -> SharedKey -> Bool # (/=) :: SharedKey -> SharedKey -> Bool #
ByteArrayAccess SharedKey # |
Instance details Defined in Crypto.PubKey.DH Methods length :: SharedKey -> Int # withByteArray :: SharedKey -> (Ptr p -> IO a) -> IO a # copyByteArrayToPtr :: SharedKey -> Ptr p -> IO () #

generatePrivate :: MonadRandom m => Curve -> m PrivateNumber #

Generating a private number d.

calculatePublic :: Curve -> PrivateNumber -> PublicPoint #

Generating a public point Q.

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

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