tahoe-chk-0.2.0.0: The Tahoe-LAFS' Content-Hash-Key (CHK) cryptographic protocol.
Safe HaskellNone
LanguageHaskell2010

Tahoe.CHK

Synopsis

Documentation

zfec Source #

Arguments

:: Int

The number of outputs that will be required to reverse the encoding. Also known as k.

-> Int

The total number of outputs to produce. Also known as n.

-> ByteString

Application data to divide into encoding inputs.

-> IO [ByteString]

n encoding outputs.

Erasure encode some bytes using ZFEC.

zunfec Source #

Arguments

:: Int

The k parameter used when encoding the data to decode.

-> Int

The n parameter used when encoding the data to decode.

-> [(Int, ByteString)]

The encoding outputs annotated with their position (or "share number").

-> IO ByteString

The bytes which were originally encoded.

Erasure decode some bytes using ZFEC.

encode Source #

Arguments

:: Key AES128

The encryption/decryption key.

-> Parameters

The ZFEC parameters for this encoding. This determines how many shares will come out of this function.

-> ByteString

The data to encode. This is typically ciphertext.

-> IO ([Share], Reader)

An IO which can be evaluated to get the encoded share data and the read capability. The number of Shares will equal the total value from the given Parameters.

Encode some application data (typically ciphertext, but this function only weakly assumes this is the case) into some CHK shares.

This replaces much of allmydata.immutable.encode.

decode Source #

Arguments

:: Reader

The read capability for the application data.

-> [(Int, Share)]

At least as many shares as are required to erasure decode the ciphertext.

-> IO (Either DecodeError ByteString)

An action that results in Right of the ciphertext contained by the shares if it is possible to recover it, or Left with information about why it is not.

Decode some CHK shares to recover some application data. This is roughly the inverse of `encode`.

segmentCiphertext Source #

Arguments

:: Parameters

The encoding parameters which determine how to split the ciphertext.

-> ByteString

The ciphertext.

-> [ByteString]

The segments.

Split a full ciphertext string into the separate ciphertext segments required by most of CHK encoding.

data DecodeError Source #

A problem was encountered during decoding.

Constructors

SizeOverflow

The size of the data is greater than the limits imposed by this implementation.

NotEnoughShares

There weren't enough shares supplied to attempt erasure decoding.

IntegrityError

After discarding shares for which the fingerprint from the read | capability did not match the URI extension block, there weren't | enough shares left to attempt erasure decoding.

Fields

BlockHashError

The hash of one or more blocks did not match the expected value.

CiphertextHashError

The hash of one or more ciphertext segments did not match the expected value.