curve25519-0.2.8: Fast implementations of the curve25519 elliptic curve primitives.

Safe Haskell | None
Language | Haskell2010

Crypto.Curve25519.Exceptions

Description

An implementation of the core methods of the elliptic curve Curve25519 suite. These functions are largely wrappers over the curve25519-donna library from Google. Note that those functions that utilize a CryptoRandomGen instance may throw a GenError exception if the generator fails for any reason.

Synopsis

- data PrivateKey
- data PublicKey
- importPublic :: ByteString -> Maybe PublicKey
- exportPublic :: PublicKey -> ByteString
- generatePrivate :: CryptoRandomGen g => g -> (PrivateKey, g)
- generatePublic :: PrivateKey -> PublicKey
- generateKeyPair :: CryptoRandomGen g => g -> (PrivateKey, PublicKey, g)
- makeShared :: PrivateKey -> PublicKey -> ByteString

# Documentation

data PrivateKey Source #

The type of a Curve25519 private key.

#### Instances

Instances details

Show PrivateKey Source # |
Instance details Defined in Crypto.Curve25519.Pure Methods showsPrec :: Int -> PrivateKey -> ShowS Source # show :: PrivateKey -> String Source # showList :: [PrivateKey] -> ShowS Source #

data PublicKey Source #

The type of a Curve25519 public key.

#### Instances

Instances details

Show PublicKey Source # |
Instance details Defined in Crypto.Curve25519.Pure Methods showsPrec :: Int -> PublicKey -> ShowS Source # show :: PublicKey -> String Source # showList :: [PublicKey] -> ShowS Source #

importPublic :: ByteString -> Maybe PublicKey Source #

Import a public key from a ByteString. The ByteString must be exactly 32 bytes long for this to work.

exportPublic :: PublicKey -> ByteString Source #

Export a public key to a ByteString.

generatePrivate :: CryptoRandomGen g => g -> (PrivateKey, g) Source #

Randomly generate a Curve25519 private key.

generatePublic :: PrivateKey -> PublicKey Source #

Randomly generate a Curve25519 public key.

generateKeyPair :: CryptoRandomGen g => g -> (PrivateKey, PublicKey, g) Source #

Randomly generate a key pair.

makeShared :: PrivateKey -> PublicKey -> ByteString Source #

Generate a shared secret from a private key and a public key.