libsodium-bindings-0.0.1.1: FFI bindings to libsodium
Copyright(C) Hécate Moonlight 2022
LicenseBSD-3-Clause
MaintainerThe Haskell Cryptography Group
StabilityStable
PortabilityGHC only
Safe HaskellNone
LanguageHaskell2010

LibSodium.Bindings.KeyDerivation

Description

 
Synopsis

Introduction

From a single, high-entropy key, you can derive multiple secret sub-keys.

This API can derive up to 2⁶⁴ keys from a single key and context, and these sub-keys can have an arbitrary length between 128 (16 bytes) and 512 bits (64 bytes).

Key Generation

cryptoKDFKeygen Source #

Arguments

:: Ptr Word8

Pointer that will hold the master key of length cryptoKDFKeyBytes

-> IO () 

Generate a high-entropy key from which the sub-keys will be derived.

See: crypto_kdf_keygen()

Since: 0.0.1.0

cryptoKDFDeriveFromKey Source #

Arguments

:: Ptr CUChar

Pointer that will hold the sub-key.

-> CSize

Length of the sub-key.

-> Word64

Identifier of the sub-key. Must not be reused for another sub-key.

-> Ptr CChar

Pointer to the context, of size cryptoKDFContextBytes.

-> Ptr CUChar

Pointer to the master key, which will be of length cryptoKDFKeyBytes.

-> IO CInt

Returns 0 on success and -1 on error.

Derive a sub-key from a high-entropy secre key with a unique identifier. The identifier can be any value up to 2⁶⁴-1

See: crypto_kdf_derive_from_key()

Since: 0.0.1.0

Constants

cryptoKDFBytesMin :: CSize Source #

Minimum length of a sub-key.

See: crypto_kdf_BYTES_MIN

Since: 0.0.1.0

cryptoKDFBytesMax :: CSize Source #

Maximum length of a sub-key.

See: crypto_kdf_BYTES_MAX

Since: 0.0.1.0

cryptoKDFKeyBytes :: CSize Source #

Length of the master key.

See: crypto_kdf_KEYBYTES

Since: 0.0.1.0

cryptoKDFContextBytes :: CSize Source #

Length of a Context.

See: crypto_kdf_CONTEXTBYTES

Since: 0.0.1.0