Crypto.KDF.HKDF

crypton-1.0.1: Cryptography Primitives sink

License | BSD-style
Maintainer | Vincent Hanquez <vincent@snarc.org>
Stability | experimental
Portability | unknown
Safe Haskell | None
Language | Haskell2010

Crypto.KDF.HKDF

Description

Key Derivation Function based on HMAC

See RFC5869

Synopsis

- data PRK a
- extract :: (HashAlgorithm a, ByteArrayAccess salt, ByteArrayAccess ikm) => salt -> ikm -> PRK a
- extractSkip :: ByteArrayAccess ikm => ikm -> PRK a
- expand :: (HashAlgorithm a, ByteArrayAccess info, ByteArray out) => PRK a -> info -> Int -> out

# Documentation

data PRK a #

Pseudo Random Key

#### Instances

Instances details

Eq (PRK a) # |
Instance details Defined in Crypto.KDF.HKDF Methods (==) :: PRK a -> PRK a -> Bool # (/=) :: PRK a -> PRK a -> Bool #
ByteArrayAccess (PRK a) # |
Instance details Defined in Crypto.KDF.HKDF Methods length :: PRK a -> Int # withByteArray :: PRK a -> (Ptr p -> IO a0) -> IO a0 # copyByteArrayToPtr :: PRK a -> Ptr p -> IO () #

extract #

Arguments

:: (HashAlgorithm a, ByteArrayAccess salt, ByteArrayAccess ikm) |
=> salt | Salt
-> ikm | Input Keying Material
-> PRK a | Pseudo random key

Extract a Pseudo Random Key using the parameter and the underlaying hash mechanism

extractSkip :: ByteArrayAccess ikm => ikm -> PRK a #

Create a PRK directly from the input key material.

Only use when guaranteed to have a good quality and random data to use directly as key. This effectively skip a HMAC with key=salt and data=key.

expand #

Arguments

:: (HashAlgorithm a, ByteArrayAccess info, ByteArray out) |
=> PRK a | Pseudo Random Key
-> info | Optional context and application specific information
-> Int | Output length in bytes
-> out | Output data

Expand key material of specific length out of the parameters