cryptonite-0.22: Cryptography Primitives sink

LicenseBSD-style
MaintainerVincent Hanquez <vincent@snarc.org>
Stabilityexperimental
Portabilityunknown
Safe HaskellNone
LanguageHaskell2010

Crypto.ECC

Description

Elliptic Curve Cryptography

Synopsis

Documentation

class EllipticCurve curve where Source #

Associated Types

type Point curve :: * Source #

Point on an Elliptic Curve

type Scalar curve :: * Source #

Scalar in the Elliptic Curve domain

Methods

curveGenerateScalar :: MonadRandom randomly => proxy curve -> randomly (Scalar curve) Source #

Generate a new random scalar on the curve. The scalar will represent a number between 1 and the order of the curve non included

curveGenerateKeyPair :: MonadRandom randomly => proxy curve -> randomly (KeyPair curve) Source #

Generate a new random keypair

curveSizeBits :: proxy curve -> Int Source #

Get the curve size in bits

encodePoint :: ByteArray bs => proxy curve -> Point curve -> bs Source #

Encode a elliptic curve point into binary form

decodePoint :: ByteArray bs => proxy curve -> bs -> CryptoFailable (Point curve) Source #

Try to decode the binary form of an elliptic curve point

Instances

EllipticCurve Curve_X448 Source # 
EllipticCurve Curve_X25519 Source # 
EllipticCurve Curve_P521R1 Source # 
EllipticCurve Curve_P384R1 Source # 
EllipticCurve Curve_P256R1 Source # 

class EllipticCurve curve => EllipticCurveDH curve where Source #

Minimal complete definition

ecdh

Methods

ecdh :: proxy curve -> Scalar curve -> Point curve -> SharedSecret Source #

Generate a Diffie hellman secret value.

This is generally just the .x coordinate of the resulting point, that is not hashed.

use pointSmul to keep the result in Point format.

data KeyPair curve Source #

An elliptic curve key pair composed of the private part (a scalar), and the associated point.

Constructors

KeyPair 

Fields