-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Welcome to botan-bindings
--   
--   Raw bindings to the <a>Botan</a> cryptography library.
--   
--   <pre>
--   Botan's goal is to be the best option for cryptography in C++ by offering the
--   tools necessary to implement a range of practical systems, such as TLS protocol,
--   X.509 certificates, modern AEAD ciphers, PKCS#11 and TPM hardware support,
--   password hashing, and post quantum crypto schemes.
--   </pre>
--   
--   For more information, see the <a>README on Github</a>
@package botan-bindings
@version 0.3.0.0

module Botan.Bindings.ConstPtr
newtype ConstPtr a
ConstPtr :: Ptr a -> ConstPtr a
[unConstPtr] :: ConstPtr a -> Ptr a


-- | 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.
module Botan.Bindings.Cipher

-- | Opaque Cipher struct
data BotanCipherStruct

-- | Botan Cipher object
newtype BotanCipher
MkBotanCipher :: Ptr BotanCipherStruct -> BotanCipher
[ptr] :: BotanCipher -> Ptr BotanCipherStruct

-- | Destroy the cipher object
botan_cipher_destroy :: FinalizerPtr BotanCipherStruct
pattern BOTAN_CIPHER_MODE_CBC :: (Eq a, IsString a) => a
pattern BOTAN_CIPHER_MODE_CFB :: (Eq a, IsString a) => a
pattern BOTAN_CIPHER_MODE_XTS :: (Eq a, IsString a) => a
pattern BOTAN_CBC_PADDING_PKCS7 :: (Eq a, IsString a) => a
pattern BOTAN_CBC_PADDING_ONE_AND_ZEROS :: (Eq a, IsString a) => a
pattern BOTAN_CBC_PADDING_X9_23 :: (Eq a, IsString a) => a
pattern BOTAN_CBC_PADDING_ESP :: (Eq a, IsString a) => a
pattern BOTAN_CBC_PADDING_CTS :: (Eq a, IsString a) => a
pattern BOTAN_CBC_PADDING_NO_PADDING :: (Eq a, IsString a) => a
pattern BOTAN_AEAD_CHACHA20POLY1305 :: (Eq a, IsString a) => a
pattern BOTAN_AEAD_MODE_GCM :: (Eq a, IsString a) => a
pattern BOTAN_AEAD_MODE_OCB :: (Eq a, IsString a) => a
pattern BOTAN_AEAD_MODE_EAX :: (Eq a, IsString a) => a
pattern BOTAN_AEAD_MODE_SIV :: (Eq a, IsString a) => a
pattern BOTAN_AEAD_MODE_CCM :: (Eq a, IsString a) => a
pattern BOTAN_CIPHER_INIT_FLAG_MASK_DIRECTION :: (Eq a, Num a) => a
pattern BOTAN_CIPHER_INIT_FLAG_ENCRYPT :: (Eq a, Num a) => a
pattern BOTAN_CIPHER_INIT_FLAG_DECRYPT :: (Eq a, Num a) => a

-- | Initialize a cipher object
botan_cipher_init :: Ptr BotanCipher -> ConstPtr CChar -> Word32 -> IO CInt

-- | Return the name of the cipher object
botan_cipher_name :: BotanCipher -> Ptr CChar -> Ptr CSize -> IO CInt

-- | Return the output length of this cipher, for a particular input
--   length.
botan_cipher_output_length :: BotanCipher -> CSize -> Ptr CSize -> IO CInt

-- | Return if the specified nonce length is valid for this cipher (0 <i>
--   SUCCESS if valid, 1 </i> INVALID_IDENTIFIER if not)
botan_cipher_valid_nonce_length :: BotanCipher -> CSize -> IO CInt

-- | Get the tag length of the cipher (0 for non-AEAD modes)
botan_cipher_get_tag_length :: BotanCipher -> Ptr CSize -> IO CInt

-- | Get the default nonce length of this cipher
botan_cipher_get_default_nonce_length :: BotanCipher -> Ptr CSize -> 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_get_update_granularity :: BotanCipher -> Ptr CSize -> IO CInt
botan_cipher_get_ideal_update_granularity :: BotanCipher -> Ptr CSize -> IO CInt

-- | Get information about the key lengths. Prefer botan_cipher_get_keyspec
botan_cipher_query_keylen :: BotanCipher -> Ptr CSize -> Ptr CSize -> IO CInt

-- | Get information about the supported key lengths.
botan_cipher_get_keyspec :: BotanCipher -> Ptr CSize -> Ptr CSize -> Ptr CSize -> IO CInt

-- | Set the key for this cipher object
botan_cipher_set_key :: BotanCipher -> ConstPtr Word8 -> CSize -> IO CInt
botan_cipher_reset :: BotanCipher -> IO CInt

-- | Set the associated data. Will fail if cipher is not an AEAD
botan_cipher_set_associated_data :: BotanCipher -> ConstPtr Word8 -> CSize -> IO CInt

-- | Begin processing a new message using the provided nonce
botan_cipher_start :: BotanCipher -> ConstPtr Word8 -> CSize -> IO CInt
pattern BOTAN_CIPHER_UPDATE_FLAG_NONE :: (Eq a, Num a) => a
pattern BOTAN_CIPHER_UPDATE_FLAG_FINAL :: (Eq a, Num a) => a

-- | Encrypt some data
botan_cipher_update :: BotanCipher -> Word32 -> Ptr Word8 -> CSize -> Ptr CSize -> ConstPtr Word8 -> CSize -> Ptr CSize -> IO CInt

-- | Reset the key, nonce, AD and all other state on this cipher object
botan_cipher_clear :: BotanCipher -> IO CInt
instance GHC.Classes.Eq Botan.Bindings.Cipher.BotanCipher
instance GHC.Classes.Ord Botan.Bindings.Cipher.BotanCipher
instance GHC.Internal.Foreign.Storable.Storable Botan.Bindings.Cipher.BotanCipher


-- | This module is based on the <a>Block Ciphers</a> section of the C
--   Botan FFI documentation, and on the <a>Block Ciphers</a> section of
--   the C++ API reference.
module Botan.Bindings.BlockCipher

-- | Opaque BlockCipher struct
data BotanBlockCipherStruct

-- | Botan BlockCipher object
newtype BotanBlockCipher
MkBotanBlockCipher :: Ptr BotanBlockCipherStruct -> BotanBlockCipher
[ptr] :: BotanBlockCipher -> Ptr BotanBlockCipherStruct

-- | Destroy a block cipher object
--   
--   NOTE: this a binding to the <i>address</i> of the
--   <tt>botan_block_cipher_destroy</tt> C function.
botan_block_cipher_destroy :: FinalizerPtr BotanBlockCipherStruct

-- | Initialize a block cipher object
botan_block_cipher_init :: Ptr BotanBlockCipher -> ConstPtr CChar -> IO CInt

-- | Reinitializes the block cipher
botan_block_cipher_clear :: BotanBlockCipher -> IO CInt

-- | Set the key for a block cipher instance
botan_block_cipher_set_key :: BotanBlockCipher -> ConstPtr Word8 -> CSize -> IO CInt

-- | Return the positive block size of this block cipher, or negative to
--   indicate an error
botan_block_cipher_block_size :: BotanBlockCipher -> IO CInt

-- | Encrypt one or more blocks with the cipher
botan_block_cipher_encrypt_blocks :: BotanBlockCipher -> ConstPtr Word8 -> Ptr Word8 -> CSize -> IO CInt

-- | Decrypt one or more blocks with the cipher
botan_block_cipher_decrypt_blocks :: BotanBlockCipher -> ConstPtr Word8 -> Ptr Word8 -> CSize -> IO CInt

-- | Get the name of this block cipher
botan_block_cipher_name :: BotanBlockCipher -> Ptr CChar -> Ptr CSize -> IO CInt

-- | Get the key length limits of this block cipher
botan_block_cipher_get_keyspec :: BotanBlockCipher -> Ptr CSize -> Ptr CSize -> Ptr CSize -> IO CInt

-- | <pre>
--   &gt;&gt;&gt; BOTAN_BLOCK_CIPHER_AES_128 @String
--   "AES-128"
--   </pre>
pattern BOTAN_BLOCK_CIPHER_AES_128 :: (Eq a, IsString a) => a

-- | <pre>
--   &gt;&gt;&gt; BOTAN_BLOCK_CIPHER_AES_192 @String
--   "AES-192"
--   </pre>
pattern BOTAN_BLOCK_CIPHER_AES_192 :: (Eq a, IsString a) => a

-- | <pre>
--   &gt;&gt;&gt; BOTAN_BLOCK_CIPHER_AES_256 @String
--   "AES-256"
--   </pre>
pattern BOTAN_BLOCK_CIPHER_AES_256 :: (Eq a, IsString a) => a

-- | <pre>
--   &gt;&gt;&gt; BOTAN_BLOCK_CIPHER_ARIA_128 @String
--   "ARIA-128"
--   </pre>
pattern BOTAN_BLOCK_CIPHER_ARIA_128 :: (Eq a, IsString a) => a

-- | <pre>
--   &gt;&gt;&gt; BOTAN_BLOCK_CIPHER_ARIA_192 @String
--   "ARIA-192"
--   </pre>
pattern BOTAN_BLOCK_CIPHER_ARIA_192 :: (Eq a, IsString a) => a

-- | <pre>
--   &gt;&gt;&gt; BOTAN_BLOCK_CIPHER_ARIA_256 @String
--   "ARIA-256"
--   </pre>
pattern BOTAN_BLOCK_CIPHER_ARIA_256 :: (Eq a, IsString a) => a

-- | <pre>
--   &gt;&gt;&gt; BOTAN_BLOCK_CIPHER_BLOWFISH @String
--   "Blowfish"
--   </pre>
pattern BOTAN_BLOCK_CIPHER_BLOWFISH :: (Eq a, IsString a) => a

-- | <pre>
--   &gt;&gt;&gt; BOTAN_BLOCK_CIPHER_CAMELLIA_128 @String
--   "Camellia-128"
--   </pre>
pattern BOTAN_BLOCK_CIPHER_CAMELLIA_128 :: (Eq a, IsString a) => a

-- | <pre>
--   &gt;&gt;&gt; BOTAN_BLOCK_CIPHER_CAMELLIA_192 @String
--   "Camellia-192"
--   </pre>
pattern BOTAN_BLOCK_CIPHER_CAMELLIA_192 :: (Eq a, IsString a) => a

-- | <pre>
--   &gt;&gt;&gt; BOTAN_BLOCK_CIPHER_CAMELLIA_256 @String
--   "Camellia-256"
--   </pre>
pattern BOTAN_BLOCK_CIPHER_CAMELLIA_256 :: (Eq a, IsString a) => a

-- | <pre>
--   &gt;&gt;&gt; BOTAN_BLOCK_CIPHER_CASCADE @String
--   "Cascade"
--   </pre>
pattern BOTAN_BLOCK_CIPHER_CASCADE :: (Eq a, IsString a) => a

-- | <pre>
--   &gt;&gt;&gt; BOTAN_BLOCK_CIPHER_CAST_128 @String
--   "CAST-128"
--   </pre>
pattern BOTAN_BLOCK_CIPHER_CAST_128 :: (Eq a, IsString a) => a

-- | <pre>
--   &gt;&gt;&gt; BOTAN_BLOCK_CIPHER_DES @String
--   "DES"
--   </pre>
pattern BOTAN_BLOCK_CIPHER_DES :: (Eq a, IsString a) => a

-- | <pre>
--   &gt;&gt;&gt; BOTAN_BLOCK_CIPHER_TRIPLEDES @String
--   "TripleDES"
--   </pre>
pattern BOTAN_BLOCK_CIPHER_TRIPLEDES :: (Eq a, IsString a) => a

-- | <pre>
--   &gt;&gt;&gt; BOTAN_BLOCK_CIPHER_GOST_28147_89 @String
--   "GOST-28147-89"
--   </pre>
pattern BOTAN_BLOCK_CIPHER_GOST_28147_89 :: (Eq a, IsString a) => a

-- | <pre>
--   &gt;&gt;&gt; BOTAN_BLOCK_CIPHER_IDEA @String
--   "IDEA"
--   </pre>
pattern BOTAN_BLOCK_CIPHER_IDEA :: (Eq a, IsString a) => a

-- | <pre>
--   &gt;&gt;&gt; BOTAN_BLOCK_CIPHER_LION @String
--   "Lion"
--   </pre>
pattern BOTAN_BLOCK_CIPHER_LION :: (Eq a, IsString a) => a

-- | <pre>
--   &gt;&gt;&gt; BOTAN_BLOCK_CIPHER_NOEKEON @String
--   "Noekeon"
--   </pre>
pattern BOTAN_BLOCK_CIPHER_NOEKEON :: (Eq a, IsString a) => a

-- | <pre>
--   &gt;&gt;&gt; BOTAN_BLOCK_CIPHER_SEED @String
--   "SEED"
--   </pre>
pattern BOTAN_BLOCK_CIPHER_SEED :: (Eq a, IsString a) => a

-- | <pre>
--   &gt;&gt;&gt; BOTAN_BLOCK_CIPHER_SERPENT @String
--   "Serpent"
--   </pre>
pattern BOTAN_BLOCK_CIPHER_SERPENT :: (Eq a, IsString a) => a

-- | <pre>
--   &gt;&gt;&gt; BOTAN_BLOCK_CIPHER_SHACAL2 @String
--   "SHACAL2"
--   </pre>
pattern BOTAN_BLOCK_CIPHER_SHACAL2 :: (Eq a, IsString a) => a

-- | <pre>
--   &gt;&gt;&gt; BOTAN_BLOCK_CIPHER_SM4 @String
--   "SM4"
--   </pre>
pattern BOTAN_BLOCK_CIPHER_SM4 :: (Eq a, IsString a) => a

-- | <pre>
--   &gt;&gt;&gt; BOTAN_BLOCK_CIPHER_THREEFISH_512 @String
--   "Threefish-512"
--   </pre>
pattern BOTAN_BLOCK_CIPHER_THREEFISH_512 :: (Eq a, IsString a) => a

-- | <pre>
--   &gt;&gt;&gt; BOTAN_BLOCK_CIPHER_TWOFISH @String
--   "Twofish"
--   </pre>
pattern BOTAN_BLOCK_CIPHER_TWOFISH :: (Eq a, IsString a) => a
instance GHC.Classes.Eq Botan.Bindings.BlockCipher.BotanBlockCipher
instance GHC.Classes.Ord Botan.Bindings.BlockCipher.BotanBlockCipher
instance GHC.Internal.Foreign.Storable.Storable Botan.Bindings.BlockCipher.BotanBlockCipher


-- | This module is based on the <a>Return codes</a> section of the C Botan
--   FFI documentation.
--   
--   Error values below -10000 are reserved for the application (these can
--   be returned from view functions).
module Botan.Bindings.Error

-- | Generally returned to indicate success
pattern BOTAN_FFI_SUCCESS :: (Eq a, Num a) => a

-- | NOTE: this value is positive, but still represents an error condition.
--   In indicates that the function completed successfully, but the value
--   provided was not correct. For example botan_bcrypt_is_valid returns
--   this value if the password did not match the hash.
pattern BOTAN_FFI_INVALID_VERIFIER :: (Eq a, Num a) => a

-- | The input was invalid. (Currently this error return is not used.)
pattern BOTAN_FFI_ERROR_INVALID_INPUT :: (Eq a, Num a) => a

-- | While decrypting in an AEAD mode, the tag failed to verify.
pattern BOTAN_FFI_ERROR_BAD_MAC :: (Eq a, Num a) => a

-- | Functions which write a variable amount of space return this if the
--   indicated buffer length was insufficient to write the data. In that
--   case, the output length parameter is set to the size that is required.
pattern BOTAN_FFI_ERROR_INSUFFICIENT_BUFFER_SPACE :: (Eq a, Num a) => a

-- | A string view function which attempts to convert a string to a
--   specified charset, and fails, can use this function to indicate the
--   error.
pattern BOTAN_FFI_ERROR_STRING_CONVERSION_ERROR :: (Eq a, Num a) => a

-- | An exception was thrown while processing this request, but no further
--   details are available.
pattern BOTAN_FFI_ERROR_EXCEPTION_THROWN :: (Eq a, Num a) => a

-- | Memory allocation failed
pattern BOTAN_FFI_ERROR_OUT_OF_MEMORY :: (Eq a, Num a) => a

-- | A system call failed
pattern BOTAN_FFI_ERROR_SYSTEM_ERROR :: (Eq a, Num a) => a

-- | An internal bug was encountered (please open a ticket on github)
pattern BOTAN_FFI_ERROR_INTERNAL_ERROR :: (Eq a, Num a) => a

-- | A value provided in a flag variable was unknown.
pattern BOTAN_FFI_ERROR_BAD_FLAG :: (Eq a, Num a) => a

-- | A null pointer was provided as an argument where that is not allowed.
pattern BOTAN_FFI_ERROR_NULL_POINTER :: (Eq a, Num a) => a

-- | An argument did not match the function.
pattern BOTAN_FFI_ERROR_BAD_PARAMETER :: (Eq a, Num a) => a

-- | An object that requires a key normally must be keyed before use (eg
--   before encrypting or MACing data). If this is not done, the operation
--   will fail and return this error code.
pattern BOTAN_FFI_ERROR_KEY_NOT_SET :: (Eq a, Num a) => a

-- | An invalid key length was provided with a call to foo_set_key.
pattern BOTAN_FFI_ERROR_INVALID_KEY_LENGTH :: (Eq a, Num a) => a

-- | An operation was invoked that makes sense for the object, but it is in
--   the wrong state to perform it.
pattern BOTAN_FFI_ERROR_INVALID_OBJECT_STATE :: (Eq a, Num a) => a

-- | This is returned if the functionality is not available for some
--   reason. For example if you call botan_hash_init with a named hash
--   function which is not enabled, this error is returned.
pattern BOTAN_FFI_ERROR_NOT_IMPLEMENTED :: (Eq a, Num a) => a

-- | This is used if an object provided did not match the function. For
--   example calling botan_hash_destroy on a botan_rng_t object will cause
--   this error.
pattern BOTAN_FFI_ERROR_INVALID_OBJECT :: (Eq a, Num a) => a

-- | Note: this code is undocumented in <tt>botan/ffi.h</tt>.
pattern BOTAN_FFI_ERROR_TLS_ERROR :: (Eq a, Num a) => a

-- | Note: this code is undocumented in <tt>botan/ffi.h</tt>.
pattern BOTAN_FFI_ERROR_HTTP_ERROR :: (Eq a, Num a) => a

-- | Note: this code is undocumented in <tt>botan/ffi.h</tt>.
pattern BOTAN_FFI_ERROR_ROUGHTIME_ERROR :: (Eq a, Num a) => a

-- | Something bad happened, but we are not sure why or how.
pattern BOTAN_FFI_ERROR_UNKNOWN_ERROR :: (Eq a, Num a) => a
botan_error_description :: CInt -> IO (ConstPtr CChar)
botan_error_last_exception_message :: IO (ConstPtr CChar)


-- | One time password schemes are a user authentication method that relies
--   on a fixed secret key which is used to derive a sequence of short
--   passwords, each of which is accepted only once. Commonly this is used
--   to implement two-factor authentication (2FA), where the user
--   authenticates using both a conventional password (or a public key
--   signature) and an OTP generated by a small device such as a mobile
--   phone.
--   
--   Botan implements the HOTP and TOTP schemes from RFC 4226 and 6238.
--   
--   Since the range of possible OTPs is quite small, applications must
--   rate limit OTP authentication attempts to some small number per
--   second. Otherwise an attacker could quickly try all 1000000 6-digit
--   OTPs in a brief amount of time.
--   
--   HOTP generates OTPs that are a short numeric sequence, between 6 and 8
--   digits (most applications use 6 digits), created using the HMAC of a
--   64-bit counter value. If the counter ever repeats the OTP will also
--   repeat, thus both parties must assure the counter only increments and
--   is never repeated or decremented. Thus both client and server must
--   keep track of the next counter expected.
--   
--   Anyone with access to the client-specific secret key can authenticate
--   as that client, so it should be treated with the same security
--   consideration as would be given to any other symmetric key or
--   plaintext password.
module Botan.Bindings.HOTP

-- | Opaque HOTP struct
data BotanHOTPStruct

-- | Botan HOTP object
newtype BotanHOTP
MkBotanHOTP :: Ptr BotanHOTPStruct -> BotanHOTP
[ptr] :: BotanHOTP -> Ptr BotanHOTPStruct

-- | Destroy a HOTP instance
botan_hotp_destroy :: FinalizerPtr BotanHOTPStruct

-- | Initialize a HOTP instance
botan_hotp_init :: Ptr BotanHOTP -> ConstPtr Word8 -> CSize -> ConstPtr CChar -> CSize -> IO CInt

-- | Generate a HOTP code for the provided counter
botan_hotp_generate :: BotanHOTP -> Ptr Word32 -> Word64 -> IO CInt

-- | Verify a HOTP code
botan_hotp_check :: BotanHOTP -> Ptr Word64 -> Word32 -> Word64 -> CSize -> IO CInt
instance GHC.Classes.Eq Botan.Bindings.HOTP.BotanHOTP
instance GHC.Classes.Ord Botan.Bindings.HOTP.BotanHOTP
instance GHC.Internal.Foreign.Storable.Storable Botan.Bindings.HOTP.BotanHOTP


-- | Hash functions are one-way functions, which map data of arbitrary size
--   to a fixed output length. Most of the hash functions in Botan are
--   designed to be cryptographically secure, which means that it is
--   computationally infeasible to create a collision (finding two inputs
--   with the same hash) or preimages (given a hash output, generating an
--   arbitrary input with the same hash). But note that not all such hash
--   functions meet their goals, in particular MD4 and MD5 are trivially
--   broken. However they are still included due to their wide adoption in
--   various protocols.
--   
--   Using a hash function is typically split into three stages:
--   initialization, update, and finalization (often referred to as a IUF
--   interface). The initialization stage is implicit: after creating a
--   hash function object, it is ready to process data. Then update is
--   called one or more times. Calling update several times is equivalent
--   to calling it once with all of the arguments concatenated. After
--   completing a hash computation (eg using hashFinal), the internal state
--   is reset to begin hashing a new message.
module Botan.Bindings.Hash

-- | Opaque Hash struct
data BotanHashStruct

-- | Botan Hash object
newtype BotanHash
MkBotanHash :: Ptr BotanHashStruct -> BotanHash
[ptr] :: BotanHash -> Ptr BotanHashStruct

-- | Frees all resources of the hash object
botan_hash_destroy :: FinalizerPtr BotanHashStruct
pattern BOTAN_HASH_BLAKE2B :: (Eq a, IsString a) => a
pattern BOTAN_HASH_KECCAK_1600 :: (Eq a, IsString a) => a
pattern BOTAN_HASH_GOST_34_11 :: (Eq a, IsString a) => a
pattern BOTAN_HASH_MD4 :: (Eq a, IsString a) => a
pattern BOTAN_HASH_MD5 :: (Eq a, IsString a) => a
pattern BOTAN_HASH_RIPEMD_160 :: (Eq a, IsString a) => a
pattern BOTAN_HASH_SHA1 :: (Eq a, IsString a) => a
pattern BOTAN_HASH_SHA_224 :: (Eq a, IsString a) => a
pattern BOTAN_HASH_SHA_256 :: (Eq a, IsString a) => a
pattern BOTAN_HASH_SHA_384 :: (Eq a, IsString a) => a
pattern BOTAN_HASH_SHA_512 :: (Eq a, IsString a) => a
pattern BOTAN_HASH_SHA_512_256 :: (Eq a, IsString a) => a
pattern BOTAN_HASH_SHA_3 :: (Eq a, IsString a) => a
pattern BOTAN_HASH_SHAKE_128 :: (Eq a, IsString a) => a
pattern BOTAN_HASH_SHAKE_256 :: (Eq a, IsString a) => a
pattern BOTAN_HASH_SM3 :: (Eq a, IsString a) => a
pattern BOTAN_HASH_SKEIN_512 :: (Eq a, IsString a) => a
pattern BOTAN_HASH_STREEBOG_256 :: (Eq a, IsString a) => a
pattern BOTAN_HASH_STREEBOG_512 :: (Eq a, IsString a) => a
pattern BOTAN_HASH_WHIRLPOOL :: (Eq a, IsString a) => a
pattern BOTAN_HASH_STRAT_PARALLEL :: (Eq a, IsString a) => a
pattern BOTAN_HASH_STRAT_COMB4P :: (Eq a, IsString a) => a
pattern BOTAN_CHECKSUM_ADLER32 :: (Eq a, IsString a) => a
pattern BOTAN_CHECKSUM_CRC24 :: (Eq a, IsString a) => a
pattern BOTAN_CHECKSUM_CRC32 :: (Eq a, IsString a) => a

-- | Initialize a hash function object
botan_hash_init :: Ptr BotanHash -> ConstPtr CChar -> Word32 -> IO CInt

-- | Get the name of this hash function
botan_hash_name :: BotanHash -> Ptr CChar -> Ptr CSize -> IO CInt

-- | Copy the state of a hash function object
botan_hash_copy_state :: Ptr BotanHash -> BotanHash -> IO CInt

-- | Writes the output length of the hash function to *output_length
botan_hash_output_length :: BotanHash -> Ptr CSize -> IO CInt

-- | Writes the block size of the hash function to *block_size
botan_hash_block_size :: BotanHash -> Ptr CSize -> IO CInt

-- | Send more input to the hash function
botan_hash_update :: BotanHash -> ConstPtr Word8 -> CSize -> IO CInt

-- | Finalizes the hash computation and writes the output to
--   out[0:botan_hash_output_length()] then reinitializes for computing
--   another digest as if botan_hash_clear had been called.
botan_hash_final :: BotanHash -> Ptr Word8 -> IO CInt

-- | Reinitializes the state of the hash computation. A hash can be
--   computed (with update/final) immediately.
botan_hash_clear :: BotanHash -> IO CInt
botan_pkcs_hash_id :: ConstPtr CChar -> Ptr Word8 -> Ptr CSize -> IO CInt
instance GHC.Classes.Eq Botan.Bindings.Hash.BotanHash
instance GHC.Classes.Ord Botan.Bindings.Hash.BotanHash
instance GHC.Internal.Foreign.Storable.Storable Botan.Bindings.Hash.BotanHash


-- | Key derivation functions are used to turn some amount of shared secret
--   material into uniform random keys suitable for use with symmetric
--   algorithms. An example of an input which is useful for a KDF is a
--   shared secret created using Diffie-Hellman key agreement.
--   
--   Typically a KDF is also used with a salt and a label. The salt should
--   be some random information which is available to all of the parties
--   that would need to use the KDF; this could be performed by setting the
--   salt to some kind of session identifier, or by having one of the
--   parties generate a random salt and including it in a message.
--   
--   The label is used to bind the KDF output to some specific context. For
--   instance if you were using the KDF to derive a specific key referred
--   to as the “message key” in the protocol description, you might use a
--   label of “FooProtocol v2 MessageKey”. This labeling ensures that if
--   you accidentally use the same input key and salt in some other
--   context, you still use different keys in the two contexts.
module Botan.Bindings.KDF
pattern BOTAN_KDF_HKDF :: (Eq a, IsString a) => a
pattern BOTAN_KDF_HKDF_EXTRACT :: (Eq a, IsString a) => a
pattern BOTAN_KDF_HKDF_EXPAND :: (Eq a, IsString a) => a
pattern BOTAN_KDF_KDF2 :: (Eq a, IsString a) => a
pattern BOTAN_KDF_KDF1_18033 :: (Eq a, IsString a) => a
pattern BOTAN_KDF_KDF1 :: (Eq a, IsString a) => a
pattern BOTAN_KDF_TLS_12_PRF :: (Eq a, IsString a) => a
pattern BOTAN_KDF_X9_42_PRF :: (Eq a, IsString a) => a
pattern BOTAN_KDF_SP800_108_COUNTER :: (Eq a, IsString a) => a
pattern BOTAN_KDF_SP800_108_FEEDBACK :: (Eq a, IsString a) => a
pattern BOTAN_KDF_SP800_108_PIPELINE :: (Eq a, IsString a) => a
pattern BOTAN_KDF_SP800_56A :: (Eq a, IsString a) => a
pattern BOTAN_KDF_SP800_56C :: (Eq a, IsString a) => a

-- | Derive a key
botan_kdf :: ConstPtr CChar -> Ptr Word8 -> CSize -> ConstPtr Word8 -> CSize -> ConstPtr Word8 -> CSize -> ConstPtr Word8 -> CSize -> IO CInt


-- | NIST specifies two mechanisms for wrapping (encrypting) symmetric keys
--   using another key. The first (and older, more widely supported) method
--   requires the input be a multiple of 8 bytes long. The other allows any
--   length input, though only up to 2**32 bytes.
--   
--   These algorithms are described in NIST SP 800-38F, and RFCs 3394 and
--   5649.
--   
--   These functions take an arbitrary 128-bit block cipher. NIST only
--   allows these functions with AES, but any 128-bit cipher will do and
--   some other implementations (such as in OpenSSL) do also allow other
--   ciphers.
--   
--   Use AES for best interop.
module Botan.Bindings.KeyWrap
botan_nist_kw_enc :: ConstPtr CChar -> CInt -> ConstPtr Word8 -> CSize -> ConstPtr Word8 -> CSize -> Ptr Word8 -> Ptr CSize -> IO CInt
botan_nist_kw_dec :: ConstPtr CChar -> CInt -> ConstPtr Word8 -> CSize -> ConstPtr Word8 -> CSize -> Ptr Word8 -> Ptr CSize -> IO CInt


-- | A Message Authentication Code algorithm computes a tag over a message
--   utilizing a shared secret key. Thus a valid tag confirms the
--   authenticity and integrity of the message. Only entities in possession
--   of the shared secret key are able to verify the tag.
--   
--   Note
--   
--   When combining a MAC with unauthenticated encryption mode, prefer to
--   first encrypt the message and then MAC the ciphertext. The alternative
--   is to MAC the plaintext, which depending on exact usage can suffer
--   serious security issues. For a detailed discussion of this issue see
--   the paper “The Order of Encryption and Authentication for Protecting
--   Communications” by Hugo Krawczyk
--   
--   The Botan MAC computation is split into five stages.
--   
--   <ul>
--   <li>Instantiate the MAC algorithm.</li>
--   <li>Set the secret key.</li>
--   <li>Process IV.</li>
--   <li>Process data.</li>
--   <li>Finalize the MAC computation.</li>
--   </ul>
module Botan.Bindings.MAC

-- | Opaque MAC struct
data BotanMACStruct

-- | Botan MAC object
newtype BotanMAC
MkBotanMAC :: Ptr BotanMACStruct -> BotanMAC
[ptr] :: BotanMAC -> Ptr BotanMACStruct

-- | Frees all resources of the MAC object
botan_mac_destroy :: FinalizerPtr BotanMACStruct
pattern BOTAN_MAC_CMAC :: (Eq a, IsString a) => a
pattern BOTAN_MAC_GMAC :: (Eq a, IsString a) => a
pattern BOTAN_MAC_HMAC :: (Eq a, IsString a) => a
pattern BOTAN_MAC_Poly1305 :: (Eq a, IsString a) => a
pattern BOTAN_MAC_SipHash :: (Eq a, IsString a) => a
pattern BOTAN_MAC_X9_19_MAC :: (Eq a, IsString a) => a

-- | Initialize a message authentication code object
botan_mac_init :: Ptr BotanMAC -> ConstPtr CChar -> Word32 -> IO CInt

-- | Writes the output length of the message authentication code to
--   *output_length
botan_mac_output_length :: BotanMAC -> Ptr CSize -> IO CInt

-- | Sets the key on the MAC
botan_mac_set_key :: BotanMAC -> ConstPtr Word8 -> CSize -> IO CInt

-- | Sets the nonce on the MAC
botan_mac_set_nonce :: BotanMAC -> ConstPtr Word8 -> CSize -> IO CInt

-- | Send more input to the message authentication code
botan_mac_update :: BotanMAC -> ConstPtr Word8 -> CSize -> IO CInt

-- | Finalizes the MAC computation and writes the output to
--   out[0:botan_mac_output_length()] then reinitializes for computing
--   another MAC as if botan_mac_clear had been called.
botan_mac_final :: BotanMAC -> Ptr Word8 -> IO CInt

-- | Reinitializes the state of the MAC computation. A MAC can be computed
--   (with update/final) immediately.
botan_mac_clear :: BotanMAC -> IO CInt

-- | Get the name of this MAC
botan_mac_name :: BotanMAC -> Ptr CChar -> Ptr CSize -> IO CInt

-- | Get the key length limits of this auth code
botan_mac_get_keyspec :: BotanMAC -> Ptr CSize -> Ptr CSize -> Ptr CSize -> IO CInt
instance GHC.Classes.Eq Botan.Bindings.MAC.BotanMAC
instance GHC.Classes.Ord Botan.Bindings.MAC.BotanMAC
instance GHC.Internal.Foreign.Storable.Storable Botan.Bindings.MAC.BotanMAC


-- | This module is based on the <a>Password Based Key Deriviation</a>
--   section of the C++ API reference.
module Botan.Bindings.PwdHash

-- | Derive a cryptographic key from a passphrase using algorithm-specific
--   parameters
--   
--   NOTE: the interpretation of parameters <tt>param1</tt>,
--   <tt>param2</tt>, and <tt>param3</tt> are different depending on the
--   PBKDF algorithm that is picked. See the documentation of the
--   <a><tt>from_params</tt></a> C++ function for more information about
--   the meaning of the parameters.
botan_pwdhash :: ConstPtr CChar -> CSize -> CSize -> CSize -> Ptr Word8 -> CSize -> ConstPtr CChar -> CSize -> ConstPtr Word8 -> CSize -> IO CInt

-- | Derive a cryptographic key from a passphrase using algorithm-specific
--   parameters that are tuned automatically for a desired running time of
--   the algorithm.
--   
--   NOTE: for the <tt>Argon2</tt> and <tt>Scrypt</tt> PBKDF algorithms,
--   <a>botan_pwdhash_timed</a> returns parameters in a different order
--   than the order in which they should be passed to <a>botan_pwdhash</a>.
--   This is a known issue with the Botan C++ library. See
--   <a>https://github.com/randombit/botan/issues/2144</a> for more
--   information.
--   
--   <a>botan_pwdhash_timed</a> always returns parameters in this order:
--   
--   <pre>
--   (iterations, parallelism, memoryParam)
--   </pre>
--   
--   <a>botan_pwdhash</a> shoulds be given parameters in this order for the
--   <tt>Argon2</tt> and <tt>Scrypt</tt> algorithms:
--   
--   <pre>
--   param1 = memoryParam
--   param2 = iterations
--   param3 = parallelism
--   </pre>
botan_pwdhash_timed :: ConstPtr CChar -> Word32 -> Ptr CSize -> Ptr CSize -> Ptr CSize -> Ptr Word8 -> CSize -> ConstPtr CChar -> CSize -> ConstPtr Word8 -> CSize -> IO CInt

-- | <pre>
--   &gt;&gt;&gt; BOTAN_PBKDF_PBKDF2 @String
--   "PBKDF2"
--   </pre>
pattern BOTAN_PBKDF_PBKDF2 :: (Eq a, IsString a) => a

-- | <pre>
--   &gt;&gt;&gt; BOTAN_PBKDF_SCRYPT @String
--   "Scrypt"
--   </pre>
pattern BOTAN_PBKDF_SCRYPT :: (Eq a, IsString a) => a

-- | <pre>
--   &gt;&gt;&gt; BOTAN_PBKDF_ARGON2D @String
--   "Argon2d"
--   </pre>
pattern BOTAN_PBKDF_ARGON2D :: (Eq a, IsString a) => a

-- | <pre>
--   &gt;&gt;&gt; BOTAN_PBKDF_ARGON2I @String
--   "Argon2i"
--   </pre>
pattern BOTAN_PBKDF_ARGON2I :: (Eq a, IsString a) => a

-- | <pre>
--   &gt;&gt;&gt; BOTAN_PBKDF_ARGON2ID @String
--   "Argon2id"
--   </pre>
pattern BOTAN_PBKDF_ARGON2ID :: (Eq a, IsString a) => a

-- | <pre>
--   &gt;&gt;&gt; BOTAN_PBKDF_BCRYPT_PBKDF @String
--   "Bcrypt-PBKDF"
--   </pre>
pattern BOTAN_PBKDF_BCRYPT_PBKDF :: (Eq a, IsString a) => a

-- | <pre>
--   &gt;&gt;&gt; BOTAN_PBKDF_OPENPGP_S2K @String
--   "OpenPGP-S2K"
--   </pre>
pattern BOTAN_PBKDF_OPENPGP_S2K :: (Eq a, IsString a) => a


module Botan.Bindings.RNG

-- | Opaque RNG struct
data BotanRNGStruct

-- | Botan RNG object
newtype BotanRNG
MkBotanRNG :: Ptr BotanRNGStruct -> BotanRNG
[ptr] :: BotanRNG -> Ptr BotanRNGStruct

-- | Frees all resources of the random number generator object
botan_rng_destroy :: FinalizerPtr BotanRNGStruct
pattern BOTAN_RNG_TYPE_SYSTEM :: (Eq a, IsString a) => a
pattern BOTAN_RNG_TYPE_USER :: (Eq a, IsString a) => a
pattern BOTAN_RNG_TYPE_USER_THREADSAFE :: (Eq a, IsString a) => a
pattern BOTAN_RNG_TYPE_RDRAND :: (Eq a, IsString a) => a

-- | Initialize a random number generator object
--   
--   rng_type has the possible values:
--   
--   <ul>
--   <li>"system": system RNG</li>
--   <li>"user": userspace RNG</li>
--   <li>"user-threadsafe": userspace RNG, with internal locking</li>
--   <li>"rdrand": directly read RDRAND</li>
--   </ul>
--   
--   Set rng_type to null to let the library choose some default.
botan_rng_init :: Ptr BotanRNG -> ConstPtr CChar -> IO CInt

-- | Callback for getting random bytes from the rng, return 0 for success
type BotanRNGGetCallback ctx = Ptr ctx -> Ptr Word8 -> CSize -> IO CInt
mallocBotanRNGGetCallbackFunPtr :: BotanRNGGetCallback ctx -> IO (FunPtr (BotanRNGGetCallback ctx))

-- | Callback for adding entropy to the rng, return 0 for success
type BotanRNGAddEntropyCallback ctx = Ptr ctx -> ConstPtr Word8 -> CSize -> IO CInt
mallocBotanRNGAddEntropyCallbackFunPtr :: BotanRNGAddEntropyCallback ctx -> IO (FunPtr (BotanRNGAddEntropyCallback ctx))

-- | Callback called when rng is destroyed
type BotanRNGDestroyCallback ctx = Ptr ctx -> IO ()
mallocBotanRNGDestroyCallbackFunPtr :: BotanRNGDestroyCallback ctx -> IO (FunPtr (BotanRNGDestroyCallback ctx))

-- | Initialize a custom random number generator from a set of callback
--   functions
botan_rng_init_custom :: Ptr BotanRNG -> ConstPtr CChar -> Ptr ctx -> FunPtr (BotanRNGGetCallback ctx) -> FunPtr (BotanRNGAddEntropyCallback ctx) -> FunPtr (BotanRNGDestroyCallback ctx) -> IO CInt

-- | Get random bytes from a random number generators
botan_rng_get :: BotanRNG -> Ptr Word8 -> CSize -> IO CInt

-- | Get random bytes from system random number generator
botan_system_rng_get :: Ptr Word8 -> CSize -> IO CInt

-- | Reseed a random number generator
--   
--   Uses the System_RNG as a seed generator.
botan_rng_reseed :: BotanRNG -> CSize -> IO CInt

-- | Reseed a random number generator
botan_rng_reseed_from_rng :: BotanRNG -> BotanRNG -> CSize -> IO CInt

-- | Add some seed material to a random number generator
botan_rng_add_entropy :: BotanRNG -> ConstPtr Word8 -> CSize -> IO CInt
instance GHC.Classes.Eq Botan.Bindings.RNG.BotanRNG
instance GHC.Classes.Ord Botan.Bindings.RNG.BotanRNG
instance GHC.Internal.Foreign.Storable.Storable Botan.Bindings.RNG.BotanRNG


module Botan.Bindings.MPI

-- | Opaque MP struct
data BotanMPStruct

-- | Botan MP object
newtype BotanMP
MkBotanMP :: Ptr BotanMPStruct -> BotanMP
[ptr] :: BotanMP -> Ptr BotanMPStruct

-- | Destroy (deallocate) an MPI
botan_mp_destroy :: FinalizerPtr BotanMPStruct

-- | Initialize an MPI
botan_mp_init :: Ptr BotanMP -> IO CInt

-- | Convert the MPI to a hex string. Writes botan_mp_num_bytes(mp)*2 + 1
--   bytes
botan_mp_to_hex :: BotanMP -> Ptr CChar -> IO CInt

-- | Convert the MPI to a string. Currently base == 10 and base == 16 are
--   supported.
--   
--   NOTE: base 16 encoding has an `0x` prefix, base 10 does not.
--   
--   NOTE: Despite the size ptr, this appears to be returning
--   null-terminated CStrings
botan_mp_to_str :: BotanMP -> Word8 -> Ptr CChar -> Ptr CSize -> IO CInt

-- | Set the MPI to zero
botan_mp_clear :: BotanMP -> IO CInt

-- | Set the MPI value from an int
botan_mp_set_from_int :: BotanMP -> CInt -> IO CInt

-- | Set the MPI value from another MP object
botan_mp_set_from_mp :: BotanMP -> BotanMP -> IO CInt

-- | Set the MPI value from a string
botan_mp_set_from_str :: BotanMP -> ConstPtr CChar -> IO CInt

-- | Set the MPI value from a string with arbitrary radix. For arbitrary
--   being 10 or 16.
botan_mp_set_from_radix_str :: BotanMP -> ConstPtr CChar -> CSize -> IO CInt

-- | Return the number of significant bits in the MPI
botan_mp_num_bits :: BotanMP -> Ptr CSize -> IO CInt

-- | Return the number of significant bytes in the MPI
botan_mp_num_bytes :: BotanMP -> Ptr CSize -> IO CInt

-- | Convert the MPI to a big-endian binary string. Writes
--   botan_mp_num_bytes to vec
botan_mp_to_bin :: BotanMP -> Ptr Word8 -> IO CInt

-- | Set an MP to the big-endian binary value
botan_mp_from_bin :: BotanMP -> ConstPtr Word8 -> CSize -> IO CInt

-- | Convert the MPI to a uint32_t, if possible. Fails if MPI is negative
--   or too large.
botan_mp_to_uint32 :: BotanMP -> Ptr Word32 -> IO CInt

-- | This function should have been named mp_is_non_negative. Returns 1 iff
--   mp is greater than *or equal to* zero. Use botan_mp_is_negative to
--   detect negative numbers, botan_mp_is_zero to check for zero.
botan_mp_is_positive :: BotanMP -> IO CInt

-- | Return 1 iff mp is less than 0
botan_mp_is_negative :: BotanMP -> IO CInt
botan_mp_flip_sign :: BotanMP -> IO CInt
botan_mp_is_zero :: BotanMP -> IO CInt
botan_mp_add_u32 :: BotanMP -> BotanMP -> Word32 -> IO CInt
botan_mp_sub_u32 :: BotanMP -> BotanMP -> Word32 -> IO CInt
botan_mp_add :: BotanMP -> BotanMP -> BotanMP -> IO CInt
botan_mp_sub :: BotanMP -> BotanMP -> BotanMP -> IO CInt
botan_mp_mul :: BotanMP -> BotanMP -> BotanMP -> IO CInt
botan_mp_div :: BotanMP -> BotanMP -> BotanMP -> BotanMP -> IO CInt
botan_mp_mod_mul :: BotanMP -> BotanMP -> BotanMP -> BotanMP -> IO CInt

-- | Returns 0 if x != y Returns 1 if x == y Returns negative number on
--   error
botan_mp_equal :: BotanMP -> BotanMP -> IO CInt

-- | Sets *result to comparison result: -1 if x <a>0 if x == y, 1 if x</a>
--   y Returns negative number on error or zero on success
botan_mp_cmp :: Ptr CInt -> BotanMP -> BotanMP -> IO CInt

-- | Swap two botan_mp_t
botan_mp_swap :: BotanMP -> BotanMP -> IO CInt

-- | Return (base^exponent) % modulus
botan_mp_powmod :: BotanMP -> BotanMP -> BotanMP -> BotanMP -> IO CInt
botan_mp_lshift :: BotanMP -> BotanMP -> CSize -> IO CInt
botan_mp_rshift :: BotanMP -> BotanMP -> CSize -> IO CInt
botan_mp_mod_inverse :: BotanMP -> BotanMP -> BotanMP -> IO CInt
botan_mp_rand_bits :: BotanMP -> BotanRNG -> CSize -> IO CInt
botan_mp_rand_range :: BotanMP -> BotanRNG -> BotanMP -> BotanMP -> IO CInt
botan_mp_gcd :: BotanMP -> BotanMP -> BotanMP -> IO CInt

-- | Returns 0 if n is not prime Returns 1 if n is prime Returns negative
--   number on error
botan_mp_is_prime :: BotanMP -> BotanRNG -> CSize -> IO CInt

-- | Returns 0 if specified bit of n is not set Returns 1 if specified bit
--   of n is set Returns negative number on error
botan_mp_get_bit :: BotanMP -> CSize -> IO CInt

-- | Set the specified bit
botan_mp_set_bit :: BotanMP -> CSize -> IO CInt

-- | Clear the specified bit
botan_mp_clear_bit :: BotanMP -> CSize -> IO CInt
instance GHC.Classes.Eq Botan.Bindings.MPI.BotanMP
instance GHC.Classes.Ord Botan.Bindings.MPI.BotanMP
instance GHC.Internal.Foreign.Storable.Storable Botan.Bindings.MPI.BotanMP


-- | Format preserving encryption (FPE) refers to a set of techniques for
--   encrypting data such that the ciphertext has the same format as the
--   plaintext. For instance, you can use FPE to encrypt credit card
--   numbers with valid checksums such that the ciphertext is also an
--   credit card number with a valid checksum, or similarly for bank
--   account numbers, US Social Security numbers, or even more general
--   mappings like English words onto other English words.
--   
--   The scheme currently implemented in botan is called FE1, and described
--   in the paper Format Preserving Encryption by Mihir Bellare, Thomas
--   Ristenpart, Phillip Rogaway, and Till Stegers. FPE is an area of
--   ongoing standardization and it is likely that other schemes will be
--   included in the future.
--   
--   To encrypt an arbitrary value using FE1, you need to use a ranking
--   method. Basically, the idea is to assign an integer to every value you
--   might encrypt. For instance, a 16 digit credit card number consists of
--   a 15 digit code plus a 1 digit checksum. So to encrypt a credit card
--   number, you first remove the checksum, encrypt the 15 digit value
--   modulo 1015, and then calculate what the checksum is for the new
--   (ciphertext) number. Or, if you were encrypting words in a dictionary,
--   you could rank the words by their lexicographical order, and choose
--   the modulus to be the number of words in the dictionary.
module Botan.Bindings.FPE

-- | Opaque FPE struct
data BotanFPEStruct

-- | Botan FPE object
newtype BotanFPE
MkBotanFPE :: Ptr BotanFPEStruct -> BotanFPE
[ptr] :: BotanFPE -> Ptr BotanFPEStruct

-- | Destroy the FPE object
botan_fpe_destroy :: FinalizerPtr BotanFPEStruct
pattern BOTAN_FPE_FLAG_NONE :: (Eq a, Num a) => a
pattern BOTAN_FPE_FLAG_FE1_COMPAT_MODE :: (Eq a, Num a) => a
botan_fpe_fe1_init :: Ptr BotanFPE -> BotanMP -> ConstPtr Word8 -> CSize -> CSize -> Word32 -> IO CInt
botan_fpe_encrypt :: BotanFPE -> BotanMP -> ConstPtr Word8 -> CSize -> IO CInt
botan_fpe_decrypt :: BotanFPE -> BotanMP -> ConstPtr Word8 -> CSize -> IO CInt
instance GHC.Classes.Eq Botan.Bindings.FPE.BotanFPE
instance GHC.Classes.Ord Botan.Bindings.FPE.BotanFPE
instance GHC.Internal.Foreign.Storable.Storable Botan.Bindings.FPE.BotanFPE


-- | Generate and validate Bcrypt password hashes
module Botan.Bindings.Bcrypt

-- | Should not cause noticable CPU usage
pattern BOTAN_BCRYPT_WORK_FACTOR_FAST :: (Eq a, Num a) => a

-- | May cause noticable CPU usage
pattern BOTAN_BCRYPT_WORK_FACTOR_GOOD :: (Eq a, Num a) => a

-- | May block for several seconds
pattern BOTAN_BCRYPT_WORK_FACTOR_STRONG :: (Eq a, Num a) => a

-- | Create a password hash using Bcrypt
--   
--   Output is formatted bcrypt $2a$...
botan_bcrypt_generate :: Ptr Word8 -> Ptr CSize -> ConstPtr CChar -> BotanRNG -> CSize -> Word32 -> IO CInt

-- | Check a previously created password hash
botan_bcrypt_is_valid :: ConstPtr CChar -> ConstPtr CChar -> IO CInt


-- | This module is based on the <a>Secure Remote Password</a> section of
--   the C++ API reference.
module Botan.Bindings.SRP6

-- | Opaque SRP-6 server session struct
data BotanSRP6ServerSessionStruct

-- | SRP-6 server session object
newtype BotanSRP6ServerSession
MkBotanSRP6ServerSession :: Ptr BotanSRP6ServerSessionStruct -> BotanSRP6ServerSession
[ptr] :: BotanSRP6ServerSession -> Ptr BotanSRP6ServerSessionStruct

-- | Frees all resources of the SRP-6 server session object
--   
--   NOTE: this a binding to the <i>address</i> of the
--   <tt>botan_srp6_server_session_destroy</tt> C function.
botan_srp6_server_session_destroy :: FinalizerPtr BotanSRP6ServerSessionStruct

-- | Initialize an SRP-6 server session object
botan_srp6_server_session_init :: Ptr BotanSRP6ServerSession -> IO CInt

-- | SRP-6 Server side step 1
--   
--   NOTE: this function should be not be invoked twice on the same server
--   session. Regardless of the result of the first invocation, the second
--   invocation will result in an error. See
--   <a>https://github.com/randombit/botan/issues/5112</a> for more
--   information. If a second invocation can not be prevented, try it on a
--   newly initialised server session instead.
botan_srp6_server_session_step1 :: BotanSRP6ServerSession -> ConstPtr Word8 -> CSize -> ConstPtr CChar -> ConstPtr CChar -> BotanRNG -> Ptr Word8 -> Ptr CSize -> IO CInt

-- | SRP-6 Server side step 2
botan_srp6_server_session_step2 :: BotanSRP6ServerSession -> ConstPtr Word8 -> CSize -> Ptr Word8 -> Ptr CSize -> IO CInt

-- | Generate a new SRP-6 verifier
botan_srp6_generate_verifier :: ConstPtr CChar -> ConstPtr CChar -> ConstPtr Word8 -> CSize -> ConstPtr CChar -> ConstPtr CChar -> Ptr Word8 -> Ptr CSize -> IO CInt

-- | SRP6a Client side
botan_srp6_client_agree :: ConstPtr CChar -> ConstPtr CChar -> ConstPtr CChar -> ConstPtr CChar -> ConstPtr Word8 -> CSize -> ConstPtr Word8 -> CSize -> BotanRNG -> Ptr Word8 -> Ptr CSize -> Ptr Word8 -> Ptr CSize -> IO CInt

-- | Return the size, in bytes, of the prime associated with group_id
--   
--   This function can be used to determine the size of output buffers for
--   generated keys in the SRP6 algorithm. Such buffers need to be
--   allocated before calling SRP6 functions. An example of such a buffer
--   is the <tt>verifier[]</tt> buffer in the
--   <a>botan_srp6_generate_verifier</a> function.
botan_srp6_group_size :: ConstPtr CChar -> Ptr CSize -> IO CInt
instance GHC.Classes.Eq Botan.Bindings.SRP6.BotanSRP6ServerSession
instance GHC.Classes.Ord Botan.Bindings.SRP6.BotanSRP6ServerSession
instance GHC.Internal.Foreign.Storable.Storable Botan.Bindings.SRP6.BotanSRP6ServerSession


-- | One time password schemes are a user authentication method that relies
--   on a fixed secret key which is used to derive a sequence of short
--   passwords, each of which is accepted only once. Commonly this is used
--   to implement two-factor authentication (2FA), where the user
--   authenticates using both a conventional password (or a public key
--   signature) and an OTP generated by a small device such as a mobile
--   phone.
--   
--   Botan implements the HOTP and TOTP schemes from RFC 4226 and 6238.
--   
--   Since the range of possible OTPs is quite small, applications must
--   rate limit OTP authentication attempts to some small number per
--   second. Otherwise an attacker could quickly try all 1000000 6-digit
--   OTPs in a brief amount of time.
--   
--   HOTP generates OTPs that are a short numeric sequence, between 6 and 8
--   digits (most applications use 6 digits), created using the HMAC of a
--   64-bit counter value. If the counter ever repeats the OTP will also
--   repeat, thus both parties must assure the counter only increments and
--   is never repeated or decremented. Thus both client and server must
--   keep track of the next counter expected.
--   
--   Anyone with access to the client-specific secret key can authenticate
--   as that client, so it should be treated with the same security
--   consideration as would be given to any other symmetric key or
--   plaintext password.
--   
--   TOTP is based on the same algorithm as HOTP, but instead of a counter
--   a timestamp is used.
module Botan.Bindings.TOTP

-- | Opaque TOTP struct
data BotanTOTPStruct

-- | Botan TOTP object
newtype BotanTOTP
MkBotanTOTP :: Ptr BotanTOTPStruct -> BotanTOTP
[ptr] :: BotanTOTP -> Ptr BotanTOTPStruct

-- | Destroy a TOTP instance
botan_totp_destroy :: FinalizerPtr BotanTOTPStruct

-- | Initialize a TOTP instance
botan_totp_init :: Ptr BotanTOTP -> ConstPtr Word8 -> CSize -> ConstPtr CChar -> CSize -> CSize -> IO CInt

-- | Generate a TOTP code for the provided timestamp
botan_totp_generate :: BotanTOTP -> Ptr Word32 -> Word64 -> IO CInt

-- | Verify a TOTP code
botan_totp_check :: BotanTOTP -> Word32 -> Word64 -> CSize -> IO CInt
instance GHC.Classes.Eq Botan.Bindings.TOTP.BotanTOTP
instance GHC.Classes.Ord Botan.Bindings.TOTP.BotanTOTP
instance GHC.Internal.Foreign.Storable.Storable Botan.Bindings.TOTP.BotanTOTP


-- | This module is based on the <a>Utility Functions</a> section of the C
--   Botan FFI documentation.
module Botan.Bindings.Utility

-- | Returns 0 if x[0..len] == y[0..len], -1 otherwise.
botan_constant_time_compare :: ConstPtr Word8 -> ConstPtr Word8 -> CSize -> IO CInt
botan_scrub_mem :: Ptr a -> CSize -> IO CInt
pattern BOTAN_FFI_HEX_UPPER_CASE :: (Eq a, Num a) => a
pattern BOTAN_FFI_HEX_LOWER_CASE :: (Eq a, Num a) => a
botan_hex_encode :: ConstPtr Word8 -> CSize -> Ptr CChar -> Word32 -> IO CInt
botan_hex_decode :: ConstPtr CChar -> CSize -> Ptr Word8 -> Ptr CSize -> IO CInt
botan_base64_encode :: ConstPtr Word8 -> CSize -> Ptr CChar -> Ptr CSize -> IO CInt
botan_base64_decode :: ConstPtr CChar -> CSize -> Ptr Word8 -> Ptr CSize -> IO CInt


-- | This module is based on the <a>Versioning</a> section of the C Botan
--   FFI documentation.
module Botan.Bindings.Version
botan_ffi_api_version :: IO Word32
botan_ffi_supports_api :: Word32 -> IO CInt
botan_version_string :: IO (ConstPtr CChar)
botan_version_major :: IO Word32
botan_version_minor :: IO Word32
botan_version_patch :: IO Word32
botan_version_datestamp :: IO Word32


-- | This module is based on the <a>View Functions</a> section of the C
--   Botan FFI documentation.
module Botan.Bindings.View
type BotanViewContext a = Ptr a
type BotanViewBinFn ctx = BotanViewContext ctx -> ConstPtr Word8 -> CSize -> CInt
type BotanViewBinCallback ctx = FunPtr BotanViewBinFn ctx
mallocBotanViewBinCallback :: BotanViewBinFn ctx -> IO (BotanViewBinCallback ctx)
freeBotanViewBinCallback :: BotanViewBinCallback ctx -> IO ()
type BotanViewStrFn ctx = BotanViewContext ctx -> ConstPtr CChar -> CSize -> CInt
type BotanViewStrCallback ctx = FunPtr BotanViewStrFn ctx
mallocBotanViewStrCallback :: BotanViewStrFn ctx -> IO (BotanViewStrCallback ctx)
freeBotanViewStrCallback :: BotanViewStrCallback ctx -> IO ()


-- | Public key cryptography is a collection of techniques allowing for
--   encryption, signatures, and key agreement.
module Botan.Bindings.PubKey

-- | Opaque PrivKey struct
data BotanPrivKeyStruct

-- | Botan PrivKey object
newtype BotanPrivKey
MkBotanPrivKey :: Ptr BotanPrivKeyStruct -> BotanPrivKey
[ptr] :: BotanPrivKey -> Ptr BotanPrivKeyStruct

-- | Frees all resources of the PrivKey object
botan_privkey_destroy :: FinalizerPtr BotanPrivKeyStruct
pattern BOTAN_PK_RSA :: (Eq a, IsString a) => a
pattern BOTAN_PK_SM2 :: (Eq a, IsString a) => a
pattern BOTAN_PK_ELGAMAL :: (Eq a, IsString a) => a
pattern BOTAN_PK_DSA :: (Eq a, IsString a) => a
pattern BOTAN_PK_ECDSA :: (Eq a, IsString a) => a
pattern BOTAN_PK_ECKCDSA :: (Eq a, IsString a) => a
pattern BOTAN_PK_ECGDSA :: (Eq a, IsString a) => a
pattern BOTAN_PK_GOST_34_10 :: (Eq a, IsString a) => a
pattern BOTAN_PK_ED25519 :: (Eq a, IsString a) => a
pattern BOTAN_PK_XMSS :: (Eq a, IsString a) => a
pattern BOTAN_PK_DH :: (Eq a, IsString a) => a
pattern BOTAN_PK_ECDH :: (Eq a, IsString a) => a
pattern BOTAN_PK_CURVE25519 :: (Eq a, IsString a) => a
pattern BOTAN_PK_DILITHIUM :: (Eq a, IsString a) => a
pattern BOTAN_PK_KYBER :: (Eq a, IsString a) => a
pattern BOTAN_PK_MCELIECE :: (Eq a, IsString a) => a
pattern BOTAN_XMSS_SHA2_10_256 :: (Eq a, IsString a) => a
pattern BOTAN_XMSS_SHA2_16_256 :: (Eq a, IsString a) => a
pattern BOTAN_XMSS_SHA2_20_256 :: (Eq a, IsString a) => a
pattern BOTAN_XMSS_SHA2_10_512 :: (Eq a, IsString a) => a
pattern BOTAN_XMSS_SHA2_16_512 :: (Eq a, IsString a) => a
pattern BOTAN_XMSS_SHA2_20_512 :: (Eq a, IsString a) => a
pattern BOTAN_XMSS_SHAKE_10_256 :: (Eq a, IsString a) => a
pattern BOTAN_XMSS_SHAKE_16_256 :: (Eq a, IsString a) => a
pattern BOTAN_XMSS_SHAKE_20_256 :: (Eq a, IsString a) => a
pattern BOTAN_XMSS_SHAKE_10_512 :: (Eq a, IsString a) => a
pattern BOTAN_XMSS_SHAKE_16_512 :: (Eq a, IsString a) => a
pattern BOTAN_XMSS_SHAKE_20_512 :: (Eq a, IsString a) => a
pattern BOTAN_ECGROUP_SECP_160_K1 :: (Eq a, IsString a) => a
pattern BOTAN_ECGROUP_SECP_160_R1 :: (Eq a, IsString a) => a
pattern BOTAN_ECGROUP_SECP_160_R2 :: (Eq a, IsString a) => a
pattern BOTAN_ECGROUP_SECP_192_K1 :: (Eq a, IsString a) => a
pattern BOTAN_ECGROUP_SECP_192_R1 :: (Eq a, IsString a) => a
pattern BOTAN_ECGROUP_SECP_224_K1 :: (Eq a, IsString a) => a
pattern BOTAN_ECGROUP_SECP_224_R1 :: (Eq a, IsString a) => a
pattern BOTAN_ECGROUP_SECP_256_K1 :: (Eq a, IsString a) => a
pattern BOTAN_ECGROUP_SECP_256_R1 :: (Eq a, IsString a) => a
pattern BOTAN_ECGROUP_SECP_384_R1 :: (Eq a, IsString a) => a
pattern BOTAN_ECGROUP_SECP_521_R1 :: (Eq a, IsString a) => a
pattern BOTAN_ECGROUP_BRAINPOOL_160_R1 :: (Eq a, IsString a) => a
pattern BOTAN_ECGROUP_BRAINPOOL_192_R1 :: (Eq a, IsString a) => a
pattern BOTAN_ECGROUP_BRAINPOOL_224_R1 :: (Eq a, IsString a) => a
pattern BOTAN_ECGROUP_BRAINPOOL_256_R1 :: (Eq a, IsString a) => a
pattern BOTAN_ECGROUP_BRAINPOOL_320_R1 :: (Eq a, IsString a) => a
pattern BOTAN_ECGROUP_BRAINPOOL_384_R1 :: (Eq a, IsString a) => a
pattern BOTAN_ECGROUP_BRAINPOOL_512_R1 :: (Eq a, IsString a) => a
pattern BOTAN_ECGROUP_X962_P192_V2 :: (Eq a, IsString a) => a
pattern BOTAN_ECGROUP_X962_P192_V3 :: (Eq a, IsString a) => a
pattern BOTAN_ECGROUP_X962_P239_V1 :: (Eq a, IsString a) => a
pattern BOTAN_ECGROUP_X962_P239_V2 :: (Eq a, IsString a) => a
pattern BOTAN_ECGROUP_X962_P239_V3 :: (Eq a, IsString a) => a
pattern BOTAN_ECGROUP_GOST_256A :: (Eq a, IsString a) => a
pattern BOTAN_ECGROUP_GOST_512A :: (Eq a, IsString a) => a
pattern BOTAN_ECGROUP_FRP_256_V1 :: (Eq a, IsString a) => a
pattern BOTAN_ECGROUP_SM2_P256_V1 :: (Eq a, IsString a) => a
pattern BOTAN_DLGROUP_FFDHE_IETF_2048 :: (Eq a, IsString a) => a
pattern BOTAN_DLGROUP_FFDHE_IETF_3072 :: (Eq a, IsString a) => a
pattern BOTAN_DLGROUP_FFDHE_IETF_4096 :: (Eq a, IsString a) => a
pattern BOTAN_DLGROUP_FFDHE_IETF_6144 :: (Eq a, IsString a) => a
pattern BOTAN_DLGROUP_FFDHE_IETF_8192 :: (Eq a, IsString a) => a
pattern BOTAN_DLGROUP_MODP_IETF_1024 :: (Eq a, IsString a) => a
pattern BOTAN_DLGROUP_MODP_IETF_1536 :: (Eq a, IsString a) => a
pattern BOTAN_DLGROUP_MODP_IETF_2048 :: (Eq a, IsString a) => a
pattern BOTAN_DLGROUP_MODP_IETF_3072 :: (Eq a, IsString a) => a
pattern BOTAN_DLGROUP_MODP_IETF_4096 :: (Eq a, IsString a) => a
pattern BOTAN_DLGROUP_MODP_IETF_6144 :: (Eq a, IsString a) => a
pattern BOTAN_DLGROUP_MODP_IETF_8192 :: (Eq a, IsString a) => a
pattern BOTAN_DLGROUP_MODP_SRP_1024 :: (Eq a, IsString a) => a
pattern BOTAN_DLGROUP_MODP_SRP_1536 :: (Eq a, IsString a) => a
pattern BOTAN_DLGROUP_MODP_SRP_2048 :: (Eq a, IsString a) => a
pattern BOTAN_DLGROUP_MODP_SRP_3072 :: (Eq a, IsString a) => a
pattern BOTAN_DLGROUP_MODP_SRP_4096 :: (Eq a, IsString a) => a
pattern BOTAN_DLGROUP_MODP_SRP_6144 :: (Eq a, IsString a) => a
pattern BOTAN_DLGROUP_MODP_SRP_8192 :: (Eq a, IsString a) => a
pattern BOTAN_DLGROUP_DSA_JCE_1024 :: (Eq a, IsString a) => a
pattern BOTAN_DLGROUP_DSA_BOTAN_2048 :: (Eq a, IsString a) => a
pattern BOTAN_DLGROUP_DSA_BOTAN_3072 :: (Eq a, IsString a) => a
pattern BOTAN_EME_RAW :: (Eq a, IsString a) => a
pattern BOTAN_EME_PKCS1_v1_5 :: (Eq a, IsString a) => a
pattern BOTAN_EME_OAEP :: (Eq a, IsString a) => a
pattern BOTAN_MGF_MGF1 :: (Eq a, IsString a) => a

-- | Create a new private key
botan_privkey_create :: Ptr BotanPrivKey -> ConstPtr CChar -> ConstPtr CChar -> BotanRNG -> IO CInt
pattern BOTAN_CHECK_KEY_NORMAL_TESTS :: (Eq a, Num a) => a
pattern BOTAN_CHECK_KEY_EXPENSIVE_TESTS :: (Eq a, Num a) => a

-- | Check the validity of a private key
botan_privkey_check_key :: BotanPrivKey -> BotanRNG -> Word32 -> IO CInt

-- | Input currently assumed to be PKCS #8 structure; Set password to NULL
--   to indicate no encryption expected Starting in 2.8.0, the rng
--   parameter is unused and may be set to null
botan_privkey_load :: Ptr BotanPrivKey -> BotanRNG -> ConstPtr Word8 -> CSize -> ConstPtr CChar -> IO CInt
pattern BOTAN_PRIVKEY_EXPORT_FLAG_DER :: (Eq a, Num a) => a
pattern BOTAN_PRIVKEY_EXPORT_FLAG_PEM :: (Eq a, Num a) => a

-- | On input *out_len is number of bytes in out[] On output *out_len is
--   number of bytes written (or required) If out is not big enough no
--   output is written, *out_len is set and 1 is returned Returns 0 on
--   success and sets If some other error occurs a negative integer is
--   returned.
botan_privkey_export :: BotanPrivKey -> Ptr Word8 -> Ptr CSize -> Word32 -> IO CInt

-- | View the private key's DER encoding
botan_privkey_view_der :: BotanPrivKey -> BotanViewContext ctx -> BotanViewBinCallback ctx -> IO CInt

-- | View the private key's PEM encoding
botan_privkey_view_pem :: BotanPrivKey -> BotanViewContext ctx -> BotanViewStrCallback ctx -> IO CInt
botan_privkey_algo_name :: BotanPrivKey -> Ptr CChar -> Ptr CSize -> IO CInt

-- | Export a private key, running PBKDF for specified amount of time
--   
--   Note: starting in 3.0, the output iterations count is not provided
botan_privkey_export_encrypted_pbkdf_msec :: BotanPrivKey -> Ptr Word8 -> Ptr CSize -> BotanRNG -> ConstPtr CChar -> Word32 -> Ptr CSize -> ConstPtr CChar -> ConstPtr CChar -> Word32 -> IO CInt

-- | Export a private key using the specified number of iterations.
botan_privkey_export_encrypted_pbkdf_iter :: BotanPrivKey -> Ptr Word8 -> Ptr CSize -> BotanRNG -> ConstPtr CChar -> CSize -> ConstPtr CChar -> ConstPtr CChar -> Word32 -> IO CInt

-- | View the encryption of a private key (binary DER encoding)
--   
--   Set cipher_algo, pbkdf_algo to NULL to use defaults Set
--   pbkdf_iterations to 0 to use defaults
botan_privkey_view_encrypted_der :: BotanPrivKey -> BotanRNG -> ConstPtr CChar -> ConstPtr CChar -> ConstPtr CChar -> CSize -> BotanViewContext ctx -> BotanViewBinCallback ctx -> IO CInt

-- | View the encryption of a private key (binary DER encoding)
--   
--   Set cipher_algo, pbkdf_algo to NULL to use defaults
botan_privkey_view_encrypted_der_timed :: BotanPrivKey -> BotanRNG -> ConstPtr CChar -> ConstPtr CChar -> ConstPtr CChar -> CSize -> BotanViewContext ctx -> BotanViewBinCallback ctx -> IO CInt

-- | View the encryption of a private key (PEM encoding)
--   
--   Set cipher_algo, pbkdf_algo to NULL to use defaults Set
--   pbkdf_iterations to 0 to use defaults
botan_privkey_view_encrypted_pem :: BotanPrivKey -> BotanRNG -> ConstPtr CChar -> ConstPtr CChar -> ConstPtr CChar -> CSize -> BotanViewContext ctx -> BotanViewStrCallback ctx -> IO CInt

-- | View the encryption of a private key (PEM encoding)
--   
--   Set cipher_algo, pbkdf_algo to NULL to use defaults
botan_privkey_view_encrypted_pem_timed :: BotanPrivKey -> BotanRNG -> ConstPtr CChar -> ConstPtr CChar -> ConstPtr CChar -> CSize -> BotanViewContext ctx -> BotanViewStrCallback ctx -> IO CInt
botan_privkey_get_field :: BotanMP -> BotanPrivKey -> ConstPtr CChar -> IO CInt

-- | Opaque PubKey struct
data BotanPubKeyStruct

-- | Botan PubKey object
newtype BotanPubKey
MkBotanPubKey :: Ptr BotanPubKeyStruct -> BotanPubKey
[ptr] :: BotanPubKey -> Ptr BotanPubKeyStruct

-- | Frees all resources of the PubKey object
botan_pubkey_destroy :: FinalizerPtr BotanPubKeyStruct
botan_privkey_export_pubkey :: Ptr BotanPubKey -> BotanPrivKey -> IO CInt
botan_pubkey_load :: Ptr BotanPubKey -> ConstPtr Word8 -> CSize -> IO CInt
pattern BOTAN_PUBKEY_EXPORT_FLAG_DER :: (Eq a, Num a) => a
pattern BOTAN_PUBKEY_EXPORT_FLAG_PEM :: (Eq a, Num a) => a
botan_pubkey_export :: BotanPubKey -> Ptr Word8 -> Ptr CSize -> Word32 -> IO CInt

-- | View the public key's DER encoding
botan_pubkey_view_der :: BotanPubKey -> BotanViewContext ctx -> BotanViewBinCallback ctx -> IO CInt
botan_pubkey_view_pem :: BotanPubKey -> BotanViewContext ctx -> BotanViewStrCallback ctx -> IO CInt
botan_pubkey_algo_name :: BotanPubKey -> Ptr CChar -> Ptr CSize -> IO CInt

-- | Returns 0 if key is valid, negative if invalid key or some other error
botan_pubkey_check_key :: BotanPubKey -> BotanRNG -> Word32 -> IO CInt
botan_pubkey_estimated_strength :: BotanPubKey -> Ptr CSize -> IO CInt
botan_pubkey_fingerprint :: BotanPubKey -> ConstPtr CChar -> Ptr Word8 -> Ptr CSize -> IO CInt

-- | Get arbitrary named fields from public or private keys
botan_pubkey_get_field :: BotanMP -> BotanPubKey -> ConstPtr CChar -> IO CInt

-- | View the uncompressed public point associated with the key
botan_pubkey_view_ec_public_point :: BotanPubKey -> BotanViewContext ctx -> BotanViewBinCallback ctx -> IO CInt
instance GHC.Classes.Eq Botan.Bindings.PubKey.BotanPrivKey
instance GHC.Classes.Eq Botan.Bindings.PubKey.BotanPubKey
instance GHC.Classes.Ord Botan.Bindings.PubKey.BotanPrivKey
instance GHC.Classes.Ord Botan.Bindings.PubKey.BotanPubKey
instance GHC.Internal.Foreign.Storable.Storable Botan.Bindings.PubKey.BotanPrivKey
instance GHC.Internal.Foreign.Storable.Storable Botan.Bindings.PubKey.BotanPubKey


module Botan.Bindings.PubKey.X25519
botan_privkey_load_x25519 :: Ptr BotanPrivKey -> ConstPtr Word8 -> IO CInt
botan_pubkey_load_x25519 :: Ptr BotanPubKey -> ConstPtr Word8 -> IO CInt
botan_privkey_x25519_get_privkey :: BotanPrivKey -> Ptr Word8 -> IO CInt
botan_pubkey_x25519_get_pubkey :: BotanPubKey -> Ptr Word8 -> IO CInt


module Botan.Bindings.PubKey.Sign

-- | Opaque sign struct
data BotanPKOpSignStruct

-- | Botan sign object
newtype BotanPKOpSign
MkBotanPKOpSign :: Ptr BotanPKOpSignStruct -> BotanPKOpSign
[ptr] :: BotanPKOpSign -> Ptr BotanPKOpSignStruct

-- | Destroy a sign object
botan_pk_op_sign_destroy :: FinalizerPtr BotanPKOpSignStruct
pattern BOTAN_PUBKEY_STD_FORMAT_SIGNATURE :: (Eq a, Num a) => a
pattern BOTAN_PUBKEY_DER_FORMAT_SIGNATURE :: (Eq a, Num a) => a
botan_pk_op_sign_create :: Ptr BotanPKOpSign -> BotanPrivKey -> ConstPtr CChar -> Word32 -> IO CInt
botan_pk_op_sign_output_length :: BotanPKOpSign -> Ptr CSize -> IO CInt
botan_pk_op_sign_update :: BotanPKOpSign -> ConstPtr Word8 -> CSize -> IO CInt
botan_pk_op_sign_finish :: BotanPKOpSign -> BotanRNG -> Ptr Word8 -> Ptr CSize -> IO CInt
instance GHC.Classes.Eq Botan.Bindings.PubKey.Sign.BotanPKOpSign
instance GHC.Classes.Ord Botan.Bindings.PubKey.Sign.BotanPKOpSign
instance GHC.Internal.Foreign.Storable.Storable Botan.Bindings.PubKey.Sign.BotanPKOpSign


module Botan.Bindings.PubKey.Verify

-- | Opaque verify struct
data BotanPKOpVerifyStruct

-- | Botan verify object
newtype BotanPKOpVerify
MkBotanPKOpVerify :: Ptr BotanPKOpVerifyStruct -> BotanPKOpVerify
[ptr] :: BotanPKOpVerify -> Ptr BotanPKOpVerifyStruct

-- | Destroy a verify object
botan_pk_op_verify_destroy :: FinalizerPtr BotanPKOpVerifyStruct

-- | Uses the same flags as botan_pk_op_sign_create
botan_pk_op_verify_create :: Ptr BotanPKOpVerify -> BotanPubKey -> ConstPtr CChar -> Word32 -> IO CInt
botan_pk_op_verify_update :: BotanPKOpVerify -> ConstPtr Word8 -> CSize -> IO CInt
botan_pk_op_verify_finish :: BotanPKOpVerify -> ConstPtr Word8 -> CSize -> IO CInt
pattern BOTAN_PUBKEY_STD_FORMAT_SIGNATURE :: (Eq a, Num a) => a
pattern BOTAN_PUBKEY_DER_FORMAT_SIGNATURE :: (Eq a, Num a) => a
instance GHC.Classes.Eq Botan.Bindings.PubKey.Verify.BotanPKOpVerify
instance GHC.Classes.Ord Botan.Bindings.PubKey.Verify.BotanPKOpVerify
instance GHC.Internal.Foreign.Storable.Storable Botan.Bindings.PubKey.Verify.BotanPKOpVerify


module Botan.Bindings.PubKey.SM2
botan_pubkey_load_sm2 :: Ptr BotanPubKey -> BotanMP -> BotanMP -> ConstPtr CChar -> IO CInt
botan_privkey_load_sm2 :: Ptr BotanPrivKey -> BotanMP -> ConstPtr CChar -> IO CInt
botan_pubkey_sm2_compute_za :: Ptr Word8 -> Ptr CSize -> ConstPtr CChar -> ConstPtr CChar -> BotanPubKey -> IO CInt


module Botan.Bindings.PubKey.RSA
botan_privkey_load_rsa :: Ptr BotanPrivKey -> BotanMP -> BotanMP -> BotanMP -> IO CInt
botan_privkey_load_rsa_pkcs1 :: Ptr BotanPrivKey -> ConstPtr Word8 -> CSize -> IO CInt
botan_privkey_rsa_get_privkey :: BotanPrivKey -> Ptr Word8 -> Ptr CSize -> Word32 -> IO CInt
botan_pubkey_load_rsa :: Ptr BotanPubKey -> BotanMP -> BotanMP -> IO CInt


module Botan.Bindings.PubKey.KeyEncapsulation

-- | Opaque KEM encrypt struct
data BotanPKOpKEMEncryptStruct

-- | Botan KEM encrypt object
newtype BotanPKOpKEMEncrypt
MkBotanPKOpKEMEncrypt :: Ptr BotanPKOpKEMEncryptStruct -> BotanPKOpKEMEncrypt
[ptr] :: BotanPKOpKEMEncrypt -> Ptr BotanPKOpKEMEncryptStruct

-- | Destroy a KEM encrypt object
botan_pk_op_kem_encrypt_destroy :: FinalizerPtr BotanPKOpKEMEncryptStruct
botan_pk_op_kem_encrypt_create :: Ptr BotanPKOpKEMEncrypt -> BotanPubKey -> ConstPtr CChar -> IO CInt
botan_pk_op_kem_encrypt_shared_key_length :: BotanPKOpKEMEncrypt -> CSize -> Ptr CSize -> IO CInt
botan_pk_op_kem_encrypt_encapsulated_key_length :: BotanPKOpKEMEncrypt -> Ptr CSize -> IO CInt
botan_pk_op_kem_encrypt_create_shared_key :: BotanPKOpKEMEncrypt -> BotanRNG -> ConstPtr Word8 -> CSize -> CSize -> Ptr Word8 -> Ptr CSize -> Ptr Word8 -> Ptr CSize -> IO CInt

-- | Opaque KEM decrypt struct
data BotanPKOpKEMDecryptStruct

-- | Botan KEM decrypt object
newtype BotanPKOpKEMDecrypt
MkBotanPKOpKEMDecrypt :: Ptr BotanPKOpKEMDecryptStruct -> BotanPKOpKEMDecrypt
[ptr] :: BotanPKOpKEMDecrypt -> Ptr BotanPKOpKEMDecryptStruct

-- | Destroy a KEM decrypt object
botan_pk_op_kem_decrypt_destroy :: FinalizerPtr BotanPKOpKEMDecryptStruct
botan_pk_op_kem_decrypt_create :: Ptr BotanPKOpKEMDecrypt -> BotanPrivKey -> ConstPtr CChar -> IO CInt
botan_pk_op_kem_decrypt_shared_key_length :: BotanPKOpKEMDecrypt -> CSize -> Ptr CSize -> IO CInt
botan_pk_op_kem_decrypt_shared_key :: BotanPKOpKEMDecrypt -> ConstPtr Word8 -> CSize -> ConstPtr Word8 -> CSize -> CSize -> Ptr Word8 -> Ptr CSize -> IO CInt
instance GHC.Classes.Eq Botan.Bindings.PubKey.KeyEncapsulation.BotanPKOpKEMDecrypt
instance GHC.Classes.Eq Botan.Bindings.PubKey.KeyEncapsulation.BotanPKOpKEMEncrypt
instance GHC.Classes.Ord Botan.Bindings.PubKey.KeyEncapsulation.BotanPKOpKEMDecrypt
instance GHC.Classes.Ord Botan.Bindings.PubKey.KeyEncapsulation.BotanPKOpKEMEncrypt
instance GHC.Internal.Foreign.Storable.Storable Botan.Bindings.PubKey.KeyEncapsulation.BotanPKOpKEMDecrypt
instance GHC.Internal.Foreign.Storable.Storable Botan.Bindings.PubKey.KeyEncapsulation.BotanPKOpKEMEncrypt


module Botan.Bindings.PubKey.KeyAgreement

-- | Opaque key agreement struct
data BotanPKOpKeyAgreementStruct

-- | Botan key agreement object
newtype BotanPKOpKeyAgreement
MkBotanPKOpKeyAgreement :: Ptr BotanPKOpKeyAgreementStruct -> BotanPKOpKeyAgreement
[ptr] :: BotanPKOpKeyAgreement -> Ptr BotanPKOpKeyAgreementStruct

-- | Destroy a key agreement object
botan_pk_op_key_agreement_destroy :: FinalizerPtr BotanPKOpKeyAgreementStruct
pattern BOTAN_PUBKEY_KEY_AGREEMENT_FLAGS_NONE :: (Eq a, Num a) => a
botan_pk_op_key_agreement_create :: Ptr BotanPKOpKeyAgreement -> BotanPrivKey -> ConstPtr CChar -> Word32 -> IO CInt
botan_pk_op_key_agreement_export_public :: BotanPrivKey -> Ptr Word8 -> Ptr CSize -> IO CInt
botan_pk_op_key_agreement_view_public :: BotanPrivKey -> BotanViewContext ctx -> BotanViewBinCallback ctx -> IO CInt
botan_pk_op_key_agreement_size :: BotanPKOpKeyAgreement -> Ptr CSize -> IO CInt
botan_pk_op_key_agreement :: BotanPKOpKeyAgreement -> Ptr Word8 -> Ptr CSize -> ConstPtr Word8 -> CSize -> ConstPtr Word8 -> CSize -> IO CInt
instance GHC.Classes.Eq Botan.Bindings.PubKey.KeyAgreement.BotanPKOpKeyAgreement
instance GHC.Classes.Ord Botan.Bindings.PubKey.KeyAgreement.BotanPKOpKeyAgreement
instance GHC.Internal.Foreign.Storable.Storable Botan.Bindings.PubKey.KeyAgreement.BotanPKOpKeyAgreement


module Botan.Bindings.PubKey.Encrypt

-- | Opaque encrypt struct
data BotanPKOpEncryptStruct

-- | Botan encrypt object
newtype BotanPKOpEncrypt
MkBotanPKOpEncrypt :: Ptr BotanPKOpEncryptStruct -> BotanPKOpEncrypt
[ptr] :: BotanPKOpEncrypt -> Ptr BotanPKOpEncryptStruct

-- | Destroy a encrypt object
botan_pk_op_encrypt_destroy :: FinalizerPtr BotanPKOpEncryptStruct
pattern BOTAN_PUBKEY_ENCRYPT_FLAGS_NONE :: (Eq a, Num a) => a
botan_pk_op_encrypt_create :: Ptr BotanPKOpEncrypt -> BotanPubKey -> ConstPtr CChar -> Word32 -> IO CInt
botan_pk_op_encrypt_output_length :: BotanPKOpEncrypt -> CSize -> Ptr CSize -> IO CInt
botan_pk_op_encrypt :: BotanPKOpEncrypt -> BotanRNG -> Ptr Word8 -> Ptr CSize -> Ptr Word8 -> CSize -> IO CInt
instance GHC.Classes.Eq Botan.Bindings.PubKey.Encrypt.BotanPKOpEncrypt
instance GHC.Classes.Ord Botan.Bindings.PubKey.Encrypt.BotanPKOpEncrypt
instance GHC.Internal.Foreign.Storable.Storable Botan.Bindings.PubKey.Encrypt.BotanPKOpEncrypt


module Botan.Bindings.PubKey.ElGamal

-- | Generates ElGamal key pair. Caller has a control over key length and
--   order of a subgroup <tt>q</tt>. Function is able to use two types of
--   primes:
--   
--   <ul>
--   <li>if pbits-1 == qbits then safe primes are used for key
--   generation</li>
--   <li>otherwise generation uses group of prime order</li>
--   </ul>
botan_privkey_create_elgamal :: Ptr BotanPrivKey -> BotanRNG -> CSize -> CSize -> IO CInt

-- | Loads ElGamal private key
botan_pubkey_load_elgamal :: Ptr BotanPubKey -> BotanMP -> BotanMP -> BotanMP -> IO CInt

-- | Loads ElGamal public key
botan_privkey_load_elgamal :: Ptr BotanPrivKey -> BotanMP -> BotanMP -> BotanMP -> IO CInt


module Botan.Bindings.PubKey.Ed25519
botan_privkey_load_ed25519 :: Ptr BotanPrivKey -> ConstPtr Word8 -> IO CInt
botan_pubkey_load_ed25519 :: Ptr BotanPubKey -> ConstPtr Word8 -> IO CInt
botan_privkey_ed25519_get_privkey :: BotanPrivKey -> Ptr Word8 -> IO CInt
botan_pubkey_ed25519_get_pubkey :: BotanPubKey -> Ptr Word8 -> IO CInt


module Botan.Bindings.PubKey.ECDSA
botan_privkey_load_ecdsa :: Ptr BotanPrivKey -> BotanMP -> ConstPtr CChar -> IO CInt
botan_pubkey_load_ecdsa :: Ptr BotanPubKey -> BotanMP -> BotanMP -> ConstPtr CChar -> IO CInt


module Botan.Bindings.PubKey.ECDH
botan_pubkey_load_ecdh :: Ptr BotanPubKey -> BotanMP -> BotanMP -> ConstPtr CChar -> IO CInt
botan_privkey_load_ecdh :: Ptr BotanPrivKey -> BotanMP -> ConstPtr CChar -> IO CInt


module Botan.Bindings.PubKey.Decrypt

-- | Opaque decrypt struct
data BotanPKOpDecryptStruct

-- | Botan decrypt object
newtype BotanPKOpDecrypt
MkBotanPKOpDecrypt :: Ptr BotanPKOpDecryptStruct -> BotanPKOpDecrypt
[ptr] :: BotanPKOpDecrypt -> Ptr BotanPKOpDecryptStruct

-- | Destroy a decrypt object
botan_pk_op_decrypt_destroy :: FinalizerPtr BotanPKOpDecryptStruct
pattern BOTAN_PUBKEY_DECRYPT_FLAGS_NONE :: (Eq a, Num a) => a
botan_pk_op_decrypt_create :: Ptr BotanPKOpDecrypt -> BotanPrivKey -> Ptr CChar -> Word32 -> IO CInt
botan_pk_op_decrypt_output_length :: BotanPKOpDecrypt -> CSize -> Ptr CSize -> IO CInt
botan_pk_op_decrypt :: BotanPKOpDecrypt -> Ptr Word8 -> Ptr CSize -> ConstPtr Word8 -> CSize -> IO CInt
instance GHC.Classes.Eq Botan.Bindings.PubKey.Decrypt.BotanPKOpDecrypt
instance GHC.Classes.Ord Botan.Bindings.PubKey.Decrypt.BotanPKOpDecrypt
instance GHC.Internal.Foreign.Storable.Storable Botan.Bindings.PubKey.Decrypt.BotanPKOpDecrypt


module Botan.Bindings.PubKey.DSA

-- | Generates DSA key pair. Gives to a caller control over key length and
--   order of a subgroup <tt>q</tt>.
botan_privkey_create_dsa :: Ptr BotanPrivKey -> BotanRNG -> CSize -> CSize -> IO CInt
botan_privkey_load_dsa :: Ptr BotanPrivKey -> BotanMP -> BotanMP -> BotanMP -> BotanMP -> IO CInt
botan_pubkey_load_dsa :: Ptr BotanPubKey -> BotanMP -> BotanMP -> BotanMP -> BotanMP -> IO CInt


module Botan.Bindings.PubKey.DH

-- | Loads Diffie Hellman private key
botan_privkey_load_dh :: Ptr BotanPrivKey -> BotanMP -> BotanMP -> BotanMP -> IO CInt

-- | Loads Diffie Hellman public key
botan_pubkey_load_dh :: Ptr BotanPubKey -> BotanMP -> BotanMP -> BotanMP -> IO CInt


-- | A certificate is a binding between some identifying information
--   (called a subject) and a public key. This binding is asserted by a
--   signature on the certificate, which is placed there by some authority
--   (the issuer) that at least claims that it knows the subject named in
--   the certificate really “owns” the private key corresponding to the
--   public key in the certificate.
--   
--   The major certificate format in use today is X.509v3, used for
--   instance in the Transport Layer Security (TLS) protocol.
module Botan.Bindings.X509

-- | Opaque X509Cert struct
data BotanX509CertStruct

-- | Botan X509Cert object
newtype BotanX509Cert
MkBotanX509Cert :: Ptr BotanX509CertStruct -> BotanX509Cert
[ptr] :: BotanX509Cert -> Ptr BotanX509CertStruct

-- | Destroy a X509Cert instance
botan_x509_cert_destroy :: FinalizerPtr BotanX509CertStruct
botan_x509_cert_load :: Ptr BotanX509Cert -> ConstPtr Word8 -> CSize -> IO CInt
botan_x509_cert_load_file :: Ptr BotanX509Cert -> ConstPtr CChar -> IO CInt
botan_x509_cert_dup :: Ptr BotanX509Cert -> BotanX509Cert -> IO CInt
botan_x509_cert_get_time_starts :: BotanX509Cert -> Ptr CChar -> Ptr CSize -> IO CInt
botan_x509_cert_get_time_expires :: BotanX509Cert -> Ptr CChar -> Ptr CSize -> IO CInt
botan_x509_cert_not_before :: BotanX509Cert -> Ptr Word64 -> IO CInt
botan_x509_cert_not_after :: BotanX509Cert -> Ptr Word64 -> IO CInt
botan_x509_cert_get_fingerprint :: BotanX509Cert -> ConstPtr CChar -> Ptr Word8 -> Ptr CSize -> IO CInt
botan_x509_cert_get_serial_number :: BotanX509Cert -> Ptr Word8 -> Ptr CSize -> IO CInt
botan_x509_cert_get_authority_key_id :: BotanX509Cert -> Ptr Word8 -> Ptr CSize -> IO CInt
botan_x509_cert_get_subject_key_id :: BotanX509Cert -> Ptr Word8 -> Ptr CSize -> IO CInt
botan_x509_cert_get_public_key_bits :: BotanX509Cert -> Ptr Word8 -> Ptr CSize -> IO CInt
botan_x509_cert_view_public_key_bits :: BotanX509Cert -> BotanViewContext ctx -> BotanViewBinCallback ctx -> IO CInt
botan_x509_cert_get_public_key :: BotanX509Cert -> Ptr BotanPubKey -> IO CInt
botan_x509_cert_get_issuer_dn :: BotanX509Cert -> ConstPtr CChar -> CSize -> Ptr Word8 -> Ptr CSize -> IO CInt
botan_x509_cert_get_subject_dn :: BotanX509Cert -> ConstPtr CChar -> CSize -> Ptr Word8 -> Ptr CSize -> IO CInt
botan_x509_cert_to_string :: BotanX509Cert -> Ptr CChar -> Ptr CSize -> IO CInt
botan_x509_cert_view_as_string :: BotanX509Cert -> BotanViewContext ctx -> BotanViewStrCallback ctx -> IO CInt
pattern NO_CONSTRAINTS :: (Eq a, Num a) => a
pattern DIGITAL_SIGNATURE :: (Eq a, Num a) => a
pattern NON_REPUDIATION :: (Eq a, Num a) => a
pattern KEY_ENCIPHERMENT :: (Eq a, Num a) => a
pattern DATA_ENCIPHERMENT :: (Eq a, Num a) => a
pattern KEY_AGREEMENT :: (Eq a, Num a) => a
pattern KEY_CERT_SIGN :: (Eq a, Num a) => a
pattern CRL_SIGN :: (Eq a, Num a) => a
pattern ENCIPHER_ONLY :: (Eq a, Num a) => a
pattern DECIPHER_ONLY :: (Eq a, Num a) => a
botan_x509_cert_allowed_usage :: BotanX509Cert -> CUInt -> IO CInt

-- | Check if the certificate matches the specified hostname via
--   alternative name or CN match. RFC 5280 wildcards also supported.
botan_x509_cert_hostname_match :: BotanX509Cert -> ConstPtr CChar -> IO CInt

-- | Returns 0 if the validation was successful, 1 if validation failed,
--   and negative on error. A status code with details is written to
--   *validation_result
--   
--   Intermediates or trusted lists can be null Trusted path can be null
botan_x509_cert_verify :: Ptr CInt -> BotanX509Cert -> ConstPtr BotanX509Cert -> CSize -> ConstPtr BotanX509Cert -> CSize -> ConstPtr CChar -> CSize -> ConstPtr CChar -> Word64 -> IO CInt

-- | Returns a pointer to a static character string explaining the status
--   code, or else NULL if unknown.
botan_x509_cert_validation_status :: CInt -> IO (ConstPtr CChar)

-- | Opaque X509CRL struct
data BotanX509CRLStruct

-- | Botan X509CRL object
newtype BotanX509CRL
MkBotanX509CRL :: Ptr BotanX509CRLStruct -> BotanX509CRL
[ptr] :: BotanX509CRL -> Ptr BotanX509CRLStruct

-- | Destroy a X509CRL instance
botan_x509_crl_destroy :: FinalizerPtr BotanX509CRLStruct
botan_x509_crl_load_file :: Ptr BotanX509CRL -> ConstPtr CChar -> IO CInt
botan_x509_crl_load :: Ptr BotanX509CRL -> ConstPtr Word8 -> CSize -> IO CInt

-- | Given a CRL and a certificate, check if the certificate is revoked on
--   that particular CRL
botan_x509_is_revoked :: BotanX509CRL -> BotanX509Cert -> IO CInt

-- | Different flavor of <a>botan_x509_cert_verify</a>, supports revocation
--   lists. CRLs are passed as an array, same as intermediates and trusted
--   CAs
botan_x509_cert_verify_with_crl :: Ptr CInt -> BotanX509Cert -> ConstPtr BotanX509Cert -> CSize -> ConstPtr BotanX509Cert -> CSize -> ConstPtr BotanX509CRL -> CSize -> ConstPtr CChar -> CSize -> ConstPtr CChar -> Word64 -> IO CInt
instance GHC.Classes.Eq Botan.Bindings.X509.BotanX509CRL
instance GHC.Classes.Eq Botan.Bindings.X509.BotanX509Cert
instance GHC.Classes.Ord Botan.Bindings.X509.BotanX509CRL
instance GHC.Classes.Ord Botan.Bindings.X509.BotanX509Cert
instance GHC.Internal.Foreign.Storable.Storable Botan.Bindings.X509.BotanX509CRL
instance GHC.Internal.Foreign.Storable.Storable Botan.Bindings.X509.BotanX509Cert


-- | The ZFEC module provides forward error correction compatible with the
--   zfec library.
--   
--   Forward error correction takes an input and creates multiple “shares”,
--   such that any K of N shares is sufficient to recover the entire
--   original input.
--   
--   Note
--   
--   Specific to the ZFEC format, the first K generated shares are
--   identical to the original input data, followed by N-K shares of error
--   correcting code. This is very different from threshold secret sharing,
--   where having fewer than K shares gives no information about the
--   original input.
--   
--   Warning
--   
--   If a corrupted share is provided to the decoding algorithm, the
--   resulting decoding will be invalid. It is recommended to protect
--   shares using a technique such as a MAC or public key signature, if
--   corruption is likely in your application.
--   
--   ZFEC requires that the input length be exactly divisible by K; if
--   needed define a padding scheme to pad your input to the necessary
--   size.
module Botan.Bindings.ZFEC

-- | Encode some bytes with certain ZFEC parameters.
botan_zfec_encode :: CSize -> CSize -> ConstPtr Word8 -> CSize -> Ptr (Ptr Word8) -> IO CInt

-- | Decode some previously encoded shares using certain ZFEC parameters.
botan_zfec_decode :: CSize -> CSize -> ConstPtr CSize -> ConstPtr (ConstPtr Word8) -> CSize -> Ptr (Ptr Word8) -> IO CInt
