Safe Haskell | None |
---|---|
Language | Haskell2010 |
Implement the scheme for encoding ciphertext into SDMF shares (and decoding it again).
Synopsis
- encode :: (MonadFail m, MonadIO m, MonadRandom m) => KeyPair -> SDMF_IV -> Word64 -> Word16 -> Word16 -> ByteString -> m ([Share], Writer)
- makeShare :: Word64 -> SDMF_IV -> Word8 -> Word8 -> Word64 -> Word64 -> Verification -> ByteString -> ByteString -> Share
- decode :: (MonadFail m, MonadIO m) => Reader -> [(Word16, Share)] -> m ByteString
- capabilityForKeyPair :: KeyPair -> Either Text Writer
- maybeToEither :: a -> Maybe b -> Either a b
- maybeToEither' :: e -> Either e (Maybe a) -> Either e a
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.
makeShare :: Word64 -> SDMF_IV -> Word8 -> Word8 -> Word64 -> Word64 -> Verification -> ByteString -> ByteString -> Share Source #
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 #