Botan
2.1.0
Crypto and TLS for C++11
|
#include <botan/ffi.h>
#include <botan/system_rng.h>
#include <botan/exceptn.h>
#include <botan/auto_rng.h>
#include <botan/aead.h>
#include <botan/block_cipher.h>
#include <botan/hash.h>
#include <botan/mac.h>
#include <botan/pbkdf.h>
#include <botan/version.h>
#include <botan/pkcs8.h>
#include <botan/x509cert.h>
#include <botan/data_src.h>
#include <botan/pubkey.h>
#include <botan/hex.h>
#include <botan/mem_ops.h>
#include <botan/x509_key.h>
#include <botan/pk_algs.h>
#include <botan/bigint.h>
#include <botan/reducer.h>
#include <botan/numthry.h>
#include <botan/divide.h>
#include <cstring>
#include <memory>
Go to the source code of this file.
Macros | |
#define | BOTAN_ASSERT_ARG_NON_NULL(p) do { if(!p) throw Botan::Invalid_Argument("Argument " #p " is null"); } while(0) |
#define | BOTAN_FFI_DECLARE_STRUCT(NAME, TYPE, MAGIC) struct NAME : public botan_struct<TYPE, MAGIC> { explicit NAME(TYPE* x) : botan_struct(x) {} } |
#define | BOTAN_FFI_DO(T, obj, param, block) apply_fn(obj, BOTAN_CURRENT_FUNCTION, [=](T& param) -> int { do { block } while(0); return 0; }) |
Functions | |
int | botan_bcrypt_generate (uint8_t *out, size_t *out_len, const char *pass, botan_rng_t rng_obj, size_t wf, uint32_t flags) |
int | botan_bcrypt_is_valid (const char *pass, const char *hash) |
int | botan_block_cipher_block_size (botan_block_cipher_t bc) |
int | botan_block_cipher_clear (botan_block_cipher_t bc) |
int | botan_block_cipher_decrypt_blocks (botan_block_cipher_t bc, const uint8_t in[], uint8_t out[], size_t blocks) |
int | botan_block_cipher_destroy (botan_block_cipher_t bc) |
int | botan_block_cipher_encrypt_blocks (botan_block_cipher_t bc, const uint8_t in[], uint8_t out[], size_t blocks) |
int | botan_block_cipher_init (botan_block_cipher_t *bc, const char *bc_name) |
int | botan_block_cipher_set_key (botan_block_cipher_t bc, const uint8_t key[], size_t len) |
int | botan_cipher_clear (botan_cipher_t cipher) |
int | botan_cipher_destroy (botan_cipher_t cipher) |
int | botan_cipher_get_default_nonce_length (botan_cipher_t cipher, size_t *nl) |
int | botan_cipher_get_tag_length (botan_cipher_t cipher, size_t *tl) |
int | botan_cipher_get_update_granularity (botan_cipher_t cipher, size_t *ug) |
int | botan_cipher_init (botan_cipher_t *cipher, const char *cipher_name, uint32_t flags) |
int | botan_cipher_query_keylen (botan_cipher_t cipher, size_t *out_minimum_keylength, size_t *out_maximum_keylength) |
int | botan_cipher_set_associated_data (botan_cipher_t cipher, const uint8_t *ad, size_t ad_len) |
int | botan_cipher_set_key (botan_cipher_t cipher, const uint8_t *key, size_t key_len) |
int | botan_cipher_start (botan_cipher_t cipher_obj, const uint8_t *nonce, size_t nonce_len) |
int | botan_cipher_update (botan_cipher_t cipher_obj, uint32_t flags, uint8_t output[], size_t output_size, size_t *output_written, const uint8_t input[], size_t input_size, size_t *input_consumed) |
int | botan_cipher_valid_nonce_length (botan_cipher_t cipher, size_t nl) |
uint32_t | botan_ffi_api_version () |
BOTAN_FFI_DECLARE_STRUCT (botan_rng_struct, Botan::RandomNumberGenerator, 0x4901F9C1) | |
BOTAN_FFI_DECLARE_STRUCT (botan_mp_struct, Botan::BigInt, 0xC828B9D2) | |
BOTAN_FFI_DECLARE_STRUCT (botan_block_cipher_struct, Botan::BlockCipher, 0x64C29716) | |
BOTAN_FFI_DECLARE_STRUCT (botan_hash_struct, Botan::HashFunction, 0x1F0A4F84) | |
BOTAN_FFI_DECLARE_STRUCT (botan_mac_struct, Botan::MessageAuthenticationCode, 0xA06E8FC1) | |
BOTAN_FFI_DECLARE_STRUCT (botan_pubkey_struct, Botan::Public_Key, 0x2C286519) | |
BOTAN_FFI_DECLARE_STRUCT (botan_privkey_struct, Botan::Private_Key, 0x7F96385E) | |
BOTAN_FFI_DECLARE_STRUCT (botan_pk_op_encrypt_struct, Botan::PK_Encryptor, 0x891F3FC3) | |
BOTAN_FFI_DECLARE_STRUCT (botan_pk_op_decrypt_struct, Botan::PK_Decryptor, 0x912F3C37) | |
BOTAN_FFI_DECLARE_STRUCT (botan_pk_op_sign_struct, Botan::PK_Signer, 0x1AF0C39F) | |
BOTAN_FFI_DECLARE_STRUCT (botan_pk_op_verify_struct, Botan::PK_Verifier, 0x2B91F936) | |
BOTAN_FFI_DECLARE_STRUCT (botan_pk_op_ka_struct, Botan::PK_Key_Agreement, 0x2939CAB1) | |
BOTAN_FFI_DECLARE_STRUCT (botan_x509_cert_struct, Botan::X509_Certificate, 0x8F628937) | |
int | botan_ffi_supports_api (uint32_t api_version) |
int | botan_hash_clear (botan_hash_t hash) |
int | botan_hash_destroy (botan_hash_t hash) |
int | botan_hash_final (botan_hash_t hash, uint8_t out[]) |
int | botan_hash_init (botan_hash_t *hash, const char *hash_name, uint32_t flags) |
int | botan_hash_output_length (botan_hash_t hash, size_t *out) |
int | botan_hash_update (botan_hash_t hash, const uint8_t *buf, size_t len) |
int | botan_hex_encode (const uint8_t *in, size_t len, char *out, uint32_t flags) |
int | botan_kdf (const char *kdf_algo, uint8_t out[], size_t out_len, const uint8_t secret[], size_t secret_len, const uint8_t salt[], size_t salt_len, const uint8_t label[], size_t label_len) |
int | botan_mac_clear (botan_mac_t mac) |
int | botan_mac_destroy (botan_mac_t mac) |
int | botan_mac_final (botan_mac_t mac, uint8_t out[]) |
int | botan_mac_init (botan_mac_t *mac, const char *mac_name, uint32_t flags) |
int | botan_mac_output_length (botan_mac_t mac, size_t *out) |
int | botan_mac_set_key (botan_mac_t mac, const uint8_t *key, size_t key_len) |
int | botan_mac_update (botan_mac_t mac, const uint8_t *buf, size_t len) |
int | botan_mceies_decrypt (botan_privkey_t mce_key_obj, const char *aead, const uint8_t ct[], size_t ct_len, const uint8_t ad[], size_t ad_len, uint8_t out[], size_t *out_len) |
int | botan_mceies_encrypt (botan_pubkey_t mce_key_obj, botan_rng_t rng_obj, const char *aead, const uint8_t pt[], size_t pt_len, const uint8_t ad[], size_t ad_len, uint8_t out[], size_t *out_len) |
int | botan_mp_add (botan_mp_t result, const botan_mp_t x, const botan_mp_t y) |
int | botan_mp_clear (botan_mp_t mp) |
int | botan_mp_clear_bit (botan_mp_t mp, size_t bit) |
int | botan_mp_cmp (int *result, const botan_mp_t x_w, const botan_mp_t y_w) |
int | botan_mp_destroy (botan_mp_t mp) |
int | botan_mp_div (botan_mp_t quotient, botan_mp_t remainder, const botan_mp_t x, const botan_mp_t y) |
int | botan_mp_equal (const botan_mp_t x_w, const botan_mp_t y_w) |
int | botan_mp_flip_sign (botan_mp_t mp) |
int | botan_mp_from_bin (botan_mp_t mp, const uint8_t bin[], size_t bin_len) |
int | botan_mp_gcd (botan_mp_t out, const botan_mp_t x, const botan_mp_t y) |
int | botan_mp_get_bit (const botan_mp_t mp, size_t bit) |
int | botan_mp_init (botan_mp_t *mp) |
int | botan_mp_is_even (const botan_mp_t mp) |
int | botan_mp_is_negative (const botan_mp_t mp) |
int | botan_mp_is_odd (const botan_mp_t mp) |
int | botan_mp_is_positive (const botan_mp_t mp) |
int | botan_mp_is_prime (const botan_mp_t mp, botan_rng_t rng, size_t test_prob) |
int | botan_mp_is_zero (const botan_mp_t mp) |
int | botan_mp_lshift (botan_mp_t out, const botan_mp_t in, size_t shift) |
int | botan_mp_mod_inverse (botan_mp_t out, const botan_mp_t in, const botan_mp_t modulus) |
int | botan_mp_mod_mul (botan_mp_t out, const botan_mp_t x, const botan_mp_t y, const botan_mp_t modulus) |
int | botan_mp_mul (botan_mp_t result, const botan_mp_t x, const botan_mp_t y) |
int | botan_mp_num_bits (const botan_mp_t mp, size_t *bits) |
int | botan_mp_num_bytes (const botan_mp_t mp, size_t *bytes) |
int | botan_mp_powmod (botan_mp_t out, const botan_mp_t base, const botan_mp_t exponent, const botan_mp_t modulus) |
int | botan_mp_rand_bits (botan_mp_t rand_out, botan_rng_t rng, size_t bits) |
int | botan_mp_rand_range (botan_mp_t rand_out, botan_rng_t rng, const botan_mp_t lower, const botan_mp_t upper) |
int | botan_mp_rshift (botan_mp_t out, const botan_mp_t in, size_t shift) |
int | botan_mp_set_bit (botan_mp_t mp, size_t bit) |
int | botan_mp_set_from_int (botan_mp_t mp, int initial_value) |
int | botan_mp_set_from_mp (botan_mp_t dest, const botan_mp_t source) |
int | botan_mp_set_from_radix_str (botan_mp_t mp, const char *str, size_t radix) |
int | botan_mp_set_from_str (botan_mp_t mp, const char *str) |
int | botan_mp_sub (botan_mp_t result, const botan_mp_t x, const botan_mp_t y) |
int | botan_mp_swap (botan_mp_t x_w, botan_mp_t y_w) |
int | botan_mp_to_bin (const botan_mp_t mp, uint8_t vec[]) |
int | botan_mp_to_hex (const botan_mp_t mp, char *out) |
int | botan_mp_to_str (const botan_mp_t mp, uint8_t digit_base, char *out, size_t *out_len) |
int | botan_mp_to_uint32 (const botan_mp_t mp, uint32_t *val) |
int | botan_pbkdf (const char *pbkdf_algo, uint8_t out[], size_t out_len, const char *pass, const uint8_t salt[], size_t salt_len, size_t iterations) |
int | botan_pbkdf_timed (const char *pbkdf_algo, uint8_t out[], size_t out_len, const char *password, const uint8_t salt[], size_t salt_len, size_t ms_to_run, size_t *iterations_used) |
int | botan_pk_op_decrypt (botan_pk_op_decrypt_t op, uint8_t out[], size_t *out_len, uint8_t ciphertext[], size_t ciphertext_len) |
int | botan_pk_op_decrypt_create (botan_pk_op_decrypt_t *op, botan_privkey_t key_obj, const char *padding, uint32_t flags) |
int | botan_pk_op_decrypt_destroy (botan_pk_op_decrypt_t op) |
int | botan_pk_op_encrypt (botan_pk_op_encrypt_t op, botan_rng_t rng_obj, uint8_t out[], size_t *out_len, const uint8_t plaintext[], size_t plaintext_len) |
int | botan_pk_op_encrypt_create (botan_pk_op_encrypt_t *op, botan_pubkey_t key_obj, const char *padding, uint32_t flags) |
int | botan_pk_op_encrypt_destroy (botan_pk_op_encrypt_t op) |
int | botan_pk_op_key_agreement (botan_pk_op_ka_t op, uint8_t out[], size_t *out_len, const uint8_t other_key[], size_t other_key_len, const uint8_t salt[], size_t salt_len) |
int | botan_pk_op_key_agreement_create (botan_pk_op_ka_t *op, botan_privkey_t key_obj, const char *kdf, uint32_t flags) |
int | botan_pk_op_key_agreement_destroy (botan_pk_op_ka_t op) |
int | botan_pk_op_key_agreement_export_public (botan_privkey_t key, uint8_t out[], size_t *out_len) |
int | botan_pk_op_sign_create (botan_pk_op_sign_t *op, botan_privkey_t key_obj, const char *hash, uint32_t flags) |
int | botan_pk_op_sign_destroy (botan_pk_op_sign_t op) |
int | botan_pk_op_sign_finish (botan_pk_op_sign_t op, botan_rng_t rng_obj, uint8_t out[], size_t *out_len) |
int | botan_pk_op_sign_update (botan_pk_op_sign_t op, const uint8_t in[], size_t in_len) |
int | botan_pk_op_verify_create (botan_pk_op_verify_t *op, botan_pubkey_t key_obj, const char *hash, uint32_t flags) |
int | botan_pk_op_verify_destroy (botan_pk_op_verify_t op) |
int | botan_pk_op_verify_finish (botan_pk_op_verify_t op, const uint8_t sig[], size_t sig_len) |
int | botan_pk_op_verify_update (botan_pk_op_verify_t op, const uint8_t in[], size_t in_len) |
int | botan_privkey_check_key (botan_privkey_t key, botan_rng_t rng, uint32_t flags) |
int | botan_privkey_create (botan_privkey_t *key_obj, const char *algo_name, const char *algo_params, botan_rng_t rng_obj) |
int | botan_privkey_create_ecdh (botan_privkey_t *key_obj, botan_rng_t rng_obj, const char *param_str) |
int | botan_privkey_create_ecdsa (botan_privkey_t *key_obj, botan_rng_t rng_obj, const char *param_str) |
int | botan_privkey_create_mceliece (botan_privkey_t *key_obj, botan_rng_t rng_obj, size_t n, size_t t) |
int | botan_privkey_create_rsa (botan_privkey_t *key_obj, botan_rng_t rng_obj, size_t n_bits) |
int | botan_privkey_destroy (botan_privkey_t key) |
int | botan_privkey_dsa_get_x (botan_mp_t x, botan_privkey_t key) |
int | botan_privkey_export (botan_privkey_t key, uint8_t out[], size_t *out_len, uint32_t flags) |
int | botan_privkey_export_encrypted (botan_privkey_t key, uint8_t out[], size_t *out_len, botan_rng_t rng_obj, const char *pass, const char *, uint32_t flags) |
int | botan_privkey_export_encrypted_pbkdf_iter (botan_privkey_t key, uint8_t out[], size_t *out_len, botan_rng_t rng_obj, const char *pass, size_t pbkdf_iter, const char *maybe_cipher, const char *maybe_pbkdf_hash, uint32_t flags) |
int | botan_privkey_export_encrypted_pbkdf_msec (botan_privkey_t key, uint8_t out[], size_t *out_len, botan_rng_t rng_obj, const char *pass, uint32_t pbkdf_msec, size_t *pbkdf_iters_out, const char *maybe_cipher, const char *maybe_pbkdf_hash, uint32_t flags) |
int | botan_privkey_export_pubkey (botan_pubkey_t *pubout, botan_privkey_t key_obj) |
int | botan_privkey_get_field (botan_mp_t output, botan_privkey_t key, const char *field_name_cstr) |
int | botan_privkey_load (botan_privkey_t *key, botan_rng_t rng_obj, const uint8_t bits[], size_t len, const char *password) |
int | botan_privkey_load_dsa (botan_privkey_t *key, botan_mp_t p, botan_mp_t q, botan_mp_t g, botan_mp_t x) |
int | botan_privkey_load_rsa (botan_privkey_t *key, botan_mp_t p, botan_mp_t q, botan_mp_t d) |
int | botan_privkey_rsa_get_d (botan_mp_t d, botan_privkey_t key) |
int | botan_privkey_rsa_get_e (botan_mp_t e, botan_privkey_t key) |
int | botan_privkey_rsa_get_n (botan_mp_t n, botan_privkey_t key) |
int | botan_privkey_rsa_get_p (botan_mp_t p, botan_privkey_t key) |
int | botan_privkey_rsa_get_q (botan_mp_t q, botan_privkey_t key) |
int | botan_pubkey_algo_name (botan_pubkey_t key, char out[], size_t *out_len) |
int | botan_pubkey_check_key (botan_pubkey_t key, botan_rng_t rng, uint32_t flags) |
int | botan_pubkey_destroy (botan_pubkey_t key) |
int | botan_pubkey_dsa_get_g (botan_mp_t g, botan_pubkey_t key) |
int | botan_pubkey_dsa_get_p (botan_mp_t p, botan_pubkey_t key) |
int | botan_pubkey_dsa_get_q (botan_mp_t q, botan_pubkey_t key) |
int | botan_pubkey_dsa_get_y (botan_mp_t y, botan_pubkey_t key) |
int | botan_pubkey_estimated_strength (botan_pubkey_t key, size_t *estimate) |
int | botan_pubkey_export (botan_pubkey_t key, uint8_t out[], size_t *out_len, uint32_t flags) |
int | botan_pubkey_fingerprint (botan_pubkey_t key, const char *hash_fn, uint8_t out[], size_t *out_len) |
int | botan_pubkey_get_field (botan_mp_t output, botan_pubkey_t key, const char *field_name_cstr) |
int | botan_pubkey_load (botan_pubkey_t *key, const uint8_t bits[], size_t bits_len) |
int | botan_pubkey_load_dsa (botan_pubkey_t *key, botan_mp_t p, botan_mp_t q, botan_mp_t g, botan_mp_t y) |
int | botan_pubkey_load_rsa (botan_pubkey_t *key, botan_mp_t n, botan_mp_t e) |
int | botan_pubkey_rsa_get_e (botan_mp_t e, botan_pubkey_t key) |
int | botan_pubkey_rsa_get_n (botan_mp_t n, botan_pubkey_t key) |
int | botan_rng_destroy (botan_rng_t rng) |
int | botan_rng_get (botan_rng_t rng, uint8_t *out, size_t out_len) |
int | botan_rng_init (botan_rng_t *rng_out, const char *rng_type) |
int | botan_rng_reseed (botan_rng_t rng, size_t bits) |
int | botan_same_mem (const uint8_t *x, const uint8_t *y, size_t len) |
uint32_t | botan_version_datestamp () |
uint32_t | botan_version_major () |
uint32_t | botan_version_minor () |
uint32_t | botan_version_patch () |
const char * | botan_version_string () |
int | botan_x509_cert_allowed_usage (botan_x509_cert_t cert, unsigned int key_usage) |
int | botan_x509_cert_destroy (botan_x509_cert_t cert) |
int | botan_x509_cert_get_authority_key_id (botan_x509_cert_t cert, uint8_t out[], size_t *out_len) |
int | botan_x509_cert_get_fingerprint (botan_x509_cert_t cert, const char *hash, uint8_t out[], size_t *out_len) |
int | botan_x509_cert_get_issuer_dn (botan_x509_cert_t cert, const char *key, size_t index, uint8_t out[], size_t *out_len) |
int | botan_x509_cert_get_public_key (botan_x509_cert_t cert, botan_pubkey_t *key) |
int | botan_x509_cert_get_public_key_bits (botan_x509_cert_t cert, uint8_t out[], size_t *out_len) |
int | botan_x509_cert_get_serial_number (botan_x509_cert_t cert, uint8_t out[], size_t *out_len) |
int | botan_x509_cert_get_subject_dn (botan_x509_cert_t cert, const char *key, size_t index, uint8_t out[], size_t *out_len) |
int | botan_x509_cert_get_subject_key_id (botan_x509_cert_t cert, uint8_t out[], size_t *out_len) |
int | botan_x509_cert_get_time_expires (botan_x509_cert_t cert, char out[], size_t *out_len) |
int | botan_x509_cert_get_time_starts (botan_x509_cert_t cert, char out[], size_t *out_len) |
int | botan_x509_cert_load (botan_x509_cert_t *cert_obj, const uint8_t cert_bits[], size_t cert_bits_len) |
int | botan_x509_cert_load_file (botan_x509_cert_t *cert_obj, const char *cert_path) |
int | botan_x509_cert_to_string (botan_x509_cert_t cert, char out[], size_t *out_len) |
#define BOTAN_ASSERT_ARG_NON_NULL | ( | p | ) | do { if(!p) throw Botan::Invalid_Argument("Argument " #p " is null"); } while(0) |
Definition at line 79 of file ffi.cpp.
Referenced by botan_bcrypt_generate(), and botan_rng_init().
#define BOTAN_FFI_DECLARE_STRUCT | ( | NAME, | |
TYPE, | |||
MAGIC | |||
) | struct NAME : public botan_struct<TYPE, MAGIC> { explicit NAME(TYPE* x) : botan_struct(x) {} } |
#define BOTAN_FFI_DO | ( | T, | |
obj, | |||
param, | |||
block | |||
) | apply_fn(obj, BOTAN_CURRENT_FUNCTION, [=](T& param) -> int { do { block } while(0); return 0; }) |
Definition at line 204 of file ffi.cpp.
Referenced by botan_block_cipher_block_size(), botan_block_cipher_clear(), botan_block_cipher_decrypt_blocks(), botan_block_cipher_encrypt_blocks(), botan_block_cipher_set_key(), botan_cipher_clear(), botan_cipher_get_default_nonce_length(), botan_cipher_get_tag_length(), botan_cipher_get_update_granularity(), botan_cipher_query_keylen(), botan_cipher_set_associated_data(), botan_cipher_set_key(), botan_cipher_valid_nonce_length(), botan_hash_clear(), botan_hash_final(), botan_hash_output_length(), botan_hash_update(), botan_mac_clear(), botan_mac_final(), botan_mac_output_length(), botan_mac_set_key(), botan_mac_update(), botan_mp_add(), botan_mp_clear(), botan_mp_clear_bit(), botan_mp_cmp(), botan_mp_div(), botan_mp_equal(), botan_mp_flip_sign(), botan_mp_from_bin(), botan_mp_gcd(), botan_mp_get_bit(), botan_mp_is_even(), botan_mp_is_negative(), botan_mp_is_odd(), botan_mp_is_positive(), botan_mp_is_prime(), botan_mp_is_zero(), botan_mp_lshift(), botan_mp_mod_inverse(), botan_mp_mod_mul(), botan_mp_mul(), botan_mp_num_bits(), botan_mp_num_bytes(), botan_mp_powmod(), botan_mp_rand_bits(), botan_mp_rand_range(), botan_mp_rshift(), botan_mp_set_bit(), botan_mp_set_from_int(), botan_mp_set_from_mp(), botan_mp_set_from_radix_str(), botan_mp_set_from_str(), botan_mp_sub(), botan_mp_swap(), botan_mp_to_bin(), botan_mp_to_hex(), botan_mp_to_str(), botan_mp_to_uint32(), botan_pk_op_decrypt(), botan_pk_op_encrypt(), botan_pk_op_key_agreement(), botan_pk_op_key_agreement_export_public(), botan_pk_op_sign_finish(), botan_pk_op_sign_update(), botan_pk_op_verify_finish(), botan_pk_op_verify_update(), botan_privkey_check_key(), botan_privkey_export(), botan_privkey_export_encrypted_pbkdf_iter(), botan_privkey_export_encrypted_pbkdf_msec(), botan_privkey_get_field(), botan_pubkey_algo_name(), botan_pubkey_check_key(), botan_pubkey_estimated_strength(), botan_pubkey_export(), botan_pubkey_fingerprint(), botan_pubkey_get_field(), botan_rng_get(), botan_rng_reseed(), botan_x509_cert_allowed_usage(), botan_x509_cert_get_authority_key_id(), botan_x509_cert_get_fingerprint(), botan_x509_cert_get_issuer_dn(), botan_x509_cert_get_public_key_bits(), botan_x509_cert_get_serial_number(), botan_x509_cert_get_subject_dn(), botan_x509_cert_get_subject_key_id(), botan_x509_cert_get_time_expires(), botan_x509_cert_get_time_starts(), and botan_x509_cert_to_string().
int botan_bcrypt_generate | ( | uint8_t * | out, |
size_t * | out_len, | ||
const char * | password, | ||
botan_rng_t | rng, | ||
size_t | work_factor, | ||
uint32_t | flags | ||
) |
Create a password hash using Bcrypt
out | buffer holding the password hash, should be of length 64 bytes |
out_len | the desired output length in bytes |
password | the password |
rng | a random number generator |
work_factor | how much work to do to slow down guessing attacks |
flags | should be 0 in current API revision, all other uses are reserved and return BOTAN_FFI_ERROR_BAD_FLAG |
Output is formatted bcrypt $2a$...
Definition at line 1053 of file ffi.cpp.
References BOTAN_ASSERT_ARG_NON_NULL, BOTAN_CURRENT_FUNCTION, BOTAN_FFI_ERROR_BAD_FLAG, BOTAN_FFI_ERROR_EXCEPTION_THROWN, BOTAN_FFI_ERROR_NOT_IMPLEMENTED, Botan::generate_bcrypt(), and Botan::ASN1::to_string().
int botan_bcrypt_is_valid | ( | const char * | pass, |
const char * | hash | ||
) |
Check a previously created password hash
pass | the password to check against |
hash | the stored hash to check against |
Definition at line 1090 of file ffi.cpp.
References BOTAN_CURRENT_FUNCTION, BOTAN_FFI_ERROR_EXCEPTION_THROWN, BOTAN_FFI_ERROR_NOT_IMPLEMENTED, and Botan::check_bcrypt().
int botan_block_cipher_block_size | ( | botan_block_cipher_t | bc | ) |
Return the positive block size of this block cipher, or negative to indicate an error
Definition at line 652 of file ffi.cpp.
References Botan::BlockCipher::block_size(), and BOTAN_FFI_DO.
int botan_block_cipher_clear | ( | botan_block_cipher_t | bc | ) |
Reinitializes the block cipher
Definition at line 634 of file ffi.cpp.
References BOTAN_FFI_DO, and Botan::SymmetricAlgorithm::clear().
int botan_block_cipher_decrypt_blocks | ( | botan_block_cipher_t | bc, |
const uint8_t | in[], | ||
uint8_t | out[], | ||
size_t | blocks | ||
) |
Definition at line 665 of file ffi.cpp.
References BOTAN_FFI_DO, and Botan::BlockCipher::decrypt_n().
int botan_block_cipher_destroy | ( | botan_block_cipher_t | bc | ) |
int botan_block_cipher_encrypt_blocks | ( | botan_block_cipher_t | bc, |
const uint8_t | in[], | ||
uint8_t | out[], | ||
size_t | blocks | ||
) |
Definition at line 657 of file ffi.cpp.
References BOTAN_FFI_DO, and Botan::BlockCipher::encrypt_n().
int botan_block_cipher_init | ( | botan_block_cipher_t * | bc, |
const char * | cipher_name | ||
) |
Initialize a block cipher object
Definition at line 598 of file ffi.cpp.
References BOTAN_CURRENT_FUNCTION, BOTAN_FFI_ERROR_EXCEPTION_THROWN, BOTAN_FFI_ERROR_NULL_POINTER, and Botan::BlockCipher::create().
int botan_block_cipher_set_key | ( | botan_block_cipher_t | bc, |
const uint8_t | key[], | ||
size_t | len | ||
) |
Set the key for a block cipher instance
Definition at line 642 of file ffi.cpp.
References BOTAN_FFI_DO, and Botan::SymmetricAlgorithm::set_key().
int botan_cipher_clear | ( | botan_cipher_t | cipher | ) |
Definition at line 814 of file ffi.cpp.
References BOTAN_FFI_DO, and Botan::Cipher_Mode::clear().
int botan_cipher_destroy | ( | botan_cipher_t | cipher | ) |
int botan_cipher_get_default_nonce_length | ( | botan_cipher_t | cipher, |
size_t * | nl | ||
) |
Definition at line 977 of file ffi.cpp.
References BOTAN_FFI_DO, and Botan::Cipher_Mode::default_nonce_length().
int botan_cipher_get_tag_length | ( | botan_cipher_t | cipher, |
size_t * | tl | ||
) |
Definition at line 987 of file ffi.cpp.
References BOTAN_FFI_DO, and Botan::Cipher_Mode::tag_size().
int botan_cipher_get_update_granularity | ( | botan_cipher_t | cipher, |
size_t * | ug | ||
) |
Definition at line 982 of file ffi.cpp.
References BOTAN_FFI_DO, and Botan::Cipher_Mode::update_granularity().
int botan_cipher_init | ( | botan_cipher_t * | cipher, |
const char * | cipher_name, | ||
uint32_t | flags | ||
) |
Definition at line 784 of file ffi.cpp.
References BOTAN_CIPHER_INIT_FLAG_ENCRYPT, BOTAN_CIPHER_INIT_FLAG_MASK_DIRECTION, BOTAN_CURRENT_FUNCTION, Botan::DECRYPTION, Botan::ENCRYPTION, and Botan::get_cipher_mode().
int botan_cipher_query_keylen | ( | botan_cipher_t | cipher, |
size_t * | out_minimum_keylength, | ||
size_t * | out_maximum_keylength | ||
) |
Definition at line 819 of file ffi.cpp.
References BOTAN_FFI_DO, Botan::Cipher_Mode::key_spec(), and Botan::Key_Length_Specification::minimum_keylength().
int botan_cipher_set_associated_data | ( | botan_cipher_t | cipher, |
const uint8_t * | ad, | ||
size_t | ad_len | ||
) |
Definition at line 958 of file ffi.cpp.
References BOTAN_FFI_DO.
int botan_cipher_set_key | ( | botan_cipher_t | cipher, |
const uint8_t * | key, | ||
size_t | key_len | ||
) |
Definition at line 829 of file ffi.cpp.
References BOTAN_FFI_DO, and Botan::Cipher_Mode::set_key().
int botan_cipher_start | ( | botan_cipher_t | cipher_obj, |
const uint8_t * | nonce, | ||
size_t | nonce_len | ||
) |
Definition at line 835 of file ffi.cpp.
References BOTAN_CURRENT_FUNCTION, Botan::Cipher_Mode::start(), and Botan::Cipher_Mode::update_granularity().
int botan_cipher_update | ( | botan_cipher_t | cipher_obj, |
uint32_t | flags, | ||
uint8_t | output[], | ||
size_t | output_size, | ||
size_t * | output_written, | ||
const uint8_t | input[], | ||
size_t | input_size, | ||
size_t * | input_consumed | ||
) |
Definition at line 853 of file ffi.cpp.
References BOTAN_ASSERT, BOTAN_CIPHER_UPDATE_FLAG_FINAL, BOTAN_CURRENT_FUNCTION, Botan::copy_mem(), Botan::Cipher_Mode::finish(), Botan::Cipher_Mode::minimum_final_size(), Botan::round_down(), Botan::Cipher_Mode::update(), Botan::Cipher_Mode::update_granularity(), and Botan::Exception::what().
int botan_cipher_valid_nonce_length | ( | botan_cipher_t | cipher, |
size_t | nl | ||
) |
Definition at line 972 of file ffi.cpp.
References BOTAN_FFI_DO, and Botan::Cipher_Mode::valid_nonce_length().
uint32_t botan_ffi_api_version | ( | ) |
BOTAN_FFI_DECLARE_STRUCT | ( | botan_rng_struct | , |
Botan::RandomNumberGenerator | , | ||
0x4901F9C1 | |||
) |
BOTAN_FFI_DECLARE_STRUCT | ( | botan_mp_struct | , |
Botan::BigInt | , | ||
0xC828B9D2 | |||
) |
BOTAN_FFI_DECLARE_STRUCT | ( | botan_block_cipher_struct | , |
Botan::BlockCipher | , | ||
0x64C29716 | |||
) |
BOTAN_FFI_DECLARE_STRUCT | ( | botan_hash_struct | , |
Botan::HashFunction | , | ||
0x1F0A4F84 | |||
) |
BOTAN_FFI_DECLARE_STRUCT | ( | botan_mac_struct | , |
Botan::MessageAuthenticationCode | , | ||
0xA06E8FC1 | |||
) |
BOTAN_FFI_DECLARE_STRUCT | ( | botan_pubkey_struct | , |
Botan::Public_Key | , | ||
0x2C286519 | |||
) |
BOTAN_FFI_DECLARE_STRUCT | ( | botan_privkey_struct | , |
Botan::Private_Key | , | ||
0x7F96385E | |||
) |
BOTAN_FFI_DECLARE_STRUCT | ( | botan_pk_op_encrypt_struct | , |
Botan::PK_Encryptor | , | ||
0x891F3FC3 | |||
) |
BOTAN_FFI_DECLARE_STRUCT | ( | botan_pk_op_decrypt_struct | , |
Botan::PK_Decryptor | , | ||
0x912F3C37 | |||
) |
BOTAN_FFI_DECLARE_STRUCT | ( | botan_pk_op_sign_struct | , |
Botan::PK_Signer | , | ||
0x1AF0C39F | |||
) |
BOTAN_FFI_DECLARE_STRUCT | ( | botan_pk_op_verify_struct | , |
Botan::PK_Verifier | , | ||
0x2B91F936 | |||
) |
BOTAN_FFI_DECLARE_STRUCT | ( | botan_pk_op_ka_struct | , |
Botan::PK_Key_Agreement | , | ||
0x2939CAB1 | |||
) |
BOTAN_FFI_DECLARE_STRUCT | ( | botan_x509_cert_struct | , |
Botan::X509_Certificate | , | ||
0x8F628937 | |||
) |
int botan_ffi_supports_api | ( | uint32_t | api_version | ) |
Return 0 (ok) if the version given is one this library supports. botan_ffi_supports_api(botan_ffi_api_version()) will always return 0.
int botan_hash_clear | ( | botan_hash_t | hash | ) |
Reinitializes the state of the hash computation. A hash can be computed (with update/final) immediately.
hash | hash object |
Definition at line 712 of file ffi.cpp.
References BOTAN_FFI_DO, and Botan::HashFunction::clear().
int botan_hash_destroy | ( | botan_hash_t | hash | ) |
int botan_hash_final | ( | botan_hash_t | hash, |
uint8_t | out[] | ||
) |
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.
hash | hash object |
out | output buffer |
Definition at line 722 of file ffi.cpp.
References BOTAN_FFI_DO, and Botan::Buffered_Computation::final().
int botan_hash_init | ( | botan_hash_t * | hash, |
const char * | hash_name, | ||
uint32_t | flags | ||
) |
Initialize a hash function object
hash | hash object |
hash_name | name of the hash function, e.g., "SHA-384" |
flags | should be 0 in current API revision, all other uses are reserved and return BOTAN_FFI_ERROR_BAD_FLAG |
TODO: since output_length is effectively required to use this API, return it from init as an output parameter
Definition at line 673 of file ffi.cpp.
References BOTAN_CURRENT_FUNCTION, BOTAN_FFI_ERROR_BAD_FLAG, BOTAN_FFI_ERROR_EXCEPTION_THROWN, BOTAN_FFI_ERROR_NULL_POINTER, and Botan::HashFunction::create().
int botan_hash_output_length | ( | botan_hash_t | hash, |
size_t * | output_length | ||
) |
Writes the output length of the hash function to *output_length
hash | hash object |
output_length | output buffer to hold the hash function output length |
Definition at line 707 of file ffi.cpp.
References BOTAN_FFI_DO, and Botan::Buffered_Computation::output_length().
int botan_hash_update | ( | botan_hash_t | hash, |
const uint8_t * | in, | ||
size_t | in_len | ||
) |
Send more input to the hash function
hash | hash object |
in | input buffer |
in_len | number of bytes to read from the input buffer |
Definition at line 717 of file ffi.cpp.
References BOTAN_FFI_DO, and Botan::Buffered_Computation::update().
int botan_hex_encode | ( | const uint8_t * | x, |
size_t | len, | ||
char * | out, | ||
uint32_t | flags | ||
) |
Perform hex encoding
x | is some binary data |
len | length of x in bytes |
out | an array of at least x*2 bytes |
flags | flags out be upper or lower case? |
Definition at line 273 of file ffi.cpp.
References BOTAN_CURRENT_FUNCTION, BOTAN_FFI_HEX_LOWER_CASE, and Botan::hex_encode().
int botan_kdf | ( | const char * | kdf_algo, |
uint8_t | out[], | ||
size_t | out_len, | ||
const uint8_t | secret[], | ||
size_t | secret_len, | ||
const uint8_t | salt[], | ||
size_t | salt_len, | ||
const uint8_t | label[], | ||
size_t | label_len | ||
) |
Derive a key
kdf_algo | KDF algorithm, e.g., "SP800-56C" |
out | buffer holding the derived key, must be of length out_len |
out_len | the desired output length in bytes |
secret | the secret input |
secret_len | size of secret in bytes |
salt | a diversifier |
salt_len | size of salt in bytes |
label | purpose for the derived keying material |
label_len | size of label in bytes |
Definition at line 1033 of file ffi.cpp.
References BOTAN_CURRENT_FUNCTION, and Botan::get_kdf().
int botan_mac_clear | ( | botan_mac_t | mac | ) |
Reinitializes the state of the MAC computation. A MAC can be computed (with update/final) immediately.
mac | mac object |
Definition at line 769 of file ffi.cpp.
References BOTAN_FFI_DO, and Botan::SymmetricAlgorithm::clear().
int botan_mac_destroy | ( | botan_mac_t | mac | ) |
int botan_mac_final | ( | botan_mac_t | mac, |
uint8_t | out[] | ||
) |
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.
mac | mac object |
out | output buffer |
Definition at line 779 of file ffi.cpp.
References BOTAN_FFI_DO, and Botan::Buffered_Computation::final().
int botan_mac_init | ( | botan_mac_t * | mac, |
const char * | mac_name, | ||
uint32_t | flags | ||
) |
Initialize a message authentication code object
mac | mac object |
mac_name | name of the hash function, e.g., "HMAC(SHA-384)" |
flags | should be 0 in current API revision, all other uses are reserved and return a negative value (error code) |
Definition at line 727 of file ffi.cpp.
References BOTAN_CURRENT_FUNCTION, and Botan::MessageAuthenticationCode::create().
int botan_mac_output_length | ( | botan_mac_t | mac, |
size_t * | output_length | ||
) |
Writes the output length of the message authentication code to *output_length
mac | mac object |
output_length | output buffer to hold the MAC output length |
Definition at line 764 of file ffi.cpp.
References BOTAN_FFI_DO, and Botan::Buffered_Computation::output_length().
int botan_mac_set_key | ( | botan_mac_t | mac, |
const uint8_t * | key, | ||
size_t | key_len | ||
) |
Sets the key on the MAC
mac | mac object |
key | buffer holding the key |
key_len | size of the key buffer in bytes |
Definition at line 759 of file ffi.cpp.
References BOTAN_FFI_DO, and Botan::SymmetricAlgorithm::set_key().
int botan_mac_update | ( | botan_mac_t | mac, |
const uint8_t * | buf, | ||
size_t | len | ||
) |
Send more input to the message authentication code
mac | mac object |
buf | input buffer |
len | number of bytes to read from the input buffer |
Definition at line 774 of file ffi.cpp.
References BOTAN_FFI_DO, and Botan::Buffered_Computation::update().
int botan_mceies_decrypt | ( | botan_privkey_t | mce_key_obj, |
const char * | aead, | ||
const uint8_t | ct[], | ||
size_t | ct_len, | ||
const uint8_t | ad[], | ||
size_t | ad_len, | ||
uint8_t | out[], | ||
size_t * | out_len | ||
) |
Definition at line 2208 of file ffi.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, and Botan::mceies_decrypt().
int botan_mceies_encrypt | ( | botan_pubkey_t | mce_key_obj, |
botan_rng_t | rng_obj, | ||
const char * | aead, | ||
const uint8_t | pt[], | ||
size_t | pt_len, | ||
const uint8_t | ad[], | ||
size_t | ad_len, | ||
uint8_t | out[], | ||
size_t * | out_len | ||
) |
Definition at line 2235 of file ffi.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, and Botan::mceies_encrypt().
int botan_mp_add | ( | botan_mp_t | result, |
const botan_mp_t | x, | ||
const botan_mp_t | y | ||
) |
int botan_mp_clear | ( | botan_mp_t | mp | ) |
Definition at line 347 of file ffi.cpp.
References BOTAN_FFI_DO, and Botan::BigInt::clear().
int botan_mp_clear_bit | ( | botan_mp_t | n, |
size_t | bit | ||
) |
Clear the specified bit
Definition at line 583 of file ffi.cpp.
References BOTAN_FFI_DO, and Botan::BigInt::clear_bit().
int botan_mp_cmp | ( | int * | result, |
const botan_mp_t | x_w, | ||
const botan_mp_t | y_w | ||
) |
Definition at line 506 of file ffi.cpp.
References BOTAN_FFI_DO, and Botan::BigInt::cmp().
int botan_mp_destroy | ( | botan_mp_t | mp | ) |
int botan_mp_div | ( | botan_mp_t | quotient, |
botan_mp_t | remainder, | ||
const botan_mp_t | x, | ||
const botan_mp_t | y | ||
) |
Definition at line 475 of file ffi.cpp.
References BOTAN_FFI_DO, and Botan::divide().
int botan_mp_equal | ( | const botan_mp_t | x_w, |
const botan_mp_t | y_w | ||
) |
int botan_mp_flip_sign | ( | botan_mp_t | mp | ) |
Definition at line 405 of file ffi.cpp.
References BOTAN_FFI_DO, and Botan::BigInt::flip_sign().
int botan_mp_from_bin | ( | botan_mp_t | mp, |
const uint8_t | bin[], | ||
size_t | bin_len | ||
) |
Definition at line 410 of file ffi.cpp.
References Botan::BigInt::binary_decode(), and BOTAN_FFI_DO.
int botan_mp_gcd | ( | botan_mp_t | out, |
const botan_mp_t | x, | ||
const botan_mp_t | y | ||
) |
Definition at line 561 of file ffi.cpp.
References BOTAN_FFI_DO, and Botan::gcd().
int botan_mp_get_bit | ( | const botan_mp_t | n, |
size_t | bit | ||
) |
Returns 0 if specified bit of n is not set Returns 1 if specified bit of n is set Returns negative number on error
Definition at line 573 of file ffi.cpp.
References BOTAN_FFI_DO.
int botan_mp_init | ( | botan_mp_t * | mp | ) |
Definition at line 341 of file ffi.cpp.
int botan_mp_is_even | ( | const botan_mp_t | mp | ) |
Definition at line 501 of file ffi.cpp.
References BOTAN_FFI_DO, and Botan::BigInt::is_even().
int botan_mp_is_negative | ( | const botan_mp_t | mp | ) |
Return true iff mp is less than 0
Definition at line 395 of file ffi.cpp.
References BOTAN_FFI_DO, and Botan::BigInt::is_negative().
int botan_mp_is_odd | ( | const botan_mp_t | mp | ) |
Definition at line 496 of file ffi.cpp.
References BOTAN_FFI_DO, and Botan::BigInt::is_odd().
int botan_mp_is_positive | ( | const botan_mp_t | mp | ) |
Return true iff mp is greater than 0
Definition at line 400 of file ffi.cpp.
References BOTAN_FFI_DO, and Botan::BigInt::is_positive().
int botan_mp_is_prime | ( | const botan_mp_t | n, |
botan_rng_t | rng, | ||
size_t | test_prob | ||
) |
Returns 0 if n is not prime Returns 1 if n is prime Returns negative number on error
Definition at line 567 of file ffi.cpp.
References BOTAN_FFI_DO, and Botan::is_prime().
int botan_mp_is_zero | ( | const botan_mp_t | mp | ) |
Definition at line 491 of file ffi.cpp.
References BOTAN_FFI_DO, and Botan::BigInt::is_zero().
int botan_mp_lshift | ( | botan_mp_t | out, |
const botan_mp_t | in, | ||
size_t | shift | ||
) |
int botan_mp_mod_inverse | ( | botan_mp_t | out, |
const botan_mp_t | in, | ||
const botan_mp_t | modulus | ||
) |
Definition at line 533 of file ffi.cpp.
References BOTAN_FFI_DO, and Botan::inverse_mod().
int botan_mp_mod_mul | ( | botan_mp_t | out, |
const botan_mp_t | x, | ||
const botan_mp_t | y, | ||
const botan_mp_t | modulus | ||
) |
Definition at line 538 of file ffi.cpp.
References BOTAN_FFI_DO, and Botan::Modular_Reducer::multiply().
int botan_mp_mul | ( | botan_mp_t | result, |
const botan_mp_t | x, | ||
const botan_mp_t | y | ||
) |
int botan_mp_num_bits | ( | const botan_mp_t | mp, |
size_t * | bits | ||
) |
Definition at line 588 of file ffi.cpp.
References Botan::BigInt::bits(), and BOTAN_FFI_DO.
int botan_mp_num_bytes | ( | const botan_mp_t | mp, |
size_t * | bytes | ||
) |
Definition at line 593 of file ffi.cpp.
References BOTAN_FFI_DO, and Botan::BigInt::bytes().
int botan_mp_powmod | ( | botan_mp_t | out, |
const botan_mp_t | base, | ||
const botan_mp_t | exponent, | ||
const botan_mp_t | modulus | ||
) |
Definition at line 517 of file ffi.cpp.
References BOTAN_FFI_DO, and Botan::power_mod().
int botan_mp_rand_bits | ( | botan_mp_t | rand_out, |
botan_rng_t | rng, | ||
size_t | bits | ||
) |
Definition at line 546 of file ffi.cpp.
References BOTAN_FFI_DO, and Botan::RandomNumberGenerator::randomize().
int botan_mp_rand_range | ( | botan_mp_t | rand_out, |
botan_rng_t | rng, | ||
const botan_mp_t | lower, | ||
const botan_mp_t | upper | ||
) |
Definition at line 552 of file ffi.cpp.
References BOTAN_FFI_DO, and Botan::BigInt::random_integer().
int botan_mp_rshift | ( | botan_mp_t | out, |
const botan_mp_t | in, | ||
size_t | shift | ||
) |
int botan_mp_set_bit | ( | botan_mp_t | n, |
size_t | bit | ||
) |
Set the specified bit
Definition at line 578 of file ffi.cpp.
References BOTAN_FFI_DO, and Botan::BigInt::set_bit().
int botan_mp_set_from_int | ( | botan_mp_t | mp, |
int | initial_value | ||
) |
int botan_mp_set_from_mp | ( | botan_mp_t | dest, |
const botan_mp_t | source | ||
) |
int botan_mp_set_from_radix_str | ( | botan_mp_t | mp, |
const char * | str, | ||
size_t | radix | ||
) |
Definition at line 372 of file ffi.cpp.
References BOTAN_FFI_DO, BOTAN_FFI_ERROR_NOT_IMPLEMENTED, Botan::BigInt::Decimal, Botan::BigInt::decode(), and Botan::BigInt::Hexadecimal.
int botan_mp_set_from_str | ( | botan_mp_t | mp, |
const char * | str | ||
) |
int botan_mp_sub | ( | botan_mp_t | result, |
const botan_mp_t | x, | ||
const botan_mp_t | y | ||
) |
int botan_mp_swap | ( | botan_mp_t | x_w, |
botan_mp_t | y_w | ||
) |
Definition at line 511 of file ffi.cpp.
References BOTAN_FFI_DO, and Botan::BigInt::swap().
int botan_mp_to_bin | ( | const botan_mp_t | mp, |
uint8_t | vec[] | ||
) |
Definition at line 441 of file ffi.cpp.
References Botan::BigInt::binary_encode(), and BOTAN_FFI_DO.
int botan_mp_to_hex | ( | const botan_mp_t | mp, |
char * | out | ||
) |
Definition at line 415 of file ffi.cpp.
References BOTAN_FFI_DO, Botan::BigInt::encode(), and Botan::BigInt::Hexadecimal.
int botan_mp_to_str | ( | const botan_mp_t | mp, |
uint8_t | digit_base, | ||
char * | out, | ||
size_t * | out_len | ||
) |
Definition at line 424 of file ffi.cpp.
References BOTAN_FFI_DO, Botan::BigInt::Decimal, Botan::BigInt::encode(), and Botan::BigInt::Hexadecimal.
int botan_mp_to_uint32 | ( | const botan_mp_t | mp, |
uint32_t * | val | ||
) |
Definition at line 446 of file ffi.cpp.
References BOTAN_FFI_DO, BOTAN_FFI_ERROR_NULL_POINTER, and Botan::BigInt::to_u32bit().
int botan_pbkdf | ( | const char * | pbkdf_algo, |
uint8_t | out[], | ||
size_t | out_len, | ||
const char * | pass, | ||
const uint8_t | salt[], | ||
size_t | salt_len, | ||
size_t | iterations | ||
) |
Definition at line 992 of file ffi.cpp.
References BOTAN_CURRENT_FUNCTION, and Botan::get_pbkdf().
int botan_pbkdf_timed | ( | const char * | pbkdf_algo, |
uint8_t | out[], | ||
size_t | out_len, | ||
const char * | passphrase, | ||
const uint8_t | salt[], | ||
size_t | salt_len, | ||
size_t | milliseconds_to_run, | ||
size_t * | out_iterations_used | ||
) |
Derive a key from a passphrase, running until msec time has elapsed.
pbkdf_algo | PBKDF algorithm, e.g., "PBKDF2" |
out | buffer to store the derived key, must be of out_len bytes |
out_len | the desired length of the key to produce |
passphrase | the password to derive the key from |
salt | a randomly chosen salt |
salt_len | length of salt in bytes |
milliseconds_to_run | if iterations is zero, then instead the PBKDF is run until milliseconds_to_run milliseconds has passed |
out_iterations_used | set to the number iterations executed |
Definition at line 1010 of file ffi.cpp.
References BOTAN_CURRENT_FUNCTION, and Botan::get_pbkdf().
int botan_pk_op_decrypt | ( | botan_pk_op_decrypt_t | op, |
uint8_t | out[], | ||
size_t * | out_len, | ||
uint8_t | ciphertext[], | ||
size_t | ciphertext_len | ||
) |
int botan_pk_op_decrypt_create | ( | botan_pk_op_decrypt_t * | op, |
botan_privkey_t | key_obj, | ||
const char * | padding, | ||
uint32_t | flags | ||
) |
Definition at line 1857 of file ffi.cpp.
References BOTAN_ASSERT_NONNULL, BOTAN_CURRENT_FUNCTION, BOTAN_FFI_ERROR_BAD_FLAG, and Botan::system_rng().
int botan_pk_op_decrypt_destroy | ( | botan_pk_op_decrypt_t | op | ) |
int botan_pk_op_encrypt | ( | botan_pk_op_encrypt_t | op, |
botan_rng_t | rng_obj, | ||
uint8_t | out[], | ||
size_t * | out_len, | ||
const uint8_t | plaintext[], | ||
size_t | plaintext_len | ||
) |
int botan_pk_op_encrypt_create | ( | botan_pk_op_encrypt_t * | op, |
botan_pubkey_t | key_obj, | ||
const char * | padding, | ||
uint32_t | flags | ||
) |
Definition at line 1812 of file ffi.cpp.
References BOTAN_ASSERT_NONNULL, BOTAN_CURRENT_FUNCTION, BOTAN_FFI_ERROR_BAD_FLAG, and Botan::system_rng().
int botan_pk_op_encrypt_destroy | ( | botan_pk_op_encrypt_t | op | ) |
int botan_pk_op_key_agreement | ( | botan_pk_op_ka_t | op, |
uint8_t | out[], | ||
size_t * | out_len, | ||
const uint8_t | other_key[], | ||
size_t | other_key_len, | ||
const uint8_t | salt[], | ||
size_t | salt_len | ||
) |
Definition at line 2034 of file ffi.cpp.
References BOTAN_FFI_DO.
int botan_pk_op_key_agreement_create | ( | botan_pk_op_ka_t * | op, |
botan_privkey_t | key_obj, | ||
const char * | kdf, | ||
uint32_t | flags | ||
) |
Definition at line 1992 of file ffi.cpp.
References BOTAN_ASSERT_NONNULL, BOTAN_CURRENT_FUNCTION, BOTAN_FFI_ERROR_BAD_FLAG, and Botan::system_rng().
int botan_pk_op_key_agreement_destroy | ( | botan_pk_op_ka_t | op | ) |
int botan_pk_op_key_agreement_export_public | ( | botan_privkey_t | key, |
uint8_t | out[], | ||
size_t * | out_len | ||
) |
int botan_pk_op_sign_create | ( | botan_pk_op_sign_t * | op, |
botan_privkey_t | key_obj, | ||
const char * | hash, | ||
uint32_t | flags | ||
) |
Definition at line 1901 of file ffi.cpp.
References BOTAN_ASSERT_NONNULL, BOTAN_CURRENT_FUNCTION, BOTAN_FFI_ERROR_BAD_FLAG, BOTAN_FFI_ERROR_EXCEPTION_THROWN, and Botan::system_rng().
int botan_pk_op_sign_destroy | ( | botan_pk_op_sign_t | op | ) |
int botan_pk_op_sign_finish | ( | botan_pk_op_sign_t | op, |
botan_rng_t | rng_obj, | ||
uint8_t | out[], | ||
size_t * | out_len | ||
) |
int botan_pk_op_sign_update | ( | botan_pk_op_sign_t | op, |
const uint8_t | in[], | ||
size_t | in_len | ||
) |
int botan_pk_op_verify_create | ( | botan_pk_op_verify_t * | op, |
botan_pubkey_t | key_obj, | ||
const char * | hash, | ||
uint32_t | flags | ||
) |
Definition at line 1945 of file ffi.cpp.
References BOTAN_ASSERT_NONNULL, BOTAN_CURRENT_FUNCTION, and BOTAN_FFI_ERROR_BAD_FLAG.
int botan_pk_op_verify_destroy | ( | botan_pk_op_verify_t | op | ) |
int botan_pk_op_verify_finish | ( | botan_pk_op_verify_t | op, |
const uint8_t | sig[], | ||
size_t | sig_len | ||
) |
Definition at line 1980 of file ffi.cpp.
References BOTAN_FFI_DO.
int botan_pk_op_verify_update | ( | botan_pk_op_verify_t | op, |
const uint8_t | in[], | ||
size_t | in_len | ||
) |
int botan_privkey_check_key | ( | botan_privkey_t | key, |
botan_rng_t | rng, | ||
uint32_t | flags | ||
) |
Definition at line 1673 of file ffi.cpp.
References BOTAN_CHECK_KEY_EXPENSIVE_TESTS, and BOTAN_FFI_DO.
int botan_privkey_create | ( | botan_privkey_t * | key_obj, |
const char * | algo_name, | ||
const char * | algo_params, | ||
botan_rng_t | rng_obj | ||
) |
Definition at line 1113 of file ffi.cpp.
References BOTAN_CURRENT_FUNCTION, BOTAN_FFI_ERROR_EXCEPTION_THROWN, BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, and Botan::create_private_key().
int botan_privkey_create_ecdh | ( | botan_privkey_t * | key_obj, |
botan_rng_t | rng_obj, | ||
const char * | param_str | ||
) |
Definition at line 1235 of file ffi.cpp.
References BOTAN_CURRENT_FUNCTION, and BOTAN_FFI_ERROR_EXCEPTION_THROWN.
int botan_privkey_create_ecdsa | ( | botan_privkey_t * | key_obj, |
botan_rng_t | rng_obj, | ||
const char * | param_str | ||
) |
Definition at line 1183 of file ffi.cpp.
References BOTAN_CURRENT_FUNCTION, BOTAN_FFI_ERROR_EXCEPTION_THROWN, and BOTAN_FFI_ERROR_NOT_IMPLEMENTED.
int botan_privkey_create_mceliece | ( | botan_privkey_t * | key_obj, |
botan_rng_t | rng_obj, | ||
size_t | n, | ||
size_t | t | ||
) |
Definition at line 1210 of file ffi.cpp.
References BOTAN_CURRENT_FUNCTION, BOTAN_FFI_ERROR_EXCEPTION_THROWN, and BOTAN_FFI_ERROR_NOT_IMPLEMENTED.
int botan_privkey_create_rsa | ( | botan_privkey_t * | key_obj, |
botan_rng_t | rng_obj, | ||
size_t | n_bits | ||
) |
Definition at line 1154 of file ffi.cpp.
References BOTAN_CURRENT_FUNCTION, BOTAN_FFI_ERROR_EXCEPTION_THROWN, and BOTAN_FFI_ERROR_NOT_IMPLEMENTED.
int botan_privkey_destroy | ( | botan_privkey_t | key | ) |
int botan_privkey_dsa_get_x | ( | botan_mp_t | x, |
botan_privkey_t | key | ||
) |
Definition at line 1607 of file ffi.cpp.
References botan_privkey_get_field().
int botan_privkey_export | ( | botan_privkey_t | key, |
uint8_t | out[], | ||
size_t * | out_len, | ||
uint32_t | flags | ||
) |
Definition at line 1692 of file ffi.cpp.
References Botan::PKCS8::BER_encode(), BOTAN_FFI_DO, BOTAN_PRIVKEY_EXPORT_FLAG_DER, BOTAN_PRIVKEY_EXPORT_FLAG_PEM, and Botan::PKCS8::PEM_encode().
int botan_privkey_export_encrypted | ( | botan_privkey_t | key, |
uint8_t | out[], | ||
size_t * | out_len, | ||
botan_rng_t | rng_obj, | ||
const char * | pass, | ||
const char * | , | ||
uint32_t | flags | ||
) |
Definition at line 1704 of file ffi.cpp.
References botan_privkey_export_encrypted_pbkdf_iter().
int botan_privkey_export_encrypted_pbkdf_iter | ( | botan_privkey_t | key, |
uint8_t | out[], | ||
size_t * | out_len, | ||
botan_rng_t | rng_obj, | ||
const char * | pass, | ||
size_t | pbkdf_iter, | ||
const char * | maybe_cipher, | ||
const char * | maybe_pbkdf_hash, | ||
uint32_t | flags | ||
) |
Definition at line 1757 of file ffi.cpp.
References Botan::PKCS8::BER_encode_encrypted_pbkdf_iter(), BOTAN_FFI_DO, BOTAN_PRIVKEY_EXPORT_FLAG_DER, BOTAN_PRIVKEY_EXPORT_FLAG_PEM, and Botan::PKCS8::PEM_encode_encrypted_pbkdf_iter().
Referenced by botan_privkey_export_encrypted().
int botan_privkey_export_encrypted_pbkdf_msec | ( | botan_privkey_t | key, |
uint8_t | out[], | ||
size_t * | out_len, | ||
botan_rng_t | rng_obj, | ||
const char * | pass, | ||
uint32_t | pbkdf_msec, | ||
size_t * | pbkdf_iters_out, | ||
const char * | maybe_cipher, | ||
const char * | maybe_pbkdf_hash, | ||
uint32_t | flags | ||
) |
Definition at line 1714 of file ffi.cpp.
References Botan::PKCS8::BER_encode_encrypted_pbkdf_msec(), BOTAN_FFI_DO, BOTAN_PRIVKEY_EXPORT_FLAG_DER, BOTAN_PRIVKEY_EXPORT_FLAG_PEM, and Botan::PKCS8::PEM_encode_encrypted_pbkdf_msec().
int botan_privkey_export_pubkey | ( | botan_pubkey_t * | pubout, |
botan_privkey_t | key_obj | ||
) |
Definition at line 1642 of file ffi.cpp.
References Botan::X509::BER_encode(), BOTAN_CURRENT_FUNCTION, BOTAN_FFI_ERROR_EXCEPTION_THROWN, and Botan::X509::load_key().
int botan_privkey_get_field | ( | botan_mp_t | output, |
botan_privkey_t | key, | ||
const char * | field_name_cstr | ||
) |
Definition at line 1558 of file ffi.cpp.
References BOTAN_FFI_DO, and BOTAN_FFI_ERROR_NULL_POINTER.
Referenced by botan_privkey_dsa_get_x(), botan_privkey_rsa_get_d(), botan_privkey_rsa_get_e(), botan_privkey_rsa_get_n(), botan_privkey_rsa_get_p(), and botan_privkey_rsa_get_q().
int botan_privkey_load | ( | botan_privkey_t * | key, |
botan_rng_t | rng_obj, | ||
const uint8_t | bits[], | ||
size_t | len, | ||
const char * | password | ||
) |
Definition at line 1270 of file ffi.cpp.
References BOTAN_CURRENT_FUNCTION, and Botan::PKCS8::load_key().
int botan_privkey_load_dsa | ( | botan_privkey_t * | key, |
botan_mp_t | p, | ||
botan_mp_t | q, | ||
botan_mp_t | g, | ||
botan_mp_t | x | ||
) |
Definition at line 1371 of file ffi.cpp.
References BOTAN_CURRENT_FUNCTION, BOTAN_FFI_ERROR_NOT_IMPLEMENTED, and BOTAN_UNUSED.
int botan_privkey_load_rsa | ( | botan_privkey_t * | key, |
botan_mp_t | p, | ||
botan_mp_t | q, | ||
botan_mp_t | d | ||
) |
Definition at line 1326 of file ffi.cpp.
References BOTAN_CURRENT_FUNCTION, and BOTAN_FFI_ERROR_NOT_IMPLEMENTED.
int botan_privkey_rsa_get_d | ( | botan_mp_t | d, |
botan_privkey_t | key | ||
) |
Definition at line 1592 of file ffi.cpp.
References botan_privkey_get_field().
int botan_privkey_rsa_get_e | ( | botan_mp_t | e, |
botan_privkey_t | key | ||
) |
Definition at line 1587 of file ffi.cpp.
References botan_privkey_get_field().
int botan_privkey_rsa_get_n | ( | botan_mp_t | n, |
botan_privkey_t | key | ||
) |
Definition at line 1582 of file ffi.cpp.
References botan_privkey_get_field().
int botan_privkey_rsa_get_p | ( | botan_mp_t | p, |
botan_privkey_t | key | ||
) |
Definition at line 1572 of file ffi.cpp.
References botan_privkey_get_field().
int botan_privkey_rsa_get_q | ( | botan_mp_t | q, |
botan_privkey_t | key | ||
) |
Definition at line 1577 of file ffi.cpp.
References botan_privkey_get_field().
int botan_pubkey_algo_name | ( | botan_pubkey_t | key, |
char | out[], | ||
size_t * | out_len | ||
) |
Definition at line 1660 of file ffi.cpp.
References BOTAN_FFI_DO.
int botan_pubkey_check_key | ( | botan_pubkey_t | key, |
botan_rng_t | rng, | ||
uint32_t | flags | ||
) |
Returns 0 if key is valid, negative if invalid key or some other error
Definition at line 1665 of file ffi.cpp.
References BOTAN_CHECK_KEY_EXPENSIVE_TESTS, and BOTAN_FFI_DO.
int botan_pubkey_destroy | ( | botan_pubkey_t | key | ) |
int botan_pubkey_dsa_get_g | ( | botan_mp_t | g, |
botan_pubkey_t | key | ||
) |
Definition at line 1620 of file ffi.cpp.
References botan_pubkey_get_field().
int botan_pubkey_dsa_get_p | ( | botan_mp_t | p, |
botan_pubkey_t | key | ||
) |
Definition at line 1612 of file ffi.cpp.
References botan_pubkey_get_field().
int botan_pubkey_dsa_get_q | ( | botan_mp_t | q, |
botan_pubkey_t | key | ||
) |
Definition at line 1616 of file ffi.cpp.
References botan_pubkey_get_field().
int botan_pubkey_dsa_get_y | ( | botan_mp_t | y, |
botan_pubkey_t | key | ||
) |
Definition at line 1624 of file ffi.cpp.
References botan_pubkey_get_field().
int botan_pubkey_estimated_strength | ( | botan_pubkey_t | key, |
size_t * | estimate | ||
) |
Definition at line 1798 of file ffi.cpp.
References BOTAN_FFI_DO, and Botan::Public_Key::estimated_strength().
int botan_pubkey_export | ( | botan_pubkey_t | key, |
uint8_t | out[], | ||
size_t * | out_len, | ||
uint32_t | flags | ||
) |
Definition at line 1680 of file ffi.cpp.
References Botan::X509::BER_encode(), BOTAN_FFI_DO, BOTAN_PRIVKEY_EXPORT_FLAG_DER, BOTAN_PRIVKEY_EXPORT_FLAG_PEM, and Botan::X509::PEM_encode().
int botan_pubkey_fingerprint | ( | botan_pubkey_t | key, |
const char * | hash_fn, | ||
uint8_t | out[], | ||
size_t * | out_len | ||
) |
Definition at line 1803 of file ffi.cpp.
References BOTAN_FFI_DO, and Botan::HashFunction::create().
int botan_pubkey_get_field | ( | botan_mp_t | output, |
botan_pubkey_t | key, | ||
const char * | field_name_cstr | ||
) |
Definition at line 1544 of file ffi.cpp.
References BOTAN_FFI_DO, and BOTAN_FFI_ERROR_NULL_POINTER.
Referenced by botan_pubkey_dsa_get_g(), botan_pubkey_dsa_get_p(), botan_pubkey_dsa_get_q(), botan_pubkey_dsa_get_y(), botan_pubkey_rsa_get_e(), and botan_pubkey_rsa_get_n().
int botan_pubkey_load | ( | botan_pubkey_t * | key, |
const uint8_t | bits[], | ||
size_t | bits_len | ||
) |
Definition at line 1302 of file ffi.cpp.
References BOTAN_CURRENT_FUNCTION, and Botan::X509::load_key().
int botan_pubkey_load_dsa | ( | botan_pubkey_t * | key, |
botan_mp_t | p, | ||
botan_mp_t | q, | ||
botan_mp_t | g, | ||
botan_mp_t | y | ||
) |
Definition at line 1398 of file ffi.cpp.
References BOTAN_CURRENT_FUNCTION, BOTAN_FFI_ERROR_NOT_IMPLEMENTED, and BOTAN_UNUSED.
int botan_pubkey_load_rsa | ( | botan_pubkey_t * | key, |
botan_mp_t | n, | ||
botan_mp_t | e | ||
) |
Definition at line 1349 of file ffi.cpp.
References BOTAN_CURRENT_FUNCTION, and BOTAN_FFI_ERROR_NOT_IMPLEMENTED.
int botan_pubkey_rsa_get_e | ( | botan_mp_t | e, |
botan_pubkey_t | key | ||
) |
Definition at line 1597 of file ffi.cpp.
References botan_pubkey_get_field().
int botan_pubkey_rsa_get_n | ( | botan_mp_t | n, |
botan_pubkey_t | key | ||
) |
Definition at line 1602 of file ffi.cpp.
References botan_pubkey_get_field().
int botan_rng_destroy | ( | botan_rng_t | rng | ) |
int botan_rng_get | ( | botan_rng_t | rng, |
uint8_t * | out, | ||
size_t | out_len | ||
) |
Get random bytes from a random number generator
rng | rng object |
out | output buffer of size out_len |
out_len | number of requested bytes |
TODO: better name
Definition at line 331 of file ffi.cpp.
References BOTAN_FFI_DO, and Botan::RandomNumberGenerator::randomize().
int botan_rng_init | ( | botan_rng_t * | rng, |
const char * | rng_type | ||
) |
Initialize a random number generator object
rng | rng object |
rng_type | type of the rng, possible values: "system": System_RNG, "user": AutoSeeded_RNG Set rng_type to null or empty string to let the library choose |
TODO: replace rng_type with simple flags?
Definition at line 289 of file ffi.cpp.
References BOTAN_ASSERT_ARG_NON_NULL, and BOTAN_CURRENT_FUNCTION.
int botan_rng_reseed | ( | botan_rng_t | rng, |
size_t | bits | ||
) |
Reseed a random number generator Uses the System_RNG as a seed generator.
rng | rng object |
bits | number of bits to to reseed with |
Definition at line 336 of file ffi.cpp.
References BOTAN_FFI_DO, Botan::RandomNumberGenerator::reseed_from_rng(), and Botan::system_rng().
int botan_same_mem | ( | const uint8_t * | x, |
const uint8_t * | y, | ||
size_t | len | ||
) |
Returns 0 if x[0..len] == y[0..len], or otherwise -1
Definition at line 268 of file ffi.cpp.
References Botan::same_mem().
uint32_t botan_version_datestamp | ( | ) |
Return the date this version was released as an integer, or 0 if an unreleased version
Definition at line 266 of file ffi.cpp.
References Botan::version_datestamp().
uint32_t botan_version_major | ( | ) |
Return the major version of the library
Definition at line 263 of file ffi.cpp.
References Botan::version_major().
uint32_t botan_version_minor | ( | ) |
Return the minor version of the library
Definition at line 264 of file ffi.cpp.
References Botan::version_minor().
uint32_t botan_version_patch | ( | ) |
Return the patch version of the library
Definition at line 265 of file ffi.cpp.
References Botan::version_patch().
const char* botan_version_string | ( | ) |
Return a free-form version string, e.g., 2.0.0
Definition at line 258 of file ffi.cpp.
References Botan::version_cstr().
int botan_x509_cert_allowed_usage | ( | botan_x509_cert_t | cert, |
unsigned int | key_usage | ||
) |
int botan_x509_cert_destroy | ( | botan_x509_cert_t | cert | ) |
int botan_x509_cert_get_authority_key_id | ( | botan_x509_cert_t | cert, |
uint8_t | out[], | ||
size_t * | out_len | ||
) |
Definition at line 2132 of file ffi.cpp.
References BOTAN_FFI_DO.
int botan_x509_cert_get_fingerprint | ( | botan_x509_cert_t | cert, |
const char * | hash, | ||
uint8_t | out[], | ||
size_t * | out_len | ||
) |
Definition at line 2127 of file ffi.cpp.
References BOTAN_FFI_DO.
int botan_x509_cert_get_issuer_dn | ( | botan_x509_cert_t | cert, |
const char * | key, | ||
size_t | index, | ||
uint8_t | out[], | ||
size_t * | out_len | ||
) |
Definition at line 2179 of file ffi.cpp.
References BOTAN_FFI_DO.
int botan_x509_cert_get_public_key | ( | botan_x509_cert_t | cert, |
botan_pubkey_t * | key | ||
) |
Definition at line 2154 of file ffi.cpp.
References BOTAN_CURRENT_FUNCTION, BOTAN_FFI_ERROR_EXCEPTION_THROWN, and BOTAN_FFI_ERROR_NOT_IMPLEMENTED.
int botan_x509_cert_get_public_key_bits | ( | botan_x509_cert_t | cert, |
uint8_t | out[], | ||
size_t * | out_len | ||
) |
Definition at line 2142 of file ffi.cpp.
References BOTAN_FFI_DO.
int botan_x509_cert_get_serial_number | ( | botan_x509_cert_t | cert, |
uint8_t | out[], | ||
size_t * | out_len | ||
) |
Definition at line 2122 of file ffi.cpp.
References BOTAN_FFI_DO.
int botan_x509_cert_get_subject_dn | ( | botan_x509_cert_t | cert, |
const char * | key, | ||
size_t | index, | ||
uint8_t | out[], | ||
size_t * | out_len | ||
) |
Definition at line 2186 of file ffi.cpp.
References BOTAN_FFI_DO.
int botan_x509_cert_get_subject_key_id | ( | botan_x509_cert_t | cert, |
uint8_t | out[], | ||
size_t * | out_len | ||
) |
Definition at line 2137 of file ffi.cpp.
References BOTAN_FFI_DO.
int botan_x509_cert_get_time_expires | ( | botan_x509_cert_t | cert, |
char | out[], | ||
size_t * | out_len | ||
) |
Definition at line 2117 of file ffi.cpp.
References BOTAN_FFI_DO.
int botan_x509_cert_get_time_starts | ( | botan_x509_cert_t | cert, |
char | out[], | ||
size_t * | out_len | ||
) |
Definition at line 2112 of file ffi.cpp.
References BOTAN_FFI_DO.
int botan_x509_cert_load | ( | botan_x509_cert_t * | cert_obj, |
const uint8_t | cert_bits[], | ||
size_t | cert_bits_len | ||
) |
Definition at line 2076 of file ffi.cpp.
References BOTAN_CURRENT_FUNCTION.
int botan_x509_cert_load_file | ( | botan_x509_cert_t * | cert_obj, |
const char * | cert_path | ||
) |
Definition at line 2045 of file ffi.cpp.
References BOTAN_CURRENT_FUNCTION, and BOTAN_FFI_ERROR_NOT_IMPLEMENTED.
int botan_x509_cert_to_string | ( | botan_x509_cert_t | cert, |
char | out[], | ||
size_t * | out_len | ||
) |
Definition at line 2193 of file ffi.cpp.
References BOTAN_FFI_DO.