-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Generic cryptography Public keys algorithm types
--   
--   Generic cryptography public keys algorithm types
@package crypto-pubkey-types
@version 0.4.3


-- | references: <a>https://tools.ietf.org/html/rfc5915</a>
module Crypto.Types.PubKey.ECC

-- | Define either a binary curve or a prime curve.
data Curve

-- | 𝔽(2^m)
CurveF2m :: CurveBinary -> Curve

-- | 𝔽p
CurveFP :: CurvePrime -> Curve

-- | Define a point on a curve.
data Point
Point :: Integer -> Integer -> Point

-- | Point at Infinity
PointO :: Point

-- | ECC Public Point
type PublicPoint = Point

-- | ECC Private Number
type PrivateNumber = Integer

-- | Define an elliptic curve in 𝔽(2^m). The firt parameter is the Integer
--   representatioin of the irreducible polynomial f(x).
data CurveBinary
CurveBinary :: Integer -> CurveCommon -> CurveBinary

-- | Define an elliptic curve in 𝔽p. The first parameter is the Prime
--   Number.
data CurvePrime
CurvePrime :: Integer -> CurveCommon -> CurvePrime

-- | Parameters in common between binary and prime curves.
common_curve :: Curve -> CurveCommon

-- | Irreducible polynomial representing the characteristic of a
--   CurveBinary.
ecc_fx :: CurveBinary -> Integer

-- | Prime number representing the characteristic of a CurvePrime.
ecc_p :: CurvePrime -> Integer

-- | Define common parameters in a curve definition of the form: y^2 = x^3
--   + ax + b.
data CurveCommon
CurveCommon :: Integer -> Integer -> Point -> Integer -> Integer -> CurveCommon

-- | curve parameter a
[ecc_a] :: CurveCommon -> Integer

-- | curve parameter b
[ecc_b] :: CurveCommon -> Integer

-- | base point
[ecc_g] :: CurveCommon -> Point

-- | order of G
[ecc_n] :: CurveCommon -> Integer

-- | cofactor
[ecc_h] :: CurveCommon -> Integer

-- | Define names for known recommended curves.
data CurveName
SEC_p112r1 :: CurveName
SEC_p112r2 :: CurveName
SEC_p128r1 :: CurveName
SEC_p128r2 :: CurveName
SEC_p160k1 :: CurveName
SEC_p160r1 :: CurveName
SEC_p160r2 :: CurveName
SEC_p192k1 :: CurveName
SEC_p192r1 :: CurveName
SEC_p224k1 :: CurveName
SEC_p224r1 :: CurveName
SEC_p256k1 :: CurveName
SEC_p256r1 :: CurveName
SEC_p384r1 :: CurveName
SEC_p521r1 :: CurveName
SEC_t113r1 :: CurveName
SEC_t113r2 :: CurveName
SEC_t131r1 :: CurveName
SEC_t131r2 :: CurveName
SEC_t163k1 :: CurveName
SEC_t163r1 :: CurveName
SEC_t163r2 :: CurveName
SEC_t193r1 :: CurveName
SEC_t193r2 :: CurveName
SEC_t233k1 :: CurveName
SEC_t233r1 :: CurveName
SEC_t239k1 :: CurveName
SEC_t283k1 :: CurveName
SEC_t283r1 :: CurveName
SEC_t409k1 :: CurveName
SEC_t409r1 :: CurveName
SEC_t571k1 :: CurveName
SEC_t571r1 :: CurveName

-- | Get the curve definition associated with a recommended known curve
--   name.
getCurveByName :: CurveName -> Curve
instance Data.Data.Data Crypto.Types.PubKey.ECC.CurveName
instance GHC.Enum.Enum Crypto.Types.PubKey.ECC.CurveName
instance GHC.Classes.Ord Crypto.Types.PubKey.ECC.CurveName
instance GHC.Classes.Eq Crypto.Types.PubKey.ECC.CurveName
instance GHC.Read.Read Crypto.Types.PubKey.ECC.CurveName
instance GHC.Show.Show Crypto.Types.PubKey.ECC.CurveName
instance Data.Data.Data Crypto.Types.PubKey.ECC.Curve
instance GHC.Classes.Eq Crypto.Types.PubKey.ECC.Curve
instance GHC.Read.Read Crypto.Types.PubKey.ECC.Curve
instance GHC.Show.Show Crypto.Types.PubKey.ECC.Curve
instance Data.Data.Data Crypto.Types.PubKey.ECC.CurveBinary
instance GHC.Classes.Eq Crypto.Types.PubKey.ECC.CurveBinary
instance GHC.Read.Read Crypto.Types.PubKey.ECC.CurveBinary
instance GHC.Show.Show Crypto.Types.PubKey.ECC.CurveBinary
instance Data.Data.Data Crypto.Types.PubKey.ECC.CurvePrime
instance GHC.Classes.Eq Crypto.Types.PubKey.ECC.CurvePrime
instance GHC.Read.Read Crypto.Types.PubKey.ECC.CurvePrime
instance GHC.Show.Show Crypto.Types.PubKey.ECC.CurvePrime
instance Data.Data.Data Crypto.Types.PubKey.ECC.CurveCommon
instance GHC.Classes.Eq Crypto.Types.PubKey.ECC.CurveCommon
instance GHC.Read.Read Crypto.Types.PubKey.ECC.CurveCommon
instance GHC.Show.Show Crypto.Types.PubKey.ECC.CurveCommon
instance Data.Data.Data Crypto.Types.PubKey.ECC.Point
instance GHC.Classes.Eq Crypto.Types.PubKey.ECC.Point
instance GHC.Read.Read Crypto.Types.PubKey.ECC.Point
instance GHC.Show.Show Crypto.Types.PubKey.ECC.Point
instance Data.ASN1.OID.OIDable Crypto.Types.PubKey.ECC.CurveName
instance Data.ASN1.OID.OIDNameable Crypto.Types.PubKey.ECC.CurveName


-- | references: <a>https://tools.ietf.org/html/rfc5915</a>
--   <a>https://tools.ietf.org/html/rfc6979</a>
module Crypto.Types.PubKey.ECDSA

-- | Represent a ECDSA signature namely R and S.
data Signature
Signature :: Integer -> Integer -> Signature

-- | ECDSA r
[sign_r] :: Signature -> Integer

-- | ECDSA s
[sign_s] :: Signature -> Integer

-- | ECC Public Point
type PublicPoint = Point

-- | ECDSA Public Key.
data PublicKey
PublicKey :: Curve -> PublicPoint -> PublicKey
[public_curve] :: PublicKey -> Curve
[public_q] :: PublicKey -> PublicPoint

-- | ECC Private Number
type PrivateNumber = Integer

-- | ECDSA Private Key.
data PrivateKey
PrivateKey :: Curve -> PrivateNumber -> PrivateKey
[private_curve] :: PrivateKey -> Curve
[private_d] :: PrivateKey -> PrivateNumber

-- | ECDSA Key Pair.
data KeyPair
KeyPair :: Curve -> PublicPoint -> PrivateNumber -> KeyPair

-- | Public key of a ECDSA Key pair.
toPublicKey :: KeyPair -> PublicKey

-- | Private key of a ECDSA Key pair.
toPrivateKey :: KeyPair -> PrivateKey
instance Data.Data.Data Crypto.Types.PubKey.ECDSA.KeyPair
instance GHC.Classes.Eq Crypto.Types.PubKey.ECDSA.KeyPair
instance GHC.Read.Read Crypto.Types.PubKey.ECDSA.KeyPair
instance GHC.Show.Show Crypto.Types.PubKey.ECDSA.KeyPair
instance Data.Data.Data Crypto.Types.PubKey.ECDSA.PublicKey
instance GHC.Classes.Eq Crypto.Types.PubKey.ECDSA.PublicKey
instance GHC.Read.Read Crypto.Types.PubKey.ECDSA.PublicKey
instance GHC.Show.Show Crypto.Types.PubKey.ECDSA.PublicKey
instance Data.Data.Data Crypto.Types.PubKey.ECDSA.PrivateKey
instance GHC.Classes.Eq Crypto.Types.PubKey.ECDSA.PrivateKey
instance GHC.Read.Read Crypto.Types.PubKey.ECDSA.PrivateKey
instance GHC.Show.Show Crypto.Types.PubKey.ECDSA.PrivateKey
instance Data.Data.Data Crypto.Types.PubKey.ECDSA.Signature
instance GHC.Classes.Eq Crypto.Types.PubKey.ECDSA.Signature
instance GHC.Read.Read Crypto.Types.PubKey.ECDSA.Signature
instance GHC.Show.Show Crypto.Types.PubKey.ECDSA.Signature


module Crypto.Types.PubKey.DH

-- | Represent Diffie Hellman parameters namely P (prime), and G
--   (generator).
data Params
Params :: Integer -> Integer -> Params
[params_p] :: Params -> Integer
[params_g] :: Params -> Integer

-- | Represent Diffie Hellman public number Y.
newtype PublicNumber
PublicNumber :: Integer -> PublicNumber

-- | Represent Diffie Hellman private number X.
newtype PrivateNumber
PrivateNumber :: Integer -> PrivateNumber

-- | Represent Diffie Hellman shared secret.
newtype SharedKey
SharedKey :: Integer -> SharedKey
instance GHC.Classes.Ord Crypto.Types.PubKey.DH.SharedKey
instance GHC.Num.Num Crypto.Types.PubKey.DH.SharedKey
instance GHC.Real.Real Crypto.Types.PubKey.DH.SharedKey
instance GHC.Enum.Enum Crypto.Types.PubKey.DH.SharedKey
instance GHC.Classes.Eq Crypto.Types.PubKey.DH.SharedKey
instance GHC.Read.Read Crypto.Types.PubKey.DH.SharedKey
instance GHC.Show.Show Crypto.Types.PubKey.DH.SharedKey
instance GHC.Classes.Ord Crypto.Types.PubKey.DH.PrivateNumber
instance GHC.Num.Num Crypto.Types.PubKey.DH.PrivateNumber
instance GHC.Real.Real Crypto.Types.PubKey.DH.PrivateNumber
instance GHC.Enum.Enum Crypto.Types.PubKey.DH.PrivateNumber
instance GHC.Classes.Eq Crypto.Types.PubKey.DH.PrivateNumber
instance GHC.Read.Read Crypto.Types.PubKey.DH.PrivateNumber
instance GHC.Show.Show Crypto.Types.PubKey.DH.PrivateNumber
instance GHC.Classes.Ord Crypto.Types.PubKey.DH.PublicNumber
instance GHC.Num.Num Crypto.Types.PubKey.DH.PublicNumber
instance GHC.Real.Real Crypto.Types.PubKey.DH.PublicNumber
instance GHC.Enum.Enum Crypto.Types.PubKey.DH.PublicNumber
instance GHC.Classes.Eq Crypto.Types.PubKey.DH.PublicNumber
instance GHC.Read.Read Crypto.Types.PubKey.DH.PublicNumber
instance GHC.Show.Show Crypto.Types.PubKey.DH.PublicNumber
instance Data.Data.Data Crypto.Types.PubKey.DH.Params
instance GHC.Classes.Eq Crypto.Types.PubKey.DH.Params
instance GHC.Read.Read Crypto.Types.PubKey.DH.Params
instance GHC.Show.Show Crypto.Types.PubKey.DH.Params
instance Data.ASN1.Types.ASN1Object Crypto.Types.PubKey.DH.Params


-- | references: <a>https://tools.ietf.org/html/rfc6979</a>
module Crypto.Types.PubKey.DSA

-- | Represent DSA parameters namely P, G, and Q.
data Params
Params :: Integer -> Integer -> Integer -> Params

-- | DSA p
[params_p] :: Params -> Integer

-- | DSA g
[params_g] :: Params -> Integer

-- | DSA q
[params_q] :: Params -> Integer

-- | Represent a DSA signature namely R and S.
data Signature
Signature :: Integer -> Integer -> Signature

-- | DSA r
[sign_r] :: Signature -> Integer

-- | DSA s
[sign_s] :: Signature -> Integer

-- | DSA Public Number, usually embedded in DSA Public Key
type PublicNumber = Integer

-- | Represent a DSA public key.
data PublicKey
PublicKey :: Params -> PublicNumber -> PublicKey

-- | DSA parameters
[public_params] :: PublicKey -> Params

-- | DSA public Y
[public_y] :: PublicKey -> PublicNumber

-- | DSA Private Number, usually embedded in DSA Private Key
type PrivateNumber = Integer

-- | Represent a DSA private key.
--   
--   Only x need to be secret. the DSA parameters are publicly shared with
--   the other side.
data PrivateKey
PrivateKey :: Params -> PrivateNumber -> PrivateKey

-- | DSA parameters
[private_params] :: PrivateKey -> Params

-- | DSA private X
[private_x] :: PrivateKey -> PrivateNumber

-- | Represent a DSA key pair
data KeyPair
KeyPair :: Params -> PublicNumber -> PrivateNumber -> KeyPair

-- | Public key of a DSA Key pair
toPublicKey :: KeyPair -> PublicKey

-- | Private key of a DSA Key pair
toPrivateKey :: KeyPair -> PrivateKey
instance Data.Data.Data Crypto.Types.PubKey.DSA.KeyPair
instance GHC.Classes.Eq Crypto.Types.PubKey.DSA.KeyPair
instance GHC.Read.Read Crypto.Types.PubKey.DSA.KeyPair
instance GHC.Show.Show Crypto.Types.PubKey.DSA.KeyPair
instance Data.Data.Data Crypto.Types.PubKey.DSA.PrivateKey
instance GHC.Classes.Eq Crypto.Types.PubKey.DSA.PrivateKey
instance GHC.Read.Read Crypto.Types.PubKey.DSA.PrivateKey
instance GHC.Show.Show Crypto.Types.PubKey.DSA.PrivateKey
instance Data.Data.Data Crypto.Types.PubKey.DSA.PublicKey
instance GHC.Classes.Eq Crypto.Types.PubKey.DSA.PublicKey
instance GHC.Read.Read Crypto.Types.PubKey.DSA.PublicKey
instance GHC.Show.Show Crypto.Types.PubKey.DSA.PublicKey
instance Data.Data.Data Crypto.Types.PubKey.DSA.Signature
instance GHC.Classes.Eq Crypto.Types.PubKey.DSA.Signature
instance GHC.Read.Read Crypto.Types.PubKey.DSA.Signature
instance GHC.Show.Show Crypto.Types.PubKey.DSA.Signature
instance Data.Data.Data Crypto.Types.PubKey.DSA.Params
instance GHC.Classes.Eq Crypto.Types.PubKey.DSA.Params
instance GHC.Read.Read Crypto.Types.PubKey.DSA.Params
instance GHC.Show.Show Crypto.Types.PubKey.DSA.Params
instance Data.ASN1.Types.ASN1Object Crypto.Types.PubKey.DSA.Params
instance Data.ASN1.Types.ASN1Object Crypto.Types.PubKey.DSA.Signature
instance Data.ASN1.Types.ASN1Object Crypto.Types.PubKey.DSA.PublicKey
instance Data.ASN1.Types.ASN1Object Crypto.Types.PubKey.DSA.KeyPair


module Crypto.Types.PubKey.RSA

-- | Represent a RSA public key
data PublicKey
PublicKey :: Int -> Integer -> Integer -> PublicKey

-- | size of key in bytes
[public_size] :: PublicKey -> Int

-- | public p*q
[public_n] :: PublicKey -> Integer

-- | public exponant e
[public_e] :: PublicKey -> Integer

-- | Represent a RSA private key.
--   
--   Only the pub, d fields are mandatory to fill.
--   
--   p, q, dP, dQ, qinv are by-product during RSA generation, but are
--   useful to record here to speed up massively the decrypt and sign
--   operation.
--   
--   implementations can leave optional fields to 0.
data PrivateKey
PrivateKey :: PublicKey -> Integer -> Integer -> Integer -> Integer -> Integer -> Integer -> PrivateKey

-- | public part of a private key (size, n and e)
[private_pub] :: PrivateKey -> PublicKey

-- | private exponant d
[private_d] :: PrivateKey -> Integer

-- | p prime number
[private_p] :: PrivateKey -> Integer

-- | q prime number
[private_q] :: PrivateKey -> Integer

-- | d mod (p-1)
[private_dP] :: PrivateKey -> Integer

-- | d mod (q-1)
[private_dQ] :: PrivateKey -> Integer

-- | q^(-1) mod p
[private_qinv] :: PrivateKey -> Integer

-- | Represent RSA KeyPair
--   
--   note the RSA private key contains already an instance of public key
--   for efficiency
newtype KeyPair
KeyPair :: PrivateKey -> KeyPair

-- | get the size in bytes from a private key
private_size :: PrivateKey -> Int

-- | get n from a private key
private_n :: PrivateKey -> Integer

-- | Public key of a RSA KeyPair
toPublicKey :: KeyPair -> PublicKey

-- | Private key of a RSA KeyPair
toPrivateKey :: KeyPair -> PrivateKey
instance Data.Data.Data Crypto.Types.PubKey.RSA.KeyPair
instance GHC.Classes.Eq Crypto.Types.PubKey.RSA.KeyPair
instance GHC.Read.Read Crypto.Types.PubKey.RSA.KeyPair
instance GHC.Show.Show Crypto.Types.PubKey.RSA.KeyPair
instance Data.Data.Data Crypto.Types.PubKey.RSA.PrivateKey
instance GHC.Classes.Eq Crypto.Types.PubKey.RSA.PrivateKey
instance GHC.Read.Read Crypto.Types.PubKey.RSA.PrivateKey
instance GHC.Show.Show Crypto.Types.PubKey.RSA.PrivateKey
instance Data.Data.Data Crypto.Types.PubKey.RSA.PublicKey
instance GHC.Classes.Eq Crypto.Types.PubKey.RSA.PublicKey
instance GHC.Read.Read Crypto.Types.PubKey.RSA.PublicKey
instance GHC.Show.Show Crypto.Types.PubKey.RSA.PublicKey
instance Data.ASN1.Types.ASN1Object Crypto.Types.PubKey.RSA.PublicKey
instance Data.ASN1.Types.ASN1Object Crypto.Types.PubKey.RSA.PrivateKey
instance Data.ASN1.Types.ASN1Object Crypto.Types.PubKey.RSA.KeyPair
