cryptonite-openssl-0.1: Crypto stuff using OpenSSL cryptographic library

LicenseBSD-style
Stabilityexperimental
PortabilityUnix
Safe HaskellNone
LanguageHaskell2010

Crypto.OpenSSL.ECC

Contents

Description

 

Synopsis

Documentation

data EcPoint Source

An elliptic curve point

data EcGroup Source

An ellitic curve group

data EcKey Source

An elliptic curve key

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

ecGroupGFp Source

Arguments

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

ecGroupGF2m Source

Arguments

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

ecGroupGetCurveGFp :: EcGroup -> (Integer, Integer, Integer) Source

get curve's (prime,a,b)

ecGroupGetCurveGF2m :: EcGroup -> (Integer, Integer, Integer) Source

get curve's (polynomial,a,b)

EcPoint arithmetic

ecPointAdd :: EcGroup -> EcPoint -> EcPoint -> EcPoint Source

add 2 points together, r = p1 + p2

ecPointDbl :: EcGroup -> EcPoint -> EcPoint Source

compute the doubling of the point p, r = p^2

ecPointMul Source

Arguments

:: EcGroup 
-> EcPoint

q

-> Integer

m

-> EcPoint 

compute q * m

ecPointMulWithGenerator Source

Arguments

:: EcGroup 
-> Integer

n

-> EcPoint

q

-> Integer

m

-> EcPoint 

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)

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

ecPointEq :: EcGroup -> EcPoint -> EcPoint -> Bool Source

return if a point eq another point

EcPoint serialization

ecPointToOct :: ByteArray outBytes => EcGroup -> EcPoint -> PointConversionForm -> outBytes 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