crypto-sodium-0.0.4.0: Easy-and-safe-to-use high-level cryptography based on Sodium
Safe HaskellNone
LanguageHaskell2010

Crypto.Key.Internal

Description

Key derivation/generation internals.

Synopsis

Documentation

data Params Source #

Secure-hashing parameters.

Constructors

Params 

Fields

Instances

Instances details
Eq Params Source # 
Instance details

Defined in Crypto.Pwhash.Internal

Methods

(==) :: Params -> Params -> Bool #

(/=) :: Params -> Params -> Bool #

Ord Params Source # 
Instance details

Defined in Crypto.Pwhash.Internal

Show Params Source # 
Instance details

Defined in Crypto.Pwhash.Internal

type DerivationSlip = ByteString Source #

Opaque bytes that contain the salt and pwhash params.

derive :: (ByteArrayAccess passwd, ByteArrayN n key, CRYPTO_PWHASH_BYTES_MIN <= n, n <= CRYPTO_PWHASH_BYTES_MAX) => Params -> passwd -> IO (Maybe (key, DerivationSlip)) Source #

Derive a key for the first time.

rederive :: (ByteArrayAccess passwd, ByteArrayN n key, CRYPTO_PWHASH_BYTES_MIN <= n, n <= CRYPTO_PWHASH_BYTES_MAX) => DerivationSlip -> passwd -> IO (Maybe key) Source #

Derive the same key form the same password again.

data DerivationSlipData Source #

Data contained in a derivation slip.

This data type is used only internally within this module for convenience. It is exported only for testing purposes.

Currently only one KDF is supported, so it is assumed implicitly, however the actual binary encoding contains an identifier of the KDF used (for forward-compatibility).

Constructors

DerivationSlipData 

Fields

derivationSlipEncode :: DerivationSlipData -> DerivationSlip Source #

Encode derivation slip data into bytes.

derivationSlipDecode :: DerivationSlip -> Maybe DerivationSlipData Source #

Decode derivation slip data from bytes.