HsOpenSSL-0.11.4.14: Partial OpenSSL binding for Haskell

Safe HaskellNone
LanguageHaskell2010

OpenSSL.Cipher

Description

This module interfaces to some of the OpenSSL ciphers without using EVP (see OpenSSL.EVP.Cipher). The EVP ciphers are easier to use, however, in some cases you cannot do without using the OpenSSL fuctions directly.

One of these cases (and the motivating example for this module) is that the EVP CBC functions try to encode the length of the input string in the output (thus hiding the fact that the cipher is, in fact, block based and needs padding). This means that the EVP CBC functions cannot, in some cases, interface with other users which don't use that system (like SSH).

Synopsis

Documentation

data Mode Source #

Constructors

Encrypt 
Decrypt 

Instances

Eq Mode Source # 

Methods

(==) :: Mode -> Mode -> Bool #

(/=) :: Mode -> Mode -> Bool #

Show Mode Source # 

Methods

showsPrec :: Int -> Mode -> ShowS #

show :: Mode -> String #

showList :: [Mode] -> ShowS #

newAESCtx Source #

Arguments

:: Mode

For CTR mode, this must always be Encrypt

-> ByteString

Key: 128, 192 or 256 bits long

-> ByteString

IV: 16 bytes long

-> IO AESCtx 

Construct a new context which holds the key schedule and IV.

aesCBC Source #

Arguments

:: AESCtx

context

-> ByteString

input, must be multiple of block size (16 bytes)

-> IO ByteString 

Encrypt some number of blocks using CBC. This is an IO function because the context is destructivly updated.

aesCTR Source #

Arguments

:: AESCtx

context

-> ByteString

input, any number of bytes

-> IO ByteString 

Encrypt some number of bytes using CTR mode. This is an IO function because the context is destructivly updated.