Safe Haskell | None |
---|---|
Language | Haskell2010 |
Internals of crypto_auth
.
Synopsis
- type Key a = SizedByteArray CRYPTO_AUTH_KEYBYTES a
- toKey :: ByteArrayAccess ba => ba -> Maybe (Key ba)
- type Authenticator a = SizedByteArray CRYPTO_AUTH_BYTES a
- toAuthenticator :: ByteArrayAccess ba => ba -> Maybe (Authenticator ba)
- create :: (ByteArrayAccess keyBytes, ByteArrayAccess msg, ByteArray authBytes) => Key keyBytes -> msg -> IO (Authenticator authBytes)
- verify :: (ByteArrayAccess keyBytes, ByteArrayAccess msg, ByteArrayAccess authBytes) => Key keyBytes -> msg -> Authenticator authBytes -> IO Bool
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.
:: (ByteArrayAccess keyBytes, ByteArrayAccess msg, ByteArray authBytes) | |
=> Key keyBytes | Secret key. |
-> msg | Message to authenticate. |
-> IO (Authenticator authBytes) |
Create an authenticator.
:: (ByteArrayAccess keyBytes, ByteArrayAccess msg, ByteArrayAccess authBytes) | |
=> Key keyBytes | Secret key. |
-> msg | Authenticated message. |
-> Authenticator authBytes | Authenticator tag. |
-> IO Bool |
Verify an authenticator.