qnap-decrypt-0.3.1: Decrypt files encrypted by QNAP's Hybrid Backup Sync

Safe HaskellNone
LanguageHaskell2010

Data.Conduit.Crypto

Contents

Description

This module provides a function to decrypt a padded and encrypted stream of ByteStrings.

Synopsis

Decrypt

decryptPaddedStream Source #

Arguments

:: Exception e 
=> BlockCipher cipher 
=> Monad m 
=> e

The exception to throw in case of a padding error

-> Int

The chunk size (in Bytes, you may use defaultChunkSize, will be modified to be a guaranteed multiple (at least 1) of the blockSizeBytes)

-> (IV cipher -> ByteString -> (ByteString, IV cipher))

The decrypt function

-> IV cipher

The IV (see BlockCipher)

-> ConduitT ByteString ByteString m () 

Decrypt a PKCS padded and encrypted stream of ByteStrings

  runConduitRes $
    sourceFile inName .|
    decryptPaddedStream (error "Padding Error") defaultChunkSize (unCbc key) iv .|
    sinkFile outName

Since 0.3.0

Re-Export

defaultChunkSize :: Int #

The chunk size used for I/O. Currently set to 32k, less the memory management overhead