age-0.0.1.0: Actually Good Encryption
Safe HaskellNone
LanguageHaskell2010

Crypto.Age.Key

Description

age cryptographic keys.

Synopsis

File key

data FileKey where Source #

Symmetric file key.

Note that this type's Eq instance performs a constant-time equality check.

Bundled Patterns

pattern FileKey :: ScrubbedBytes -> FileKey 

Instances

Instances details
Eq FileKey Source # 
Instance details

Defined in Crypto.Age.Key

Methods

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

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

bytesToFileKey :: ScrubbedBytes -> Maybe FileKey Source #

Construct a FileKey from bytes.

If the provided byte string does not have a length of 16 (128 bits), Nothing is returned.

fileKeyToBytes :: FileKey -> ScrubbedBytes Source #

Get the raw bytes associated with a FileKey.

generateFileKey :: IO FileKey Source #

Randomly generate a FileKey as defined in the age specification.

Payload key nonce

data PayloadKeyNonce where Source #

Payload key nonce.

In accordance with the age specification, this value is used as an extractor salt in the HKDF-Extract step when deriving a PayloadKey with HKDF-SHA256.

Bundled Patterns

pattern PayloadKeyNonce :: ByteString -> PayloadKeyNonce 

Instances

Instances details
Show PayloadKeyNonce Source # 
Instance details

Defined in Crypto.Age.Key

Eq PayloadKeyNonce Source # 
Instance details

Defined in Crypto.Age.Key

bytesToPayloadKeyNonce :: ByteString -> Maybe PayloadKeyNonce Source #

Construct a PayloadKeyNonce from bytes.

If the provided byte string does not have a length of 16 (128 bits), Nothing is returned.

payloadKeyNonceToBytes :: PayloadKeyNonce -> ByteString Source #

Get the raw bytes associated with a PayloadKeyNonce.

Payload key

data PayloadKey where Source #

Symmetric payload key.

Note that this type's Eq instance performs a constant-time equality check.

Bundled Patterns

pattern PayloadKey :: ScrubbedBytes -> PayloadKey 

Instances

Instances details
Eq PayloadKey Source # 
Instance details

Defined in Crypto.Age.Key

bytesToPayloadKey :: ScrubbedBytes -> Maybe PayloadKey Source #

Construct a PayloadKey from bytes.

If the provided byte string does not have a length of 32 (256 bits), Nothing is returned.

payloadKeyToBytes :: PayloadKey -> ScrubbedBytes Source #

Get the raw bytes associated with a PayloadKey.

mkPayloadKey :: PayloadKeyNonce -> FileKey -> PayloadKey Source #

Construct a PayloadKey as defined in the age specification.

The PayloadKey is derived via HKDF-SHA256 given a PayloadKeyNonce as the extractor salt, a FileKey as the input keying material, and the string payload as the expansion context/info.