NaCl-0.0.5.0: Easy-and-safe-to-use high-level Haskell bindings to NaCl
Safe HaskellNone
LanguageHaskell2010

NaCl.Auth.Internal

Description

Internals of crypto_auth.

Synopsis

Documentation

type Key a = SizedByteArray CRYPTO_AUTH_KEYBYTES a Source #

Secret key that can be used for Sea authentication.

This type is parametrised by the actual data type that contains bytes. This can be, for example, a ByteString, but, since this is a secret key, it is better to use ScrubbedBytes.

toKey :: ByteArrayAccess ba => ba -> Maybe (Key ba) Source #

Make a Key from an arbitrary byte array.

This function returns Just if and only if the byte array has the right length to be used as a key for authentication.

type Authenticator a = SizedByteArray CRYPTO_AUTH_BYTES a Source #

A tag that confirms the authenticity of somde data.

toAuthenticator :: ByteArrayAccess ba => ba -> Maybe (Authenticator ba) Source #

Convert raw bytes into an Authenticator.

This function returns Just if and only if the byte array has the right length to be used as an authenticator.

create Source #

Arguments

:: (ByteArrayAccess keyBytes, ByteArrayAccess msg, ByteArray authBytes) 
=> Key keyBytes

Secret key.

-> msg

Message to authenticate.

-> IO (Authenticator authBytes) 

Create an authenticator.

verify Source #

Arguments

:: (ByteArrayAccess keyBytes, ByteArrayAccess msg, ByteArrayAccess authBytes) 
=> Key keyBytes

Secret key.

-> msg

Authenticated message.

-> Authenticator authBytes

Authenticator tag.

-> IO Bool 

Verify an authenticator.