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

Contents

- Size constants
- Smart constructors
- Methods

Description

Ed25519 support

Synopsis

- data SecretKey
- data PublicKey
- data Signature
- publicKeySize :: Int
- secretKeySize :: Int
- signatureSize :: Int
- signature :: ByteArrayAccess ba => ba -> CryptoFailable Signature
- publicKey :: ByteArrayAccess ba => ba -> CryptoFailable PublicKey
- secretKey :: ByteArrayAccess ba => ba -> CryptoFailable SecretKey
- toPublic :: SecretKey -> PublicKey
- sign :: ByteArrayAccess ba => SecretKey -> PublicKey -> ba -> Signature
- verify :: ByteArrayAccess ba => PublicKey -> ba -> Signature -> Bool
- generateSecretKey :: MonadRandom m => m SecretKey

# Documentation

data SecretKey Source #

An Ed25519 Secret key

#### Instances

Instances details

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

data PublicKey Source #

An Ed25519 public key

#### Instances

Instances details

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

data Signature Source #

An Ed25519 signature

#### Instances

Instances details

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

# Size constants

publicKeySize :: Int Source #

A public key is 32 bytes

secretKeySize :: Int Source #

A secret key is 32 bytes

signatureSize :: Int Source #

A signature is 64 bytes

# Smart constructors

signature :: ByteArrayAccess ba => ba -> CryptoFailable Signature Source #

Try to build a signature from a bytearray

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

Try to build a public key from a bytearray

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

Try to build a secret key from a bytearray

# Methods

toPublic :: SecretKey -> PublicKey Source #

Create a public key from a secret key

sign :: ByteArrayAccess ba => SecretKey -> PublicKey -> ba -> Signature Source #

Sign a message using the key pair

verify :: ByteArrayAccess ba => PublicKey -> ba -> Signature -> Bool Source #

Verify a message

generateSecretKey :: MonadRandom m => m SecretKey Source #

Generate a secret key