Copyright | (c) Leo D 2023 |
---|---|
License | BSD-3-Clause |
Maintainer | leo@apotheca.io |
Stability | experimental |
Portability | POSIX |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
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
- data BotanBlockCipherStruct
- newtype BotanBlockCipher = MkBotanBlockCipher {}
- botan_block_cipher_destroy :: FinalizerPtr BotanBlockCipherStruct
- pattern BOTAN_BLOCK_CIPHER_128_AES_128 :: (Eq a, IsString a) => a
- pattern BOTAN_BLOCK_CIPHER_128_AES_192 :: (Eq a, IsString a) => a
- pattern BOTAN_BLOCK_CIPHER_128_AES_256 :: (Eq a, IsString a) => a
- pattern BOTAN_BLOCK_CIPHER_128_ARIA_128 :: (Eq a, IsString a) => a
- pattern BOTAN_BLOCK_CIPHER_128_ARIA_192 :: (Eq a, IsString a) => a
- pattern BOTAN_BLOCK_CIPHER_128_ARIA_256 :: (Eq a, IsString a) => a
- pattern BOTAN_BLOCK_CIPHER_128_CAMELLIA_128 :: (Eq a, IsString a) => a
- pattern BOTAN_BLOCK_CIPHER_128_CAMELLIA_192 :: (Eq a, IsString a) => a
- pattern BOTAN_BLOCK_CIPHER_128_CAMELLIA_256 :: (Eq a, IsString a) => a
- pattern BOTAN_BLOCK_CIPHER_128_NOEKEON :: (Eq a, IsString a) => a
- pattern BOTAN_BLOCK_CIPHER_128_SEED :: (Eq a, IsString a) => a
- pattern BOTAN_BLOCK_CIPHER_128_SM4 :: (Eq a, IsString a) => a
- pattern BOTAN_BLOCK_CIPHER_128_SERPENT :: (Eq a, IsString a) => a
- pattern BOTAN_BLOCK_CIPHER_128_TWOFISH :: (Eq a, IsString a) => a
- pattern BOTAN_BLOCK_CIPHER_BLOWFISH :: (Eq a, IsString a) => a
- pattern BOTAN_BLOCK_CIPHER_CAST_128 :: (Eq a, IsString a) => a
- pattern BOTAN_BLOCK_CIPHER_DES :: (Eq a, IsString a) => a
- pattern BOTAN_BLOCK_CIPHER_TRIPLEDES :: (Eq a, IsString a) => a
- pattern BOTAN_BLOCK_CIPHER_GOST_28147_89 :: (Eq a, IsString a) => a
- pattern BOTAN_BLOCK_CIPHER_IDEA :: (Eq a, IsString a) => a
- pattern BOTAN_BLOCK_CIPHER_SHACAL2 :: (Eq a, IsString a) => a
- pattern BOTAN_BLOCK_CIPHER_THREEFISH_512 :: (Eq a, IsString a) => a
- botan_block_cipher_init :: Ptr BotanBlockCipher -> ConstPtr CChar -> IO CInt
- botan_block_cipher_clear :: BotanBlockCipher -> IO CInt
- botan_block_cipher_set_key :: BotanBlockCipher -> ConstPtr Word8 -> CSize -> IO CInt
- botan_block_cipher_block_size :: BotanBlockCipher -> IO CInt
- botan_block_cipher_encrypt_blocks :: BotanBlockCipher -> ConstPtr Word8 -> Ptr Word8 -> CSize -> IO CInt
- botan_block_cipher_decrypt_blocks :: BotanBlockCipher -> ConstPtr Word8 -> Ptr Word8 -> CSize -> IO CInt
- botan_block_cipher_name :: BotanBlockCipher -> Ptr CChar -> Ptr CSize -> IO CInt
- botan_block_cipher_get_keyspec :: BotanBlockCipher -> Ptr CSize -> Ptr CSize -> Ptr CSize -> IO CInt
Documentation
data BotanBlockCipherStruct Source #
Opaque BlockCipher struct
newtype BotanBlockCipher Source #
Botan BlockCipher object
Instances
botan_block_cipher_destroy :: FinalizerPtr BotanBlockCipherStruct Source #
Destroy a block cipher object
pattern BOTAN_BLOCK_CIPHER_128_AES_128 :: (Eq a, IsString a) => a Source #
pattern BOTAN_BLOCK_CIPHER_128_AES_192 :: (Eq a, IsString a) => a Source #
pattern BOTAN_BLOCK_CIPHER_128_AES_256 :: (Eq a, IsString a) => a Source #
pattern BOTAN_BLOCK_CIPHER_128_ARIA_128 :: (Eq a, IsString a) => a Source #
pattern BOTAN_BLOCK_CIPHER_128_ARIA_192 :: (Eq a, IsString a) => a Source #
pattern BOTAN_BLOCK_CIPHER_128_ARIA_256 :: (Eq a, IsString a) => a Source #
pattern BOTAN_BLOCK_CIPHER_128_CAMELLIA_128 :: (Eq a, IsString a) => a Source #
pattern BOTAN_BLOCK_CIPHER_128_CAMELLIA_192 :: (Eq a, IsString a) => a Source #
pattern BOTAN_BLOCK_CIPHER_128_CAMELLIA_256 :: (Eq a, IsString a) => a Source #
pattern BOTAN_BLOCK_CIPHER_128_NOEKEON :: (Eq a, IsString a) => a Source #
pattern BOTAN_BLOCK_CIPHER_128_SEED :: (Eq a, IsString a) => a Source #
pattern BOTAN_BLOCK_CIPHER_128_SM4 :: (Eq a, IsString a) => a Source #
pattern BOTAN_BLOCK_CIPHER_128_SERPENT :: (Eq a, IsString a) => a Source #
pattern BOTAN_BLOCK_CIPHER_128_TWOFISH :: (Eq a, IsString a) => a Source #
pattern BOTAN_BLOCK_CIPHER_BLOWFISH :: (Eq a, IsString a) => a Source #
pattern BOTAN_BLOCK_CIPHER_CAST_128 :: (Eq a, IsString a) => a Source #
pattern BOTAN_BLOCK_CIPHER_DES :: (Eq a, IsString a) => a Source #
pattern BOTAN_BLOCK_CIPHER_TRIPLEDES :: (Eq a, IsString a) => a Source #
pattern BOTAN_BLOCK_CIPHER_GOST_28147_89 :: (Eq a, IsString a) => a Source #
pattern BOTAN_BLOCK_CIPHER_IDEA :: (Eq a, IsString a) => a Source #
pattern BOTAN_BLOCK_CIPHER_SHACAL2 :: (Eq a, IsString a) => a Source #
pattern BOTAN_BLOCK_CIPHER_THREEFISH_512 :: (Eq a, IsString a) => a Source #
botan_block_cipher_init Source #
Initialize a block cipher object
botan_block_cipher_clear Source #
:: BotanBlockCipher | bc |
-> IO CInt | 0 on success, a negative value on failure |
Reinitializes the block cipher
botan_block_cipher_set_key Source #
Set the key for a block cipher instance
botan_block_cipher_block_size Source #
:: 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 #
Encrypt one or more blocks with the cipher
botan_block_cipher_decrypt_blocks Source #
Decrypt one or more blocks with the cipher
botan_block_cipher_name Source #
:: 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 #
:: 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