Crypto.PubKey.ECC.Types

cryptonite-0.29: Cryptography Primitives sink

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

Crypto.PubKey.ECC.Types

Contents

- Recommended curves definition

Description

Synopsis

- data Curve
  - = CurveF2m CurveBinary
  - | CurveFP CurvePrime
- data Point
  - = Point Integer Integer
  - | PointO
- type PublicPoint = Point
- type PrivateNumber = Integer
- data CurveBinary = CurveBinary Integer CurveCommon
- data CurvePrime = CurvePrime Integer CurveCommon
- common_curve :: Curve -> CurveCommon
- curveSizeBits :: Curve -> Int
- ecc_fx :: CurveBinary -> Integer
- ecc_p :: CurvePrime -> Integer
- data CurveCommon = CurveCommon {
  - ecc_a :: Integer
  - ecc_b :: Integer
  - ecc_g :: Point
  - ecc_n :: Integer
  - ecc_h :: Integer
  }
- data CurveName
  - = SEC_p112r1
  - | SEC_p112r2
  - | SEC_p128r1
  - | SEC_p128r2
  - | SEC_p160k1
  - | SEC_p160r1
  - | SEC_p160r2
  - | SEC_p192k1
  - | SEC_p192r1
  - | SEC_p224k1
  - | SEC_p224r1
  - | SEC_p256k1
  - | SEC_p256r1
  - | SEC_p384r1
  - | SEC_p521r1
  - | SEC_t113r1
  - | SEC_t113r2
  - | SEC_t131r1
  - | SEC_t131r2
  - | SEC_t163k1
  - | SEC_t163r1
  - | SEC_t163r2
  - | SEC_t193r1
  - | SEC_t193r2
  - | SEC_t233k1
  - | SEC_t233r1
  - | SEC_t239k1
  - | SEC_t283k1
  - | SEC_t283r1
  - | SEC_t409k1
  - | SEC_t409r1
  - | SEC_t571k1
  - | SEC_t571r1
- getCurveByName :: CurveName -> Curve

# Documentation

data Curve #

Define either a binary curve or a prime curve.

Constructors

CurveF2m CurveBinary | 𝔽(2^m)
CurveFP CurvePrime | 𝔽p

#### 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 #

data Point #

Define a point on a curve.

Constructors

Point Integer Integer |
PointO | Point at Infinity

#### Instances

Instances details

Data Point # |
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) -> Point -> c Point # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Point # toConstr :: Point -> Constr # dataTypeOf :: Point -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Point) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Point) # gmapT :: (forall b. Data b => b -> b) -> Point -> Point # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Point -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Point -> r # gmapQ :: (forall d. Data d => d -> u) -> Point -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Point -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Point -> m Point # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Point -> m Point # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Point -> m Point #
Read Point # |
Instance details Defined in Crypto.PubKey.ECC.Types Methods readsPrec :: Int -> ReadS Point # readList :: ReadS [Point] # readPrec :: ReadPrec Point # readListPrec :: ReadPrec [Point] #
Show Point # |
Instance details Defined in Crypto.PubKey.ECC.Types Methods showsPrec :: Int -> Point -> ShowS # show :: Point -> String # showList :: [Point] -> ShowS #
NFData Point # |
Instance details Defined in Crypto.PubKey.ECC.Types Methods rnf :: Point -> () #
Eq Point # |
Instance details Defined in Crypto.PubKey.ECC.Types Methods (==) :: Point -> Point -> Bool # (/=) :: Point -> Point -> Bool #

type PublicPoint = Point #

ECC Public Point

type PrivateNumber = Integer #

ECC Private Number

data CurveBinary #

Define an elliptic curve in 𝔽(2^m). The firt parameter is the Integer representatioin of the irreducible polynomial f(x).

Constructors

CurveBinary Integer CurveCommon |

#### Instances

Instances details

Data CurveBinary # |
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) -> CurveBinary -> c CurveBinary # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CurveBinary # toConstr :: CurveBinary -> Constr # dataTypeOf :: CurveBinary -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c CurveBinary) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CurveBinary) # gmapT :: (forall b. Data b => b -> b) -> CurveBinary -> CurveBinary # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CurveBinary -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CurveBinary -> r # gmapQ :: (forall d. Data d => d -> u) -> CurveBinary -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> CurveBinary -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> CurveBinary -> m CurveBinary # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CurveBinary -> m CurveBinary # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CurveBinary -> m CurveBinary #
Read CurveBinary # |
Instance details Defined in Crypto.PubKey.ECC.Types Methods readsPrec :: Int -> ReadS CurveBinary # readList :: ReadS [CurveBinary] # readPrec :: ReadPrec CurveBinary # readListPrec :: ReadPrec [CurveBinary] #
Show CurveBinary # |
Instance details Defined in Crypto.PubKey.ECC.Types Methods showsPrec :: Int -> CurveBinary -> ShowS # show :: CurveBinary -> String # showList :: [CurveBinary] -> ShowS #
NFData CurveBinary # |
Instance details Defined in Crypto.PubKey.ECC.Types Methods rnf :: CurveBinary -> () #
Eq CurveBinary # |
Instance details Defined in Crypto.PubKey.ECC.Types Methods (==) :: CurveBinary -> CurveBinary -> Bool # (/=) :: CurveBinary -> CurveBinary -> Bool #

data CurvePrime #

Define an elliptic curve in 𝔽p. The first parameter is the Prime Number.

Constructors

CurvePrime Integer CurveCommon |

#### Instances

Instances details

Data CurvePrime # |
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) -> CurvePrime -> c CurvePrime # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CurvePrime # toConstr :: CurvePrime -> Constr # dataTypeOf :: CurvePrime -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c CurvePrime) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CurvePrime) # gmapT :: (forall b. Data b => b -> b) -> CurvePrime -> CurvePrime # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CurvePrime -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CurvePrime -> r # gmapQ :: (forall d. Data d => d -> u) -> CurvePrime -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> CurvePrime -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> CurvePrime -> m CurvePrime # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CurvePrime -> m CurvePrime # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CurvePrime -> m CurvePrime #
Read CurvePrime # |
Instance details Defined in Crypto.PubKey.ECC.Types Methods readsPrec :: Int -> ReadS CurvePrime # readList :: ReadS [CurvePrime] # readPrec :: ReadPrec CurvePrime # readListPrec :: ReadPrec [CurvePrime] #
Show CurvePrime # |
Instance details Defined in Crypto.PubKey.ECC.Types Methods showsPrec :: Int -> CurvePrime -> ShowS # show :: CurvePrime -> String # showList :: [CurvePrime] -> ShowS #
Eq CurvePrime # |
Instance details Defined in Crypto.PubKey.ECC.Types Methods (==) :: CurvePrime -> CurvePrime -> Bool # (/=) :: CurvePrime -> CurvePrime -> Bool #

common_curve :: Curve -> CurveCommon #

Parameters in common between binary and prime curves.

curveSizeBits :: Curve -> Int #

get the size of the curve in bits

ecc_fx :: CurveBinary -> Integer #

Irreducible polynomial representing the characteristic of a CurveBinary.

ecc_p :: CurvePrime -> Integer #

Prime number representing the characteristic of a CurvePrime.

data CurveCommon #

Define common parameters in a curve definition of the form: y^2 = x^3 + ax + b.

Constructors

CurveCommon |
Fields ecc_a :: Integer curve parameter a ecc_b :: Integer curve parameter b ecc_g :: Point base point ecc_n :: Integer order of G ecc_h :: Integer cofactor

#### Instances

Instances details

Data CurveCommon # |
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) -> CurveCommon -> c CurveCommon # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CurveCommon # toConstr :: CurveCommon -> Constr # dataTypeOf :: CurveCommon -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c CurveCommon) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CurveCommon) # gmapT :: (forall b. Data b => b -> b) -> CurveCommon -> CurveCommon # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CurveCommon -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CurveCommon -> r # gmapQ :: (forall d. Data d => d -> u) -> CurveCommon -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> CurveCommon -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> CurveCommon -> m CurveCommon # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CurveCommon -> m CurveCommon # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CurveCommon -> m CurveCommon #
Read CurveCommon # |
Instance details Defined in Crypto.PubKey.ECC.Types Methods readsPrec :: Int -> ReadS CurveCommon # readList :: ReadS [CurveCommon] # readPrec :: ReadPrec CurveCommon # readListPrec :: ReadPrec [CurveCommon] #
Show CurveCommon # |
Instance details Defined in Crypto.PubKey.ECC.Types Methods showsPrec :: Int -> CurveCommon -> ShowS # show :: CurveCommon -> String # showList :: [CurveCommon] -> ShowS #
Eq CurveCommon # |
Instance details Defined in Crypto.PubKey.ECC.Types Methods (==) :: CurveCommon -> CurveCommon -> Bool # (/=) :: CurveCommon -> CurveCommon -> Bool #

# Recommended curves definition

data CurveName #

Define names for known recommended curves.

Constructors

SEC_p112r1 |
SEC_p112r2 |
SEC_p128r1 |
SEC_p128r2 |
SEC_p160k1 |
SEC_p160r1 |
SEC_p160r2 |
SEC_p192k1 |
SEC_p192r1 |
SEC_p224k1 |
SEC_p224r1 |
SEC_p256k1 |
SEC_p256r1 |
SEC_p384r1 |
SEC_p521r1 |
SEC_t113r1 |
SEC_t113r2 |
SEC_t131r1 |
SEC_t131r2 |
SEC_t163k1 |
SEC_t163r1 |
SEC_t163r2 |
SEC_t193r1 |
SEC_t193r2 |
SEC_t233k1 |
SEC_t233r1 |
SEC_t239k1 |
SEC_t283k1 |
SEC_t283r1 |
SEC_t409k1 |
SEC_t409r1 |
SEC_t571k1 |
SEC_t571r1 |

#### Instances

Instances details

Data CurveName # |
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) -> CurveName -> c CurveName # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CurveName # toConstr :: CurveName -> Constr # dataTypeOf :: CurveName -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c CurveName) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CurveName) # gmapT :: (forall b. Data b => b -> b) -> CurveName -> CurveName # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CurveName -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CurveName -> r # gmapQ :: (forall d. Data d => d -> u) -> CurveName -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> CurveName -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> CurveName -> m CurveName # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CurveName -> m CurveName # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CurveName -> m CurveName #
Bounded CurveName # |
Instance details Defined in Crypto.PubKey.ECC.Types Methods minBound :: CurveName # maxBound :: CurveName #
Enum CurveName # |
Instance details Defined in Crypto.PubKey.ECC.Types Methods succ :: CurveName -> CurveName # pred :: CurveName -> CurveName # toEnum :: Int -> CurveName # fromEnum :: CurveName -> Int # enumFrom :: CurveName -> [CurveName] # enumFromThen :: CurveName -> CurveName -> [CurveName] # enumFromTo :: CurveName -> CurveName -> [CurveName] # enumFromThenTo :: CurveName -> CurveName -> CurveName -> [CurveName] #
Read CurveName # |
Instance details Defined in Crypto.PubKey.ECC.Types Methods readsPrec :: Int -> ReadS CurveName # readList :: ReadS [CurveName] # readPrec :: ReadPrec CurveName # readListPrec :: ReadPrec [CurveName] #
Show CurveName # |
Instance details Defined in Crypto.PubKey.ECC.Types Methods showsPrec :: Int -> CurveName -> ShowS # show :: CurveName -> String # showList :: [CurveName] -> ShowS #
Eq CurveName # |
Instance details Defined in Crypto.PubKey.ECC.Types Methods (==) :: CurveName -> CurveName -> Bool # (/=) :: CurveName -> CurveName -> Bool #
Ord CurveName # |
Instance details Defined in Crypto.PubKey.ECC.Types Methods compare :: CurveName -> CurveName -> Ordering # (<) :: CurveName -> CurveName -> Bool # (<=) :: CurveName -> CurveName -> Bool # (>) :: CurveName -> CurveName -> Bool # (>=) :: CurveName -> CurveName -> Bool # max :: CurveName -> CurveName -> CurveName # min :: CurveName -> CurveName -> CurveName #

getCurveByName :: CurveName -> Curve #

Get the curve definition associated with a recommended known curve name.