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.Cipher

Description

A block cipher by itself, is only able to securely encrypt a single data block. To be able to securely encrypt data of arbitrary length, a mode of operation applies the block cipher’s single block operation repeatedly to encrypt an entire message.

Synopsis

Documentation

data BotanCipherStruct Source #

Opaque Cipher struct

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

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

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

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

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

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

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

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

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

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

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

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

botan_cipher_init Source #

Arguments

:: Ptr BotanCipher

cipher

-> ConstPtr CChar

name

-> Word32

flags

-> IO CInt 

Initialize a cipher object

botan_cipher_name Source #

Arguments

:: BotanCipher

cipher

-> Ptr CChar

name

-> Ptr CSize

name_len

-> IO CInt 

Return the name of the cipher object

botan_cipher_output_length Source #

Arguments

:: BotanCipher

cipher

-> CSize

in_len

-> Ptr CSize

out_len

-> IO CInt 

Return the output length of this cipher, for a particular input length.

botan_cipher_valid_nonce_length Source #

Arguments

:: BotanCipher

cipher

-> CSize

nl

-> IO CInt 

Return if the specified nonce length is valid for this cipher (0 SUCCESS if valid, 1 INVALID_IDENTIFIER if not)

botan_cipher_get_tag_length Source #

Arguments

:: BotanCipher

cipher

-> Ptr CSize

tag_size

-> IO CInt 

Get the tag length of the cipher (0 for non-AEAD modes)

botan_cipher_get_default_nonce_length Source #

Arguments

:: BotanCipher

cipher

-> Ptr CSize

nl

-> IO CInt 

Get the default nonce length of this cipher

botan_cipher_get_update_granularity Source #

Arguments

:: BotanCipher

cipher

-> Ptr CSize

ug

-> IO CInt 

Return the update granularity of the cipher; botan_cipher_update must be called with blocks of this size, except for the final.

botan_cipher_query_keylen Source #

Arguments

:: BotanCipher

cipher

-> Ptr CSize

out_minimum_keylength

-> Ptr CSize

out_maximum_keylength

-> IO CInt 

Get information about the key lengths. Prefer botan_cipher_get_keyspec

botan_cipher_get_keyspec Source #

Arguments

:: BotanCipher

cipher

-> Ptr CSize

min_keylen

-> Ptr CSize

max_keylen

-> Ptr CSize

mod_keylen

-> IO CInt 

Get information about the supported key lengths.

botan_cipher_set_key Source #

Arguments

:: BotanCipher

cipher

-> ConstPtr Word8

key

-> CSize

key_len

-> IO CInt 

Set the key for this cipher object

botan_cipher_set_associated_data Source #

Arguments

:: BotanCipher

cipher

-> ConstPtr Word8

ad

-> CSize

ad_len

-> IO CInt 

Set the associated data. Will fail if cipher is not an AEAD

botan_cipher_start Source #

Arguments

:: BotanCipher

cipher

-> ConstPtr Word8

nonce

-> CSize

nonce_len

-> IO CInt 

Begin processing a new message using the provided nonce

botan_cipher_update Source #

Arguments

:: BotanCipher

cipher

-> Word32

flags

-> Ptr Word8

output[]

-> CSize

output_size

-> Ptr CSize

output_written

-> ConstPtr Word8

input_bytes[]

-> CSize

input_size

-> Ptr CSize

input_consumed

-> IO CInt 

Encrypt some data

botan_cipher_clear Source #

Arguments

:: BotanCipher

hash

-> IO CInt 

Reset the key, nonce, AD and all other state on this cipher object