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
- ecPointDbl :: EcGroup -> EcPoint -> EcPoint
- ecPointMul :: EcGroup -> EcPoint -> Integer -> EcPoint
- ecPointMulWithGenerator :: EcGroup -> Integer -> 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
- 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
ecGroupGetGenerator :: EcGroup -> EcPoint Source
Get the group generator
EcPoint arithmetic
ecPointDbl :: EcGroup -> EcPoint -> EcPoint Source
compute the doubling of the point p, r = p^2
ecPointMulWithGenerator Source
compute generator * n + q * m
ecPointGeneratorMul :: EcGroup -> Integer -> EcPoint Source
compute generator * n
ecPointInvert :: EcGroup -> EcPoint -> EcPoint Source
compute the inverse on the curve on the point p, r = p^(-1)
ecPointInfinity :: EcGroup -> EcPoint Source
ecPointIsAtInfinity :: EcGroup -> EcPoint -> Bool Source
get if the point is at infinity
ecPointIsOnCurve :: EcGroup -> EcPoint -> Bool Source
get if the point is on the curve
EcPoint serialization
ecPointToOct :: ByteArray outBytes => EcGroup -> EcPoint -> PointConversionForm -> outBytes Source
ecPointFromOct :: ByteArrayAccess inBytes => EcGroup -> inBytes -> Either String EcPoint Source
Key
ecKeyGenerateNew :: EcGroup -> IO EcKey Source
generate a new key in a specific group
ecKeyFromPair :: EcGroup -> (Integer, EcPoint) -> EcKey Source
create a key from a group and a private integer and public point keypair
ecKeyToPair :: EcKey -> (Integer, EcPoint) Source
return the private integer and public point of a key