tahoe-ssk-0.3.0.0: An implementation of the Tahoe-LAFS SSK cryptographic protocols
Safe HaskellNone
LanguageHaskell2010

Tahoe.SDMF.Internal.Encoding

Description

Implement the scheme for encoding ciphertext into SDMF shares (and decoding it again).

Synopsis

Documentation

encode :: (MonadFail m, MonadIO m, MonadRandom m) => KeyPair -> SDMF_IV -> Word64 -> Word16 -> Word16 -> ByteString -> m ([Share], Writer) Source #

Given a pre-determined key pair and sequence number, encode some ciphertext into a collection of SDMF shares.

A key pair *uniquely identifies* a "slot" (the storage location for the shares). Thus they cannot be re-used for "different" data. Any shares created with a given key pair are part of the same logical data object.

decode :: (MonadFail m, MonadIO m) => Reader -> [(Word16, Share)] -> m ByteString Source #

Decode some SDMF shares to recover the original ciphertext.

TODO: Use the read capability to verify the shares were constructed with information from the matching write capability.

capabilityForKeyPair :: KeyPair -> Either Text Writer Source #

Compute an SDMF write capability for a given keypair.

maybeToEither :: a -> Maybe b -> Either a b Source #

maybeToEither' :: e -> Either e (Maybe a) -> Either e a Source #