rncryptor-0.3.0.2: Haskell implementation of the RNCryptor file format
Safe HaskellNone
LanguageHaskell2010

Crypto.RNCryptor.V3.Decrypt

Synopsis

Documentation

parseHeader :: ByteString -> RNCryptorHeader Source #

Parse the input ByteString to extract the RNCryptorHeader, as defined in the V3 spec. The incoming ByteString is expected to have at least 34 bytes available. As the HMAC can be found only at the very end of an encrypted file, RNCryptorHeader provides by default a function to parse the HMAC, callable at the right time during streaming/parsing.

decrypt :: ByteString -> ByteString -> Either RNCryptorException ByteString Source #

Decrypt an encrypted message. Please be aware that this is a user-friendly but dangerous function, in the sense that it will load the *ENTIRE* input in memory. It's mostly suitable for small inputs like passwords. For large inputs, where size exceeds the available memory, please use decryptStream.

Returns either the reason for failure, or the successfully decrypted message.

decryptBlock :: RNCryptorContext -> ByteString -> (RNCryptorContext, ByteString) Source #

Decrypt a raw Bytestring block. The function returns the clear text block plus a new RNCryptorContext, which is needed because the IV needs to be set to the last 16 bytes of the previous cipher text. (Thanks to Rob Napier for the insight).

decryptStream Source #

Arguments

:: ByteString

The user key (e.g. password)

-> InputStream ByteString

The input source (mostly likely stdin)

-> OutputStream ByteString

The output source (mostly likely stdout)

-> IO () 

Efficiently decrypts an incoming stream of bytes.