cryptonite-0.30: Cryptography Primitives sink

License | BSD-style
Maintainer | John Galt <jgalt@centromere.net>
Stability | experimental
Portability | unknown
Safe Haskell | Safe-Inferred
Language | Haskell2010

Crypto.PubKey.Curve448

Contents

- Smart constructors
- Methods

Description

Curve448 support

Internally uses Decaf point compression to omit the cofactor and implementation by Mike Hamburg. Externally API and data types are compatible with the encoding specified in RFC 7748.

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 Curve448 Secret key

#### Instances

Instances details

Show SecretKey Source # |
Instance details Defined in Crypto.PubKey.Curve448 Methods showsPrec :: Int -> SecretKey -> ShowS Source # show :: SecretKey -> String Source # showList :: [SecretKey] -> ShowS Source #
NFData SecretKey Source # |
Instance details Defined in Crypto.PubKey.Curve448 Methods rnf :: SecretKey -> () Source #
Eq SecretKey Source # |
Instance details Defined in Crypto.PubKey.Curve448 Methods (==) :: SecretKey -> SecretKey -> Bool Source # (/=) :: SecretKey -> SecretKey -> Bool Source #
ByteArrayAccess SecretKey Source # |
Instance details Defined in Crypto.PubKey.Curve448 Methods length :: SecretKey -> Int Source # withByteArray :: SecretKey -> (Ptr p -> IO a) -> IO a Source # copyByteArrayToPtr :: SecretKey -> Ptr p -> IO () Source #

data PublicKey Source #

A Curve448 public key

#### Instances

Instances details

Show PublicKey Source # |
Instance details Defined in Crypto.PubKey.Curve448 Methods showsPrec :: Int -> PublicKey -> ShowS Source # show :: PublicKey -> String Source # showList :: [PublicKey] -> ShowS Source #
NFData PublicKey Source # |
Instance details Defined in Crypto.PubKey.Curve448 Methods rnf :: PublicKey -> () Source #
Eq PublicKey Source # |
Instance details Defined in Crypto.PubKey.Curve448 Methods (==) :: PublicKey -> PublicKey -> Bool Source # (/=) :: PublicKey -> PublicKey -> Bool Source #
ByteArrayAccess PublicKey Source # |
Instance details Defined in Crypto.PubKey.Curve448 Methods length :: PublicKey -> Int Source # withByteArray :: PublicKey -> (Ptr p -> IO a) -> IO a Source # copyByteArrayToPtr :: PublicKey -> Ptr p -> IO () Source #

data DhSecret Source #

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

#### Instances

Instances details

Show DhSecret Source # |
Instance details Defined in Crypto.PubKey.Curve448 Methods showsPrec :: Int -> DhSecret -> ShowS Source # show :: DhSecret -> String Source # showList :: [DhSecret] -> ShowS Source #
NFData DhSecret Source # |
Instance details Defined in Crypto.PubKey.Curve448 Methods rnf :: DhSecret -> () Source #
Eq DhSecret Source # |
Instance details Defined in Crypto.PubKey.Curve448 Methods (==) :: DhSecret -> DhSecret -> Bool Source # (/=) :: DhSecret -> DhSecret -> Bool Source #
ByteArrayAccess DhSecret Source # |
Instance details Defined in Crypto.PubKey.Curve448 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.