cryptonite-0.26: Cryptography Primitives sink

License | BSD-style
Maintainer | Vincent Hanquez <vincent@snarc.org>
Stability | experimental
Portability | unknown
Safe Haskell | None
Language | Haskell2010

Crypto.PubKey.Curve25519

Contents

- Smart constructors
- Methods

Description

Curve25519 support

Synopsis

- data SecretKey
- data PublicKey
- data DhSecret
- dhSecret :: ByteArrayAccess b => b -> CryptoFailable DhSecret
- publicKey :: ByteArrayAccess bs => bs -> CryptoFailable PublicKey
- secretKey :: ByteArrayAccess bs => bs -> CryptoFailable SecretKey
- dh :: PublicKey -> SecretKey -> DhSecret
- toPublic :: SecretKey -> PublicKey
- generateSecretKey :: MonadRandom m => m SecretKey

# Documentation

data SecretKey Source #

A Curve25519 Secret key

#### Instances

Instances details

Eq SecretKey Source # |
Instance details Defined in Crypto.PubKey.Curve25519 Methods (==) :: SecretKey -> SecretKey -> Bool # (/=) :: SecretKey -> SecretKey -> Bool #
Show SecretKey Source # |
Instance details Defined in Crypto.PubKey.Curve25519 Methods showsPrec :: Int -> SecretKey -> ShowS # show :: SecretKey -> String # showList :: [SecretKey] -> ShowS #
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 Source # withByteArray :: SecretKey -> (Ptr p -> IO a) -> IO a Source # copyByteArrayToPtr :: SecretKey -> Ptr p -> IO () Source #

data PublicKey Source #

A Curve25519 public key

#### Instances

Instances details

Eq PublicKey Source # |
Instance details Defined in Crypto.PubKey.Curve25519 Methods (==) :: PublicKey -> PublicKey -> Bool # (/=) :: PublicKey -> PublicKey -> Bool #
Show PublicKey Source # |
Instance details Defined in Crypto.PubKey.Curve25519 Methods showsPrec :: Int -> PublicKey -> ShowS # show :: PublicKey -> String # showList :: [PublicKey] -> ShowS #
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 Source # withByteArray :: PublicKey -> (Ptr p -> IO a) -> IO a Source # copyByteArrayToPtr :: PublicKey -> Ptr p -> IO () Source #

data DhSecret Source #

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

#### Instances

Instances details

Eq DhSecret Source # |
Instance details Defined in Crypto.PubKey.Curve25519 Methods (==) :: DhSecret -> DhSecret -> Bool # (/=) :: DhSecret -> DhSecret -> Bool #
Show DhSecret Source # |
Instance details Defined in Crypto.PubKey.Curve25519 Methods showsPrec :: Int -> DhSecret -> ShowS # show :: DhSecret -> String # showList :: [DhSecret] -> ShowS #
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 Source # withByteArray :: DhSecret -> (Ptr p -> IO a) -> IO a Source # copyByteArrayToPtr :: DhSecret -> Ptr p -> IO () Source #

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