cryptonite-0.30: Cryptography Primitives sink

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

Crypto.ECC

Description

Elliptic Curve Cryptography

Synopsis

- data Curve_P256R1 = Curve_P256R1
- data Curve_P384R1 = Curve_P384R1
- data Curve_P521R1 = Curve_P521R1
- data Curve_X25519 = Curve_X25519
- data Curve_X448 = Curve_X448
- data Curve_Edwards25519 = Curve_Edwards25519
- class EllipticCurve curve where
  - type Point curve :: Type
  - type Scalar curve :: Type
  - curveGenerateScalar :: MonadRandom randomly => proxy curve -> randomly (Scalar curve)
  - curveGenerateKeyPair :: MonadRandom randomly => proxy curve -> randomly (KeyPair curve)
  - curveSizeBits :: proxy curve -> Int
  - encodePoint :: ByteArray bs => proxy curve -> Point curve -> bs
  - decodePoint :: ByteArray bs => proxy curve -> bs -> CryptoFailable (Point curve)
- class EllipticCurve curve => EllipticCurveDH curve where
  - ecdhRaw :: proxy curve -> Scalar curve -> Point curve -> SharedSecret
  - ecdh :: proxy curve -> Scalar curve -> Point curve -> CryptoFailable SharedSecret
- class (EllipticCurve curve, Eq (Point curve)) => EllipticCurveArith curve where
  - pointAdd :: proxy curve -> Point curve -> Point curve -> Point curve
  - pointNegate :: proxy curve -> Point curve -> Point curve
  - pointSmul :: proxy curve -> Scalar curve -> Point curve -> Point curve
- class (EllipticCurveArith curve, Eq (Scalar curve)) => EllipticCurveBasepointArith curve where
  - curveOrderBits :: proxy curve -> Int
  - pointBaseSmul :: proxy curve -> Scalar curve -> Point curve
  - pointsSmulVarTime :: proxy curve -> Scalar curve -> Scalar curve -> Point curve -> Point curve
  - encodeScalar :: ByteArray bs => proxy curve -> Scalar curve -> bs
  - decodeScalar :: ByteArray bs => proxy curve -> bs -> CryptoFailable (Scalar curve)
  - scalarToInteger :: proxy curve -> Scalar curve -> Integer
  - scalarFromInteger :: proxy curve -> Integer -> CryptoFailable (Scalar curve)
  - scalarAdd :: proxy curve -> Scalar curve -> Scalar curve -> Scalar curve
  - scalarMul :: proxy curve -> Scalar curve -> Scalar curve -> Scalar curve
- data KeyPair curve = KeyPair {
  - keypairGetPublic :: !(Point curve)
  - keypairGetPrivate :: !(Scalar curve)
  }
- newtype SharedSecret = SharedSecret ScrubbedBytes

# Documentation

data Curve_P256R1 Source #

P256 Curve

also known as P256

Constructors

Curve_P256R1 |

#### Instances

Instances details

Data Curve_P256R1 Source # |

Instance details

Defined in Crypto.ECC

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Curve_P256R1 -> c Curve_P256R1 Source #

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

toConstr :: Curve_P256R1 -> Constr Source #

dataTypeOf :: Curve_P256R1 -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Show Curve_P256R1 Source # |
Instance details Defined in Crypto.ECC Methods showsPrec :: Int -> Curve_P256R1 -> ShowS Source # show :: Curve_P256R1 -> String Source # showList :: [Curve_P256R1] -> ShowS Source #
EllipticCurve Curve_P256R1 Source # |

Instance details

Defined in Crypto.ECC

Associated Types

type Point Curve_P256R1 Source #

type Scalar Curve_P256R1 Source #

Methods

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

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

curveSizeBits :: proxy Curve_P256R1 -> Int Source #

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

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

EllipticCurveArith Curve_P256R1 Source # |
Instance details Defined in Crypto.ECC Methods pointAdd :: proxy Curve_P256R1 -> Point Curve_P256R1 -> Point Curve_P256R1 -> Point Curve_P256R1 Source # pointNegate :: proxy Curve_P256R1 -> Point Curve_P256R1 -> Point Curve_P256R1 Source # pointSmul :: proxy Curve_P256R1 -> Scalar Curve_P256R1 -> Point Curve_P256R1 -> Point Curve_P256R1 Source #
EllipticCurveBasepointArith Curve_P256R1 Source # |

Instance details

Defined in Crypto.ECC

Methods

curveOrderBits :: proxy Curve_P256R1 -> Int Source #

pointBaseSmul :: proxy Curve_P256R1 -> Scalar Curve_P256R1 -> Point Curve_P256R1 Source #

pointsSmulVarTime :: proxy Curve_P256R1 -> Scalar Curve_P256R1 -> Scalar Curve_P256R1 -> Point Curve_P256R1 -> Point Curve_P256R1 Source #

encodeScalar :: ByteArray bs => proxy Curve_P256R1 -> Scalar Curve_P256R1 -> bs Source #

decodeScalar :: ByteArray bs => proxy Curve_P256R1 -> bs -> CryptoFailable (Scalar Curve_P256R1) Source #

scalarToInteger :: proxy Curve_P256R1 -> Scalar Curve_P256R1 -> Integer Source #

scalarFromInteger :: proxy Curve_P256R1 -> Integer -> CryptoFailable (Scalar Curve_P256R1) Source #

scalarAdd :: proxy Curve_P256R1 -> Scalar Curve_P256R1 -> Scalar Curve_P256R1 -> Scalar Curve_P256R1 Source #

scalarMul :: proxy Curve_P256R1 -> Scalar Curve_P256R1 -> Scalar Curve_P256R1 -> Scalar Curve_P256R1 Source #

EllipticCurveDH Curve_P256R1 Source # |
Instance details Defined in Crypto.ECC Methods ecdhRaw :: proxy Curve_P256R1 -> Scalar Curve_P256R1 -> Point Curve_P256R1 -> SharedSecret Source # ecdh :: proxy Curve_P256R1 -> Scalar Curve_P256R1 -> Point Curve_P256R1 -> CryptoFailable SharedSecret Source #
EllipticCurveECDSA Curve_P256R1 Source # |
Instance details Defined in Crypto.PubKey.ECDSA Methods scalarIsValid :: proxy Curve_P256R1 -> Scalar Curve_P256R1 -> Bool Source # scalarIsZero :: proxy Curve_P256R1 -> Scalar Curve_P256R1 -> Bool Source # scalarInv :: proxy Curve_P256R1 -> Scalar Curve_P256R1 -> Maybe (Scalar Curve_P256R1) Source # pointX :: proxy Curve_P256R1 -> Point Curve_P256R1 -> Maybe (Scalar Curve_P256R1) Source #
type Point Curve_P256R1 Source # |
Instance details Defined in Crypto.ECC type Point Curve_P256R1 = Point
type Scalar Curve_P256R1 Source # |
Instance details Defined in Crypto.ECC type Scalar Curve_P256R1 = Scalar

data Curve_P384R1 Source #

Constructors

Curve_P384R1 |

#### Instances

Instances details

Data Curve_P384R1 Source # |

Instance details

Defined in Crypto.ECC

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Curve_P384R1 -> c Curve_P384R1 Source #

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

toConstr :: Curve_P384R1 -> Constr Source #

dataTypeOf :: Curve_P384R1 -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Show Curve_P384R1 Source # |
Instance details Defined in Crypto.ECC Methods showsPrec :: Int -> Curve_P384R1 -> ShowS Source # show :: Curve_P384R1 -> String Source # showList :: [Curve_P384R1] -> ShowS Source #
EllipticCurve Curve_P384R1 Source # |

Instance details

Defined in Crypto.ECC

Associated Types

type Point Curve_P384R1 Source #

type Scalar Curve_P384R1 Source #

Methods

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

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

curveSizeBits :: proxy Curve_P384R1 -> Int Source #

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

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

EllipticCurveArith Curve_P384R1 Source # |
Instance details Defined in Crypto.ECC Methods pointAdd :: proxy Curve_P384R1 -> Point Curve_P384R1 -> Point Curve_P384R1 -> Point Curve_P384R1 Source # pointNegate :: proxy Curve_P384R1 -> Point Curve_P384R1 -> Point Curve_P384R1 Source # pointSmul :: proxy Curve_P384R1 -> Scalar Curve_P384R1 -> Point Curve_P384R1 -> Point Curve_P384R1 Source #
EllipticCurveBasepointArith Curve_P384R1 Source # |

Instance details

Defined in Crypto.ECC

Methods

curveOrderBits :: proxy Curve_P384R1 -> Int Source #

pointBaseSmul :: proxy Curve_P384R1 -> Scalar Curve_P384R1 -> Point Curve_P384R1 Source #

pointsSmulVarTime :: proxy Curve_P384R1 -> Scalar Curve_P384R1 -> Scalar Curve_P384R1 -> Point Curve_P384R1 -> Point Curve_P384R1 Source #

encodeScalar :: ByteArray bs => proxy Curve_P384R1 -> Scalar Curve_P384R1 -> bs Source #

decodeScalar :: ByteArray bs => proxy Curve_P384R1 -> bs -> CryptoFailable (Scalar Curve_P384R1) Source #

scalarToInteger :: proxy Curve_P384R1 -> Scalar Curve_P384R1 -> Integer Source #

scalarFromInteger :: proxy Curve_P384R1 -> Integer -> CryptoFailable (Scalar Curve_P384R1) Source #

scalarAdd :: proxy Curve_P384R1 -> Scalar Curve_P384R1 -> Scalar Curve_P384R1 -> Scalar Curve_P384R1 Source #

scalarMul :: proxy Curve_P384R1 -> Scalar Curve_P384R1 -> Scalar Curve_P384R1 -> Scalar Curve_P384R1 Source #

EllipticCurveDH Curve_P384R1 Source # |
Instance details Defined in Crypto.ECC Methods ecdhRaw :: proxy Curve_P384R1 -> Scalar Curve_P384R1 -> Point Curve_P384R1 -> SharedSecret Source # ecdh :: proxy Curve_P384R1 -> Scalar Curve_P384R1 -> Point Curve_P384R1 -> CryptoFailable SharedSecret Source #
EllipticCurveECDSA Curve_P384R1 Source # |
Instance details Defined in Crypto.PubKey.ECDSA Methods scalarIsValid :: proxy Curve_P384R1 -> Scalar Curve_P384R1 -> Bool Source # scalarIsZero :: proxy Curve_P384R1 -> Scalar Curve_P384R1 -> Bool Source # scalarInv :: proxy Curve_P384R1 -> Scalar Curve_P384R1 -> Maybe (Scalar Curve_P384R1) Source # pointX :: proxy Curve_P384R1 -> Point Curve_P384R1 -> Maybe (Scalar Curve_P384R1) Source #
type Point Curve_P384R1 Source # |
Instance details Defined in Crypto.ECC type Point Curve_P384R1
type Scalar Curve_P384R1 Source # |
Instance details Defined in Crypto.ECC type Scalar Curve_P384R1

data Curve_P521R1 Source #

Constructors

Curve_P521R1 |

#### Instances

Instances details

Data Curve_P521R1 Source # |

Instance details

Defined in Crypto.ECC

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Curve_P521R1 -> c Curve_P521R1 Source #

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

toConstr :: Curve_P521R1 -> Constr Source #

dataTypeOf :: Curve_P521R1 -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Show Curve_P521R1 Source # |
Instance details Defined in Crypto.ECC Methods showsPrec :: Int -> Curve_P521R1 -> ShowS Source # show :: Curve_P521R1 -> String Source # showList :: [Curve_P521R1] -> ShowS Source #
EllipticCurve Curve_P521R1 Source # |

Instance details

Defined in Crypto.ECC

Associated Types

type Point Curve_P521R1 Source #

type Scalar Curve_P521R1 Source #

Methods

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

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

curveSizeBits :: proxy Curve_P521R1 -> Int Source #

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

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

EllipticCurveArith Curve_P521R1 Source # |
Instance details Defined in Crypto.ECC Methods pointAdd :: proxy Curve_P521R1 -> Point Curve_P521R1 -> Point Curve_P521R1 -> Point Curve_P521R1 Source # pointNegate :: proxy Curve_P521R1 -> Point Curve_P521R1 -> Point Curve_P521R1 Source # pointSmul :: proxy Curve_P521R1 -> Scalar Curve_P521R1 -> Point Curve_P521R1 -> Point Curve_P521R1 Source #
EllipticCurveBasepointArith Curve_P521R1 Source # |

Instance details

Defined in Crypto.ECC

Methods

curveOrderBits :: proxy Curve_P521R1 -> Int Source #

pointBaseSmul :: proxy Curve_P521R1 -> Scalar Curve_P521R1 -> Point Curve_P521R1 Source #

pointsSmulVarTime :: proxy Curve_P521R1 -> Scalar Curve_P521R1 -> Scalar Curve_P521R1 -> Point Curve_P521R1 -> Point Curve_P521R1 Source #

encodeScalar :: ByteArray bs => proxy Curve_P521R1 -> Scalar Curve_P521R1 -> bs Source #

decodeScalar :: ByteArray bs => proxy Curve_P521R1 -> bs -> CryptoFailable (Scalar Curve_P521R1) Source #

scalarToInteger :: proxy Curve_P521R1 -> Scalar Curve_P521R1 -> Integer Source #

scalarFromInteger :: proxy Curve_P521R1 -> Integer -> CryptoFailable (Scalar Curve_P521R1) Source #

scalarAdd :: proxy Curve_P521R1 -> Scalar Curve_P521R1 -> Scalar Curve_P521R1 -> Scalar Curve_P521R1 Source #

scalarMul :: proxy Curve_P521R1 -> Scalar Curve_P521R1 -> Scalar Curve_P521R1 -> Scalar Curve_P521R1 Source #

EllipticCurveDH Curve_P521R1 Source # |
Instance details Defined in Crypto.ECC Methods ecdhRaw :: proxy Curve_P521R1 -> Scalar Curve_P521R1 -> Point Curve_P521R1 -> SharedSecret Source # ecdh :: proxy Curve_P521R1 -> Scalar Curve_P521R1 -> Point Curve_P521R1 -> CryptoFailable SharedSecret Source #
EllipticCurveECDSA Curve_P521R1 Source # |
Instance details Defined in Crypto.PubKey.ECDSA Methods scalarIsValid :: proxy Curve_P521R1 -> Scalar Curve_P521R1 -> Bool Source # scalarIsZero :: proxy Curve_P521R1 -> Scalar Curve_P521R1 -> Bool Source # scalarInv :: proxy Curve_P521R1 -> Scalar Curve_P521R1 -> Maybe (Scalar Curve_P521R1) Source # pointX :: proxy Curve_P521R1 -> Point Curve_P521R1 -> Maybe (Scalar Curve_P521R1) Source #
type Point Curve_P521R1 Source # |
Instance details Defined in Crypto.ECC type Point Curve_P521R1
type Scalar Curve_P521R1 Source # |
Instance details Defined in Crypto.ECC type Scalar Curve_P521R1

data Curve_X25519 Source #

Constructors

Curve_X25519 |

#### Instances

Instances details

Data Curve_X25519 Source # |

Instance details

Defined in Crypto.ECC

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Curve_X25519 -> c Curve_X25519 Source #

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

toConstr :: Curve_X25519 -> Constr Source #

dataTypeOf :: Curve_X25519 -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Show Curve_X25519 Source # |
Instance details Defined in Crypto.ECC Methods showsPrec :: Int -> Curve_X25519 -> ShowS Source # show :: Curve_X25519 -> String Source # showList :: [Curve_X25519] -> ShowS Source #
EllipticCurve Curve_X25519 Source # |

Instance details

Defined in Crypto.ECC

Associated Types

type Point Curve_X25519 Source #

type Scalar Curve_X25519 Source #

Methods

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

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

curveSizeBits :: proxy Curve_X25519 -> Int Source #

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

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

EllipticCurveDH Curve_X25519 Source # |
Instance details Defined in Crypto.ECC Methods ecdhRaw :: proxy Curve_X25519 -> Scalar Curve_X25519 -> Point Curve_X25519 -> SharedSecret Source # ecdh :: proxy Curve_X25519 -> Scalar Curve_X25519 -> Point Curve_X25519 -> CryptoFailable SharedSecret Source #
type Point Curve_X25519 Source # |
Instance details Defined in Crypto.ECC type Point Curve_X25519 = PublicKey
type Scalar Curve_X25519 Source # |
Instance details Defined in Crypto.ECC type Scalar Curve_X25519 = SecretKey

data Curve_X448 Source #

Constructors

Curve_X448 |

#### Instances

Instances details

Data Curve_X448 Source # |

Instance details

Defined in Crypto.ECC

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Curve_X448 -> c Curve_X448 Source #

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

toConstr :: Curve_X448 -> Constr Source #

dataTypeOf :: Curve_X448 -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Show Curve_X448 Source # |
Instance details Defined in Crypto.ECC Methods showsPrec :: Int -> Curve_X448 -> ShowS Source # show :: Curve_X448 -> String Source # showList :: [Curve_X448] -> ShowS Source #
EllipticCurve Curve_X448 Source # |

Instance details

Defined in Crypto.ECC

Associated Types

type Point Curve_X448 Source #

type Scalar Curve_X448 Source #

Methods

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

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

curveSizeBits :: proxy Curve_X448 -> Int Source #

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

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

EllipticCurveDH Curve_X448 Source # |
Instance details Defined in Crypto.ECC Methods ecdhRaw :: proxy Curve_X448 -> Scalar Curve_X448 -> Point Curve_X448 -> SharedSecret Source # ecdh :: proxy Curve_X448 -> Scalar Curve_X448 -> Point Curve_X448 -> CryptoFailable SharedSecret Source #
type Point Curve_X448 Source # |
Instance details Defined in Crypto.ECC type Point Curve_X448 = PublicKey
type Scalar Curve_X448 Source # |
Instance details Defined in Crypto.ECC type Scalar Curve_X448 = SecretKey

data Curve_Edwards25519 Source #

Constructors

Curve_Edwards25519 |

#### Instances

Instances details

Data Curve_Edwards25519 Source # |

Instance details

Defined in Crypto.ECC

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Curve_Edwards25519 -> c Curve_Edwards25519 Source #

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

toConstr :: Curve_Edwards25519 -> Constr Source #

dataTypeOf :: Curve_Edwards25519 -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Show Curve_Edwards25519 Source # |
Instance details Defined in Crypto.ECC Methods showsPrec :: Int -> Curve_Edwards25519 -> ShowS Source # show :: Curve_Edwards25519 -> String Source # showList :: [Curve_Edwards25519] -> ShowS Source #
EllipticCurve Curve_Edwards25519 Source # |

Instance details

Defined in Crypto.ECC

Associated Types

type Point Curve_Edwards25519 Source #

type Scalar Curve_Edwards25519 Source #

Methods

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

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

curveSizeBits :: proxy Curve_Edwards25519 -> Int Source #

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

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

EllipticCurveArith Curve_Edwards25519 Source # |

Instance details

Defined in Crypto.ECC

Methods

pointAdd :: proxy Curve_Edwards25519 -> Point Curve_Edwards25519 -> Point Curve_Edwards25519 -> Point Curve_Edwards25519 Source #

pointNegate :: proxy Curve_Edwards25519 -> Point Curve_Edwards25519 -> Point Curve_Edwards25519 Source #

pointSmul :: proxy Curve_Edwards25519 -> Scalar Curve_Edwards25519 -> Point Curve_Edwards25519 -> Point Curve_Edwards25519 Source #

EllipticCurveBasepointArith Curve_Edwards25519 Source # |

Instance details

Defined in Crypto.ECC

Methods

curveOrderBits :: proxy Curve_Edwards25519 -> Int Source #

pointBaseSmul :: proxy Curve_Edwards25519 -> Scalar Curve_Edwards25519 -> Point Curve_Edwards25519 Source #

pointsSmulVarTime :: proxy Curve_Edwards25519 -> Scalar Curve_Edwards25519 -> Scalar Curve_Edwards25519 -> Point Curve_Edwards25519 -> Point Curve_Edwards25519 Source #

encodeScalar :: ByteArray bs => proxy Curve_Edwards25519 -> Scalar Curve_Edwards25519 -> bs Source #

decodeScalar :: ByteArray bs => proxy Curve_Edwards25519 -> bs -> CryptoFailable (Scalar Curve_Edwards25519) Source #

scalarToInteger :: proxy Curve_Edwards25519 -> Scalar Curve_Edwards25519 -> Integer Source #

scalarFromInteger :: proxy Curve_Edwards25519 -> Integer -> CryptoFailable (Scalar Curve_Edwards25519) Source #

scalarAdd :: proxy Curve_Edwards25519 -> Scalar Curve_Edwards25519 -> Scalar Curve_Edwards25519 -> Scalar Curve_Edwards25519 Source #

scalarMul :: proxy Curve_Edwards25519 -> Scalar Curve_Edwards25519 -> Scalar Curve_Edwards25519 -> Scalar Curve_Edwards25519 Source #

EllipticCurveEdDSA Curve_Edwards25519 Source # |

Instance details

Defined in Crypto.PubKey.EdDSA

Associated Types

type CurveDigestSize Curve_Edwards25519 :: Nat Source #

Methods

secretKeySize :: proxy Curve_Edwards25519 -> Int Source #

hashWithDom :: (HashAlgorithm hash, ByteArrayAccess ctx, ByteArrayAccess msg) => proxy Curve_Edwards25519 -> hash -> Bool -> ctx -> Builder -> msg -> Bytes

pointPublic :: proxy Curve_Edwards25519 -> Point Curve_Edwards25519 -> PublicKey Curve_Edwards25519 hash

publicPoint :: proxy Curve_Edwards25519 -> PublicKey Curve_Edwards25519 hash -> CryptoFailable (Point Curve_Edwards25519)

encodeScalarLE :: ByteArray bs => proxy Curve_Edwards25519 -> Scalar Curve_Edwards25519 -> bs

decodeScalarLE :: ByteArrayAccess bs => proxy Curve_Edwards25519 -> bs -> CryptoFailable (Scalar Curve_Edwards25519)

scheduleSecret :: (HashAlgorithm hash, HashDigestSize hash ~ CurveDigestSize Curve_Edwards25519) => proxy Curve_Edwards25519 -> hash -> SecretKey Curve_Edwards25519 -> (Scalar Curve_Edwards25519, View Bytes)

type Point Curve_Edwards25519 Source # |
Instance details Defined in Crypto.ECC type Point Curve_Edwards25519 = Point
type Scalar Curve_Edwards25519 Source # |
Instance details Defined in Crypto.ECC type Scalar Curve_Edwards25519 = Scalar
type CurveDigestSize Curve_Edwards25519 Source # |
Instance details Defined in Crypto.PubKey.EdDSA type CurveDigestSize Curve_Edwards25519 = 64

class EllipticCurve curve where Source #

Associated Types

type Point curve :: Type Source #

Point on an Elliptic Curve

type Scalar curve :: Type 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

Instances details

EllipticCurve Curve_Edwards25519 Source # |

Instance details

Defined in Crypto.ECC

Associated Types

type Point Curve_Edwards25519 Source #

type Scalar Curve_Edwards25519 Source #

Methods

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

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

curveSizeBits :: proxy Curve_Edwards25519 -> Int Source #

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

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

EllipticCurve Curve_P256R1 Source # |

Instance details

Defined in Crypto.ECC

Associated Types

type Point Curve_P256R1 Source #

type Scalar Curve_P256R1 Source #

Methods

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

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

curveSizeBits :: proxy Curve_P256R1 -> Int Source #

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

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

EllipticCurve Curve_P384R1 Source # |

Instance details

Defined in Crypto.ECC

Associated Types

type Point Curve_P384R1 Source #

type Scalar Curve_P384R1 Source #

Methods

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

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

curveSizeBits :: proxy Curve_P384R1 -> Int Source #

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

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

EllipticCurve Curve_P521R1 Source # |

Instance details

Defined in Crypto.ECC

Associated Types

type Point Curve_P521R1 Source #

type Scalar Curve_P521R1 Source #

Methods

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

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

curveSizeBits :: proxy Curve_P521R1 -> Int Source #

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

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

EllipticCurve Curve_X25519 Source # |

Instance details

Defined in Crypto.ECC

Associated Types

type Point Curve_X25519 Source #

type Scalar Curve_X25519 Source #

Methods

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

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

curveSizeBits :: proxy Curve_X25519 -> Int Source #

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

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

EllipticCurve Curve_X448 Source # |

Instance details

Defined in Crypto.ECC

Associated Types

type Point Curve_X448 Source #

type Scalar Curve_X448 Source #

Methods

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

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

curveSizeBits :: proxy Curve_X448 -> Int Source #

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

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

class EllipticCurve curve => EllipticCurveDH curve where Source #

Minimal complete definition

ecdh

Methods

ecdhRaw :: 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.

WARNING: Curve implementations may return a special value or an exception when the public point lies in a subgroup of small order. This function is adequate when the scalar is in expected range and contributory behaviour is not needed. Otherwise use `ecdh`.

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

Generate a Diffie hellman secret value and verify that the result is not the point at infinity.

This additional test avoids risks existing with function `ecdhRaw`. Implementations always return a `CryptoError` instead of a special value or an exception.

#### Instances

Instances details

EllipticCurveDH Curve_P256R1 Source # |
Instance details Defined in Crypto.ECC Methods ecdhRaw :: proxy Curve_P256R1 -> Scalar Curve_P256R1 -> Point Curve_P256R1 -> SharedSecret Source # ecdh :: proxy Curve_P256R1 -> Scalar Curve_P256R1 -> Point Curve_P256R1 -> CryptoFailable SharedSecret Source #
EllipticCurveDH Curve_P384R1 Source # |
Instance details Defined in Crypto.ECC Methods ecdhRaw :: proxy Curve_P384R1 -> Scalar Curve_P384R1 -> Point Curve_P384R1 -> SharedSecret Source # ecdh :: proxy Curve_P384R1 -> Scalar Curve_P384R1 -> Point Curve_P384R1 -> CryptoFailable SharedSecret Source #
EllipticCurveDH Curve_P521R1 Source # |
Instance details Defined in Crypto.ECC Methods ecdhRaw :: proxy Curve_P521R1 -> Scalar Curve_P521R1 -> Point Curve_P521R1 -> SharedSecret Source # ecdh :: proxy Curve_P521R1 -> Scalar Curve_P521R1 -> Point Curve_P521R1 -> CryptoFailable SharedSecret Source #
EllipticCurveDH Curve_X25519 Source # |
Instance details Defined in Crypto.ECC Methods ecdhRaw :: proxy Curve_X25519 -> Scalar Curve_X25519 -> Point Curve_X25519 -> SharedSecret Source # ecdh :: proxy Curve_X25519 -> Scalar Curve_X25519 -> Point Curve_X25519 -> CryptoFailable SharedSecret Source #
EllipticCurveDH Curve_X448 Source # |
Instance details Defined in Crypto.ECC Methods ecdhRaw :: proxy Curve_X448 -> Scalar Curve_X448 -> Point Curve_X448 -> SharedSecret Source # ecdh :: proxy Curve_X448 -> Scalar Curve_X448 -> Point Curve_X448 -> CryptoFailable SharedSecret Source #

class (EllipticCurve curve, Eq (Point curve)) => EllipticCurveArith curve where Source #

Methods

pointAdd :: proxy curve -> Point curve -> Point curve -> Point curve Source #

Add points on a curve

pointNegate :: proxy curve -> Point curve -> Point curve Source #

Negate a curve point

pointSmul :: proxy curve -> Scalar curve -> Point curve -> Point curve Source #

Scalar Multiplication on a curve

#### Instances

Instances details

EllipticCurveArith Curve_Edwards25519 Source # |

Instance details

Defined in Crypto.ECC

Methods

pointAdd :: proxy Curve_Edwards25519 -> Point Curve_Edwards25519 -> Point Curve_Edwards25519 -> Point Curve_Edwards25519 Source #

pointNegate :: proxy Curve_Edwards25519 -> Point Curve_Edwards25519 -> Point Curve_Edwards25519 Source #

pointSmul :: proxy Curve_Edwards25519 -> Scalar Curve_Edwards25519 -> Point Curve_Edwards25519 -> Point Curve_Edwards25519 Source #

EllipticCurveArith Curve_P256R1 Source # |
Instance details Defined in Crypto.ECC Methods pointAdd :: proxy Curve_P256R1 -> Point Curve_P256R1 -> Point Curve_P256R1 -> Point Curve_P256R1 Source # pointNegate :: proxy Curve_P256R1 -> Point Curve_P256R1 -> Point Curve_P256R1 Source # pointSmul :: proxy Curve_P256R1 -> Scalar Curve_P256R1 -> Point Curve_P256R1 -> Point Curve_P256R1 Source #
EllipticCurveArith Curve_P384R1 Source # |
Instance details Defined in Crypto.ECC Methods pointAdd :: proxy Curve_P384R1 -> Point Curve_P384R1 -> Point Curve_P384R1 -> Point Curve_P384R1 Source # pointNegate :: proxy Curve_P384R1 -> Point Curve_P384R1 -> Point Curve_P384R1 Source # pointSmul :: proxy Curve_P384R1 -> Scalar Curve_P384R1 -> Point Curve_P384R1 -> Point Curve_P384R1 Source #
EllipticCurveArith Curve_P521R1 Source # |
Instance details Defined in Crypto.ECC Methods pointAdd :: proxy Curve_P521R1 -> Point Curve_P521R1 -> Point Curve_P521R1 -> Point Curve_P521R1 Source # pointNegate :: proxy Curve_P521R1 -> Point Curve_P521R1 -> Point Curve_P521R1 Source # pointSmul :: proxy Curve_P521R1 -> Scalar Curve_P521R1 -> Point Curve_P521R1 -> Point Curve_P521R1 Source #

class (EllipticCurveArith curve, Eq (Scalar curve)) => EllipticCurveBasepointArith curve where Source #

Minimal complete definition

curveOrderBits, pointBaseSmul, encodeScalar, decodeScalar, scalarToInteger, scalarFromInteger, scalarAdd, scalarMul

Methods

curveOrderBits :: proxy curve -> Int Source #

Get the curve order size in bits

pointBaseSmul :: proxy curve -> Scalar curve -> Point curve Source #

Multiply a scalar with the curve base point

pointsSmulVarTime :: proxy curve -> Scalar curve -> Scalar curve -> Point curve -> Point curve Source #

Multiply the point `p` with `s2` and add a lifted to curve value `s1`

encodeScalar :: ByteArray bs => proxy curve -> Scalar curve -> bs Source #

Encode an elliptic curve scalar into big-endian form

decodeScalar :: ByteArray bs => proxy curve -> bs -> CryptoFailable (Scalar curve) Source #

Try to decode the big-endian form of an elliptic curve scalar

scalarToInteger :: proxy curve -> Scalar curve -> Integer Source #

Convert an elliptic curve scalar to an integer

scalarFromInteger :: proxy curve -> Integer -> CryptoFailable (Scalar curve) Source #

Try to create an elliptic curve scalar from an integer

scalarAdd :: proxy curve -> Scalar curve -> Scalar curve -> Scalar curve Source #

Add two scalars and reduce modulo the curve order

scalarMul :: proxy curve -> Scalar curve -> Scalar curve -> Scalar curve Source #

Multiply two scalars and reduce modulo the curve order

#### Instances

Instances details

EllipticCurveBasepointArith Curve_Edwards25519 Source # |

Instance details

Defined in Crypto.ECC

Methods

curveOrderBits :: proxy Curve_Edwards25519 -> Int Source #

pointBaseSmul :: proxy Curve_Edwards25519 -> Scalar Curve_Edwards25519 -> Point Curve_Edwards25519 Source #

pointsSmulVarTime :: proxy Curve_Edwards25519 -> Scalar Curve_Edwards25519 -> Scalar Curve_Edwards25519 -> Point Curve_Edwards25519 -> Point Curve_Edwards25519 Source #

encodeScalar :: ByteArray bs => proxy Curve_Edwards25519 -> Scalar Curve_Edwards25519 -> bs Source #

decodeScalar :: ByteArray bs => proxy Curve_Edwards25519 -> bs -> CryptoFailable (Scalar Curve_Edwards25519) Source #

scalarToInteger :: proxy Curve_Edwards25519 -> Scalar Curve_Edwards25519 -> Integer Source #

scalarFromInteger :: proxy Curve_Edwards25519 -> Integer -> CryptoFailable (Scalar Curve_Edwards25519) Source #

scalarAdd :: proxy Curve_Edwards25519 -> Scalar Curve_Edwards25519 -> Scalar Curve_Edwards25519 -> Scalar Curve_Edwards25519 Source #

scalarMul :: proxy Curve_Edwards25519 -> Scalar Curve_Edwards25519 -> Scalar Curve_Edwards25519 -> Scalar Curve_Edwards25519 Source #

EllipticCurveBasepointArith Curve_P256R1 Source # |

Instance details

Defined in Crypto.ECC

Methods

curveOrderBits :: proxy Curve_P256R1 -> Int Source #

pointBaseSmul :: proxy Curve_P256R1 -> Scalar Curve_P256R1 -> Point Curve_P256R1 Source #

pointsSmulVarTime :: proxy Curve_P256R1 -> Scalar Curve_P256R1 -> Scalar Curve_P256R1 -> Point Curve_P256R1 -> Point Curve_P256R1 Source #

encodeScalar :: ByteArray bs => proxy Curve_P256R1 -> Scalar Curve_P256R1 -> bs Source #

decodeScalar :: ByteArray bs => proxy Curve_P256R1 -> bs -> CryptoFailable (Scalar Curve_P256R1) Source #

scalarToInteger :: proxy Curve_P256R1 -> Scalar Curve_P256R1 -> Integer Source #

scalarFromInteger :: proxy Curve_P256R1 -> Integer -> CryptoFailable (Scalar Curve_P256R1) Source #

scalarAdd :: proxy Curve_P256R1 -> Scalar Curve_P256R1 -> Scalar Curve_P256R1 -> Scalar Curve_P256R1 Source #

scalarMul :: proxy Curve_P256R1 -> Scalar Curve_P256R1 -> Scalar Curve_P256R1 -> Scalar Curve_P256R1 Source #

EllipticCurveBasepointArith Curve_P384R1 Source # |

Instance details

Defined in Crypto.ECC

Methods

curveOrderBits :: proxy Curve_P384R1 -> Int Source #

pointBaseSmul :: proxy Curve_P384R1 -> Scalar Curve_P384R1 -> Point Curve_P384R1 Source #

pointsSmulVarTime :: proxy Curve_P384R1 -> Scalar Curve_P384R1 -> Scalar Curve_P384R1 -> Point Curve_P384R1 -> Point Curve_P384R1 Source #

encodeScalar :: ByteArray bs => proxy Curve_P384R1 -> Scalar Curve_P384R1 -> bs Source #

decodeScalar :: ByteArray bs => proxy Curve_P384R1 -> bs -> CryptoFailable (Scalar Curve_P384R1) Source #

scalarToInteger :: proxy Curve_P384R1 -> Scalar Curve_P384R1 -> Integer Source #

scalarFromInteger :: proxy Curve_P384R1 -> Integer -> CryptoFailable (Scalar Curve_P384R1) Source #

scalarAdd :: proxy Curve_P384R1 -> Scalar Curve_P384R1 -> Scalar Curve_P384R1 -> Scalar Curve_P384R1 Source #

scalarMul :: proxy Curve_P384R1 -> Scalar Curve_P384R1 -> Scalar Curve_P384R1 -> Scalar Curve_P384R1 Source #

EllipticCurveBasepointArith Curve_P521R1 Source # |

Instance details

Defined in Crypto.ECC

Methods

curveOrderBits :: proxy Curve_P521R1 -> Int Source #

pointBaseSmul :: proxy Curve_P521R1 -> Scalar Curve_P521R1 -> Point Curve_P521R1 Source #

pointsSmulVarTime :: proxy Curve_P521R1 -> Scalar Curve_P521R1 -> Scalar Curve_P521R1 -> Point Curve_P521R1 -> Point Curve_P521R1 Source #

encodeScalar :: ByteArray bs => proxy Curve_P521R1 -> Scalar Curve_P521R1 -> bs Source #

decodeScalar :: ByteArray bs => proxy Curve_P521R1 -> bs -> CryptoFailable (Scalar Curve_P521R1) Source #

scalarToInteger :: proxy Curve_P521R1 -> Scalar Curve_P521R1 -> Integer Source #

scalarFromInteger :: proxy Curve_P521R1 -> Integer -> CryptoFailable (Scalar Curve_P521R1) Source #

scalarAdd :: proxy Curve_P521R1 -> Scalar Curve_P521R1 -> Scalar Curve_P521R1 -> Scalar Curve_P521R1 Source #

scalarMul :: proxy Curve_P521R1 -> Scalar Curve_P521R1 -> Scalar Curve_P521R1 -> Scalar Curve_P521R1 Source #

data KeyPair curve Source #

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

Constructors

KeyPair |

Fields

- keypairGetPublic :: !(Point curve)
- keypairGetPrivate :: !(Scalar curve)

newtype SharedSecret Source #

Constructors

SharedSecret ScrubbedBytes |

#### Instances

Instances details

NFData SharedSecret Source # |
Instance details Defined in Crypto.ECC Methods rnf :: SharedSecret -> () Source #
Eq SharedSecret Source # |
Instance details Defined in Crypto.ECC Methods (==) :: SharedSecret -> SharedSecret -> Bool Source # (/=) :: SharedSecret -> SharedSecret -> Bool Source #
ByteArrayAccess SharedSecret Source # |
Instance details Defined in Crypto.ECC Methods length :: SharedSecret -> Int Source # withByteArray :: SharedSecret -> (Ptr p -> IO a) -> IO a Source # copyByteArrayToPtr :: SharedSecret -> Ptr p -> IO () Source #