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

Crypto.PubKey.Ed25519

Description

Ed25519 support

Synopsis

Documentation

data SecretKey Source #

An Ed25519 Secret key

Instances

Instances details
Show SecretKey Source # 
Instance details

Defined in Crypto.PubKey.Ed25519

NFData SecretKey Source # 
Instance details

Defined in Crypto.PubKey.Ed25519

Methods

rnf :: SecretKey -> () #

Eq SecretKey Source # 
Instance details

Defined in Crypto.PubKey.Ed25519

ByteArrayAccess SecretKey Source # 
Instance details

Defined in Crypto.PubKey.Ed25519

Methods

length :: SecretKey -> Int #

withByteArray :: SecretKey -> (Ptr p -> IO a) -> IO a #

copyByteArrayToPtr :: SecretKey -> Ptr p -> IO () #

data PublicKey Source #

An Ed25519 public key

Instances

Instances details
Show PublicKey Source # 
Instance details

Defined in Crypto.PubKey.Ed25519

NFData PublicKey Source # 
Instance details

Defined in Crypto.PubKey.Ed25519

Methods

rnf :: PublicKey -> () #

Eq PublicKey Source # 
Instance details

Defined in Crypto.PubKey.Ed25519

ByteArrayAccess PublicKey Source # 
Instance details

Defined in Crypto.PubKey.Ed25519

Methods

length :: PublicKey -> Int #

withByteArray :: PublicKey -> (Ptr p -> IO a) -> IO a #

copyByteArrayToPtr :: PublicKey -> Ptr p -> IO () #

data Signature Source #

An Ed25519 signature

Instances

Instances details
Show Signature Source # 
Instance details

Defined in Crypto.PubKey.Ed25519

NFData Signature Source # 
Instance details

Defined in Crypto.PubKey.Ed25519

Methods

rnf :: Signature -> () #

Eq Signature Source # 
Instance details

Defined in Crypto.PubKey.Ed25519

ByteArrayAccess Signature Source # 
Instance details

Defined in Crypto.PubKey.Ed25519

Methods

length :: Signature -> Int #

withByteArray :: Signature -> (Ptr p -> IO a) -> IO a #

copyByteArrayToPtr :: Signature -> Ptr p -> IO () #

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. The public key parameter is ignored and its public key is generated from the secret key parameter to prevent Double Public Key Signing Function Oracle Attack.

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

Sign a message using the key pair. This is old sign, which is vulnerable to private key compromise if the given public key does not correspond to the secret key. This function is provided for performance critical applications. To use it safely, applications must verify or derive the public key.

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

Verify a message

generateSecretKey :: MonadRandom m => m SecretKey Source #

Generate a secret key