License | BSD-style |
---|---|
Stability | experimental |
Portability | Unix |
Safe Haskell | None |
Language | Haskell2010 |
- data EcPoint
- data EcGroup
- data EcKey
- ecGroupFromCurveOID :: String -> Maybe EcGroup
- ecGroupGFp :: Integer -> Integer -> Integer -> (Integer, Integer) -> Integer -> Integer -> EcGroup
- ecGroupGF2m :: Integer -> Integer -> Integer -> (Integer, Integer) -> Integer -> Integer -> EcGroup
- ecGroupGetDegree :: EcGroup -> Int
- ecGroupGetOrder :: EcGroup -> Integer
- ecGroupGetCoFactor :: EcGroup -> Integer
- ecGroupGetGenerator :: EcGroup -> EcPoint
- ecGroupGetCurveGFp :: EcGroup -> (Integer, Integer, Integer)
- ecGroupGetCurveGF2m :: EcGroup -> (Integer, Integer, Integer)
- ecPointAdd :: EcGroup -> EcPoint -> EcPoint -> EcPoint
- ecPointsSum :: EcGroup -> [EcPoint] -> EcPoint
- ecPointDbl :: EcGroup -> EcPoint -> EcPoint
- ecPointMul :: EcGroup -> EcPoint -> Integer -> EcPoint
- ecPointMulWithGenerator :: EcGroup -> Integer -> EcPoint -> Integer -> EcPoint
- ecPointsMulAndSum :: EcGroup -> [(EcPoint, Integer)] -> EcPoint
- ecPointsMulOfPowerAndSum :: EcGroup -> [EcPoint] -> Integer -> EcPoint
- ecPointGeneratorMul :: EcGroup -> Integer -> EcPoint
- ecPointInvert :: EcGroup -> EcPoint -> EcPoint
- ecPointInfinity :: EcGroup -> EcPoint
- ecPointIsAtInfinity :: EcGroup -> EcPoint -> Bool
- ecPointIsOnCurve :: EcGroup -> EcPoint -> Bool
- ecPointEq :: EcGroup -> EcPoint -> EcPoint -> Bool
- data PointConversionForm
- ecPointToOct :: ByteArray outBytes => EcGroup -> EcPoint -> PointConversionForm -> outBytes
- ecPointFromOct :: ByteArrayAccess inBytes => EcGroup -> inBytes -> Either String EcPoint
- ecPointFromJProjectiveGFp :: EcGroup -> (Integer, Integer, Integer) -> EcPoint
- ecPointToJProjectiveGFp :: EcGroup -> EcPoint -> (Integer, Integer, Integer)
- ecPointFromAffineGFp :: EcGroup -> (Integer, Integer) -> EcPoint
- ecPointToAffineGFp :: EcGroup -> EcPoint -> (Integer, Integer)
- ecPointFromAffineGF2m :: EcGroup -> (Integer, Integer) -> EcPoint
- ecPointToAffineGF2m :: EcGroup -> EcPoint -> (Integer, Integer)
- ecKeyGenerateNew :: EcGroup -> IO EcKey
- ecKeyFromPair :: EcGroup -> (Integer, EcPoint) -> EcKey
- ecKeyToPair :: EcKey -> (Integer, EcPoint)
Documentation
Curve group
ecGroupFromCurveOID :: String -> Maybe EcGroup Source #
try to get a curve group from an ASN1 description string (OID)
e.g.
- "1.3.132.0.35" == SEC_P521_R1
- "1.2.840.10045.3.1.7" == SEC_P256_R1
:: Integer | p |
-> Integer | a |
-> Integer | b |
-> (Integer, Integer) | generator |
-> Integer | order |
-> Integer | cofactor |
-> EcGroup |
Create a new GFp group with explicit (p,a,b,(x,y),order,h)
Generally, this interface should not be used, and user should really not stray away from already defined curves.
Use at your own risks.
:: Integer | p |
-> Integer | a |
-> Integer | b |
-> (Integer, Integer) | generator |
-> Integer | order |
-> Integer | cofactor |
-> EcGroup |
Create a new GF2m group with explicit (p,a,b,(x,y),order,h)
same warning as ecGroupGFp
ecGroupGetDegree :: EcGroup -> Int Source #
get the group degree (number of bytes)
ecGroupGetOrder :: EcGroup -> Integer Source #
get the order of the subgroup generated by the generator
ecGroupGetCoFactor :: EcGroup -> Integer Source #
ecGroupGetGenerator :: EcGroup -> EcPoint Source #
Get the group generator
EcPoint arithmetic
ecPointMulWithGenerator Source #
compute generator * n + q * m
ecPointsMulAndSum :: EcGroup -> [(EcPoint, Integer)] -> EcPoint Source #
compute sum ((q,m) -> q * m) l
ecPointsMulOfPowerAndSum :: EcGroup -> [EcPoint] -> Integer -> EcPoint Source #
Compute the sum of the point to the nth power
f [p1,p2,..,pi] n = p1 * (n ^ 0) + p2 * (n ^ 1) + .. + pi * (n ^ i-1)
ecPointInvert :: EcGroup -> EcPoint -> EcPoint Source #
compute the inverse on the curve on the point p, r = p^(-1)
ecPointInfinity :: EcGroup -> EcPoint Source #
EcPoint serialization
data PointConversionForm Source #
ecPointToOct :: ByteArray outBytes => EcGroup -> EcPoint -> PointConversionForm -> outBytes Source #
Create a binary represention of a point using the specific format
ecPointFromOct :: ByteArrayAccess inBytes => EcGroup -> inBytes -> Either String EcPoint Source #
Try to parse a binary representation to a point
ecPointFromAffineGFp :: EcGroup -> (Integer, Integer) -> EcPoint Source #
Convert a (x,y) to a point representation on a prime curve.
ecPointToAffineGFp :: EcGroup -> EcPoint -> (Integer, Integer) Source #
Convert a point of a prime curve to affine representation (x,y)