botan-bindings-0.0.1.0: Raw Botan bindings
Copyright(c) Leo D 2023
LicenseBSD-3-Clause
Maintainerleo@apotheca.io
Stabilityexperimental
PortabilityPOSIX
Safe HaskellSafe-Inferred
LanguageHaskell2010

Botan.Bindings.BlockCipher

Description

This is a ‘raw’ interface to ECB mode block ciphers. Most applications want the higher level cipher API which provides authenticated encryption. This API exists as an escape hatch for applications which need to implement custom primitives using a PRP.

Synopsis

Documentation

data BotanBlockCipherStruct Source #

Opaque BlockCipher struct

pattern BOTAN_BLOCK_CIPHER_DES :: (Eq a, IsString a) => a Source #

pattern BOTAN_BLOCK_CIPHER_IDEA :: (Eq a, IsString a) => a Source #

botan_block_cipher_init Source #

Arguments

:: Ptr BotanBlockCipher

bc

-> ConstPtr CChar

cipher_name

-> IO CInt 

Initialize a block cipher object

botan_block_cipher_clear Source #

Arguments

:: BotanBlockCipher

bc

-> IO CInt

0 on success, a negative value on failure

Reinitializes the block cipher

botan_block_cipher_set_key Source #

Arguments

:: BotanBlockCipher

bc

-> ConstPtr Word8

key[]

-> CSize

len

-> IO CInt 

Set the key for a block cipher instance

botan_block_cipher_block_size Source #

Arguments

:: BotanBlockCipher

bc

-> IO CInt 

Return the positive block size of this block cipher, or negative to indicate an error

botan_block_cipher_encrypt_blocks Source #

Arguments

:: BotanBlockCipher

bc

-> ConstPtr Word8

in[]

-> Ptr Word8

out[]

-> CSize

blocks

-> IO CInt 

Encrypt one or more blocks with the cipher

botan_block_cipher_decrypt_blocks Source #

Arguments

:: BotanBlockCipher

bc

-> ConstPtr Word8

in[]

-> Ptr Word8

out[]

-> CSize

blocks

-> IO CInt 

Decrypt one or more blocks with the cipher

botan_block_cipher_name Source #

Arguments

:: BotanBlockCipher

cipher: the object to read

-> Ptr CChar

name: output buffer

-> Ptr CSize

name_len: on input, the length of buffer, on success the number of bytes written

-> IO CInt 

Get the name of this block cipher

botan_block_cipher_get_keyspec Source #

Arguments

:: BotanBlockCipher

cipher: the object to read

-> Ptr CSize

out_minimum_keylength: if non-NULL, will be set to minimum keylength of cipher

-> Ptr CSize

out_maximum_keylength: if non-NULL, will be set to maximum keylength of cipher

-> Ptr CSize

out_keylength_modulo: if non-NULL will be set to byte multiple of valid keys

-> IO CInt 

Get the key length limits of this block cipher