saltine-0.1.0.0: Cryptography that's easy to digest (NaCl/libsodium bindings).

Copyright(c) Joseph Abrahamson 2013
LicenseMIT
Maintainerme@jspha.com
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Crypto.Saltine.Core.Sign

Description

Signatures: Crypto.Saltine.Core.Sign

The newKeypair function randomly generates a secret key and a corresponding public key. The sign function signs a message ByteString using the signer's secret key and returns the resulting signed message. The signOpen function verifies the signature in a signed message using the signer's public key then returns the message without its signature.

Crypto.Saltine.Core.Sign is an EdDSA signature using elliptic-curve Curve25519 (see: http://ed25519.cr.yp.to/). See also, "Daniel J. Bernstein, Niels Duif, Tanja Lange, Peter Schwabe, Bo-Yin Yang. High-speed high-security signatures. Journal of Cryptographic Engineering 2 (2012), 77–89." http://ed25519.cr.yp.to/ed25519-20110926.pdf.

This is current information as of 2013 June 6.

Synopsis

Documentation

type Keypair = (SecretKey, PublicKey) Source #

A convenience type for keypairs

newKeypair :: IO Keypair Source #

Creates a random key of the correct size for sign and signOpen of form (secretKey, publicKey).

sign Source #

Arguments

:: SecretKey 
-> ByteString

Message

-> ByteString

Signed message

Augments a message with a signature forming a "signed message".

signOpen Source #

Arguments

:: PublicKey 
-> ByteString

Signed message

-> Maybe ByteString

Maybe the restored message

Checks a "signed message" returning Just the original message iff the signature was generated using the SecretKey corresponding to the given PublicKey. Returns Nothing otherwise.

signDetached Source #

Arguments

:: SecretKey 
-> ByteString

Message

-> ByteString

Signature

Returns just the signature for a message using a SecretKey.

signVerifyDetached Source #

Arguments

:: PublicKey 
-> ByteString

Signature

-> ByteString

Message

-> Bool 

Returns True if the signature is valid for the given public key and message.