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

Crypto.OpenSSL.ECC

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

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

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.

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

get the group degree (number of bytes)

get the order of the subgroup generated by the generator

Get the group generator

get curve's (prime,a,b)

get curve's (polynomial,a,b)

# EcPoint arithmetic

add 2 points together, r = p1 + p2

ecPointsSum :: EcGroup -> [EcPoint] -> EcPoint Source #

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

Arguments

 :: EcGroup -> EcPoint q -> Integer m -> EcPoint

compute q * m

Arguments

 :: EcGroup -> Integer n -> EcPoint q -> Integer m -> EcPoint

compute generator * n + q * m

ecPointsMulAndSum :: EcGroup -> [(EcPoint, Integer)] -> EcPoint Source #

compute sum ((q,m) -> q * m) l

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)

compute generator * n

compute the inverse on the curve on the point p, r = p^(-1)

get if the point is at infinity

get if the point is on the curve

return if a point eq another point

# EcPoint serialization

Instances

 Source # Methods Source # Methods

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

Convert a (x,y) to a point representation on a prime curve.

Convert a point of a prime curve to affine representation (x,y)

# Key

generate a new key in a specific group

create a key from a group and a private integer and public point keypair

return the private integer and public point of a key