cryptonite-0.26: Cryptography Primitives sink

LicenseBSD-style
MaintainerVincent Hanquez <vincent@snarc.org>
Stabilityexperimental
Portabilityunknown
Safe HaskellNone
LanguageHaskell2010

Crypto.PubKey.Curve25519

Contents

Description

Curve25519 support

Synopsis

Documentation

data SecretKey Source #

A Curve25519 Secret key

Instances
Eq SecretKey Source # 
Instance details

Defined in Crypto.PubKey.Curve25519

Show SecretKey Source # 
Instance details

Defined in Crypto.PubKey.Curve25519

NFData SecretKey Source # 
Instance details

Defined in Crypto.PubKey.Curve25519

Methods

rnf :: SecretKey -> () #

ByteArrayAccess SecretKey Source # 
Instance details

Defined in Crypto.PubKey.Curve25519

Methods

length :: SecretKey -> Int #

withByteArray :: SecretKey -> (Ptr p -> IO a) -> IO a #

copyByteArrayToPtr :: SecretKey -> Ptr p -> IO () #

data PublicKey Source #

A Curve25519 public key

Instances
Eq PublicKey Source # 
Instance details

Defined in Crypto.PubKey.Curve25519

Show PublicKey Source # 
Instance details

Defined in Crypto.PubKey.Curve25519

NFData PublicKey Source # 
Instance details

Defined in Crypto.PubKey.Curve25519

Methods

rnf :: PublicKey -> () #

ByteArrayAccess PublicKey Source # 
Instance details

Defined in Crypto.PubKey.Curve25519

Methods

length :: PublicKey -> Int #

withByteArray :: PublicKey -> (Ptr p -> IO a) -> IO a #

copyByteArrayToPtr :: PublicKey -> Ptr p -> IO () #

data DhSecret Source #

A Curve25519 Diffie Hellman secret related to a public key and a secret key.

Instances
Eq DhSecret Source # 
Instance details

Defined in Crypto.PubKey.Curve25519

Show DhSecret Source # 
Instance details

Defined in Crypto.PubKey.Curve25519

NFData DhSecret Source # 
Instance details

Defined in Crypto.PubKey.Curve25519

Methods

rnf :: DhSecret -> () #

ByteArrayAccess DhSecret Source # 
Instance details

Defined in Crypto.PubKey.Curve25519

Methods

length :: DhSecret -> Int #

withByteArray :: DhSecret -> (Ptr p -> IO a) -> IO a #

copyByteArrayToPtr :: DhSecret -> Ptr p -> IO () #

Smart constructors

dhSecret :: ByteArrayAccess b => b -> CryptoFailable DhSecret Source #

Create a DhSecret from a bytearray object

publicKey :: ByteArrayAccess bs => bs -> CryptoFailable PublicKey Source #

Try to build a public key from a bytearray

secretKey :: ByteArrayAccess bs => bs -> CryptoFailable SecretKey Source #

Try to build a secret key from a bytearray

Methods

dh :: PublicKey -> SecretKey -> DhSecret Source #

Compute the Diffie Hellman secret from a public key and a secret key.

This implementation may return an all-zero value as it does not check for the condition.

toPublic :: SecretKey -> PublicKey Source #

Create a public key from a secret key

generateSecretKey :: MonadRandom m => m SecretKey Source #

Generate a secret key.