crypton-0.33: Cryptography Primitives sink
LicenseBSD-style
MaintainerVincent Hanquez <vincent@snarc.org>
Stabilityexperimental
Portabilityunknown
Safe HaskellSafe-Inferred
LanguageHaskell2010

Crypto.PubKey.Curve25519

Description

Curve25519 support

Synopsis

Documentation

data SecretKey #

A Curve25519 Secret key

Instances

Instances details
Show SecretKey # 
Instance details

Defined in Crypto.PubKey.Curve25519

Methods

showsPrec :: Int -> SecretKey -> ShowS #

show :: SecretKey -> String #

showList :: [SecretKey] -> ShowS #

NFData SecretKey # 
Instance details

Defined in Crypto.PubKey.Curve25519

Methods

rnf :: SecretKey -> ()

Eq SecretKey # 
Instance details

Defined in Crypto.PubKey.Curve25519

ByteArrayAccess SecretKey # 
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 #

A Curve25519 public key

Instances

Instances details
Show PublicKey # 
Instance details

Defined in Crypto.PubKey.Curve25519

Methods

showsPrec :: Int -> PublicKey -> ShowS #

show :: PublicKey -> String #

showList :: [PublicKey] -> ShowS #

NFData PublicKey # 
Instance details

Defined in Crypto.PubKey.Curve25519

Methods

rnf :: PublicKey -> ()

Eq PublicKey # 
Instance details

Defined in Crypto.PubKey.Curve25519

ByteArrayAccess PublicKey # 
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 #

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

Instances

Instances details
Show DhSecret # 
Instance details

Defined in Crypto.PubKey.Curve25519

Methods

showsPrec :: Int -> DhSecret -> ShowS #

show :: DhSecret -> String #

showList :: [DhSecret] -> ShowS #

NFData DhSecret # 
Instance details

Defined in Crypto.PubKey.Curve25519

Methods

rnf :: DhSecret -> ()

Eq DhSecret # 
Instance details

Defined in Crypto.PubKey.Curve25519

ByteArrayAccess DhSecret # 
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 #

Create a DhSecret from a bytearray object

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

Try to build a public key from a bytearray

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

Try to build a secret key from a bytearray

Methods

dh :: PublicKey -> SecretKey -> DhSecret #

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 #

Create a public key from a secret key

generateSecretKey :: MonadRandom m => m SecretKey #

Generate a secret key.