cryptonite-0.10: 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 Integer
- generatePrivate :: MonadRandom m => Curve -> m PrivateNumber
- 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 Source |
Data Curve Source |
Read Curve Source |
Show Curve 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 Source |
Eq SharedKey Source |
Num SharedKey Source |
Ord SharedKey Source |
Read SharedKey Source |
Real SharedKey Source |
Show SharedKey Source |

generatePrivate :: MonadRandom m => Curve -> m PrivateNumber 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.