59#include <botan/build.h>
66#define BOTAN_FFI_EXPORT(maj, min) BOTAN_DLL
68#if !defined(BOTAN_NO_DEPRECATED_WARNINGS)
69 #if defined(__has_attribute)
70 #if __has_attribute(deprecated)
71 #define BOTAN_FFI_DEPRECATED(msg) __attribute__((deprecated(msg)))
73 #elif defined(_MSC_VER)
74 #define BOTAN_FFI_DEPRECATED(msg) __declspec(deprecated(msg))
78#if !defined(BOTAN_FFI_DEPRECATED)
79 #define BOTAN_FFI_DEPRECATED(msg)
211#define BOTAN_FFI_HEX_LOWER_CASE 1
271 const
char* rng_name,
273 int (*get_cb)(
void* context, uint8_t* out,
size_t out_len),
274 int (*add_entropy_cb)(
void* context, const uint8_t input[],
size_t length),
275 void (*destroy_cb)(
void* context));
496 size_t* out_minimum_keylength,
497 size_t* out_maximum_keylength,
498 size_t* out_keylength_modulo);
512#define BOTAN_CIPHER_INIT_FLAG_MASK_DIRECTION 1
513#define BOTAN_CIPHER_INIT_FLAG_ENCRYPT 0
514#define BOTAN_CIPHER_INIT_FLAG_DECRYPT 1
595#define BOTAN_CIPHER_UPDATE_FLAG_FINAL (1U << 0)
605 size_t* output_written,
606 const uint8_t input_bytes[],
608 size_t* input_consumed);
641 const
char* passphrase,
642 const uint8_t salt[],
674 const
char* passphrase,
675 const uint8_t salt[],
677 size_t milliseconds_to_run,
678 size_t* out_iterations_used);
701 const
char* passphrase,
702 size_t passphrase_len,
703 const uint8_t salt[],
729 const
char* passphrase,
730 size_t passphrase_len,
731 const uint8_t salt[],
743 const
char* passphrase,
744 const uint8_t salt[],
767 const uint8_t secret[],
769 const uint8_t salt[],
771 const uint8_t label[],
836 size_t* out_minimum_keylength,
837 size_t* out_maximum_keylength,
838 size_t* out_keylength_modulo);
1028 uint8_t* out,
size_t* out_len, const
char* password,
botan_rng_t rng,
size_t work_factor, uint32_t flags);
1056#define BOTAN_CHECK_KEY_EXPENSIVE_TESTS 1
1126#define BOTAN_PRIVKEY_EXPORT_FLAG_DER 0
1127#define BOTAN_PRIVKEY_EXPORT_FLAG_PEM 1
1154BOTAN_FFI_EXPORT(2, 0)
1155int botan_privkey_export_encrypted(botan_privkey_t key,
1159 const char* passphrase,
1160 const char* encryption_algo,
1164* Export a private key, running PBKDF for specified amount of time
1165* @param key the private key to export
1167* Note: starting in 3.0, the output iterations count is not provided
1169BOTAN_FFI_EXPORT(2, 0)
1170int botan_privkey_export_encrypted_pbkdf_msec(botan_privkey_t key,
1174 const char* passphrase,
1175 uint32_t pbkdf_msec_runtime,
1176 size_t* pbkdf_iterations_out,
1177 const char* cipher_algo,
1178 const char* pbkdf_algo,
1184BOTAN_FFI_EXPORT(2, 0)
1185int botan_privkey_export_encrypted_pbkdf_iter(botan_privkey_t key,
1189 const char* passphrase,
1190 size_t pbkdf_iterations,
1191 const char* cipher_algo,
1192 const char* pbkdf_algo,
1201BOTAN_FFI_EXPORT(3, 0)
1202int botan_privkey_view_encrypted_der(botan_privkey_t key,
1204 const char* passphrase,
1205 const char* cipher_algo,
1206 const char* pbkdf_algo,
1207 size_t pbkdf_iterations,
1209 botan_view_bin_fn view);
1216BOTAN_FFI_EXPORT(3, 0)
1217int botan_privkey_view_encrypted_der_timed(botan_privkey_t key,
1219 const char* passphrase,
1220 const char* cipher_algo,
1221 const char* pbkdf_algo,
1222 size_t pbkdf_runtime_msec,
1224 botan_view_bin_fn view);
1232BOTAN_FFI_EXPORT(3, 0)
1233int botan_privkey_view_encrypted_pem(botan_privkey_t key,
1235 const char* passphrase,
1236 const char* cipher_algo,
1237 const char* pbkdf_algo,
1238 size_t pbkdf_iterations,
1240 botan_view_str_fn view);
1247BOTAN_FFI_EXPORT(3, 0)
1248int botan_privkey_view_encrypted_pem_timed(botan_privkey_t key,
1250 const char* passphrase,
1251 const char* cipher_algo,
1252 const char* pbkdf_algo,
1253 size_t pbkdf_runtime_msec,
1255 botan_view_str_fn view);
1257typedef struct botan_pubkey_struct* botan_pubkey_t;
1259BOTAN_FFI_EXPORT(2, 0) int botan_pubkey_load(botan_pubkey_t* key, const uint8_t bits[], size_t len);
1261BOTAN_FFI_EXPORT(2, 0) int botan_privkey_export_pubkey(botan_pubkey_t* out, botan_privkey_t in);
1263BOTAN_FFI_EXPORT(2, 0) int botan_pubkey_export(botan_pubkey_t key, uint8_t out[], size_t* out_len, uint32_t flags);
1268BOTAN_FFI_EXPORT(3, 0) int botan_pubkey_view_der(botan_pubkey_t key, botan_view_ctx ctx, botan_view_bin_fn view);
1273BOTAN_FFI_EXPORT(3, 0) int botan_pubkey_view_pem(botan_pubkey_t key, botan_view_ctx ctx, botan_view_str_fn view);
1275BOTAN_FFI_EXPORT(2, 0) int botan_pubkey_algo_name(botan_pubkey_t key, char out[], size_t* out_len);
1280BOTAN_FFI_EXPORT(2, 0) int botan_pubkey_check_key(botan_pubkey_t key, botan_rng_t rng, uint32_t flags);
1282BOTAN_FFI_EXPORT(2, 0) int botan_pubkey_estimated_strength(botan_pubkey_t key, size_t* estimate);
1284BOTAN_FFI_EXPORT(2, 0)
1285int botan_pubkey_fingerprint(botan_pubkey_t key, const char* hash, uint8_t out[], size_t* out_len);
1290BOTAN_FFI_EXPORT(2, 0) int botan_pubkey_destroy(botan_pubkey_t key);
1293* Get arbitrary named fields from public or private keys
1295BOTAN_FFI_EXPORT(2, 0) int botan_pubkey_get_field(botan_mp_t output, botan_pubkey_t key, const char* field_name);
1297BOTAN_FFI_EXPORT(2, 0) int botan_privkey_get_field(botan_mp_t output, botan_privkey_t key, const char* field_name);
1300* Algorithm specific key operations: RSA
1302BOTAN_FFI_EXPORT(2, 0) int botan_privkey_load_rsa(botan_privkey_t* key, botan_mp_t p, botan_mp_t q, botan_mp_t e);
1304BOTAN_FFI_EXPORT(2, 8) int botan_privkey_load_rsa_pkcs1(botan_privkey_t* key, const uint8_t bits[], size_t len);
1307BOTAN_FFI_EXPORT(2, 0) int botan_privkey_rsa_get_p(botan_mp_t p, botan_privkey_t rsa_key);
1309BOTAN_FFI_EXPORT(2, 0) int botan_privkey_rsa_get_q(botan_mp_t q, botan_privkey_t rsa_key);
1311BOTAN_FFI_EXPORT(2, 0) int botan_privkey_rsa_get_d(botan_mp_t d, botan_privkey_t rsa_key);
1313BOTAN_FFI_EXPORT(2, 0) int botan_privkey_rsa_get_n(botan_mp_t n, botan_privkey_t rsa_key);
1315BOTAN_FFI_EXPORT(2, 0) int botan_privkey_rsa_get_e(botan_mp_t e, botan_privkey_t rsa_key);
1317BOTAN_FFI_EXPORT(2, 8)
1318int botan_privkey_rsa_get_privkey(botan_privkey_t rsa_key, uint8_t out[], size_t* out_len, uint32_t flags);
1320BOTAN_FFI_EXPORT(2, 0) int botan_pubkey_load_rsa(botan_pubkey_t* key, botan_mp_t n, botan_mp_t e);
1323BOTAN_FFI_EXPORT(2, 0) int botan_pubkey_rsa_get_e(botan_mp_t e, botan_pubkey_t rsa_key);
1325BOTAN_FFI_EXPORT(2, 0) int botan_pubkey_rsa_get_n(botan_mp_t n, botan_pubkey_t rsa_key);
1328* Algorithm specific key operations: DSA
1330BOTAN_FFI_EXPORT(2, 0)
1331int botan_privkey_load_dsa(botan_privkey_t* key, botan_mp_t p, botan_mp_t q, botan_mp_t g, botan_mp_t x);
1333BOTAN_FFI_EXPORT(2, 0)
1334int botan_pubkey_load_dsa(botan_pubkey_t* key, botan_mp_t p, botan_mp_t q, botan_mp_t g, botan_mp_t y);
1337BOTAN_FFI_EXPORT(2, 0) int botan_privkey_dsa_get_x(botan_mp_t n, botan_privkey_t key);
1340BOTAN_FFI_EXPORT(2, 0) int botan_pubkey_dsa_get_p(botan_mp_t p, botan_pubkey_t key);
1342BOTAN_FFI_EXPORT(2, 0) int botan_pubkey_dsa_get_q(botan_mp_t q, botan_pubkey_t key);
1344BOTAN_FFI_EXPORT(2, 0) int botan_pubkey_dsa_get_g(botan_mp_t d, botan_pubkey_t key);
1346BOTAN_FFI_EXPORT(2, 0) int botan_pubkey_dsa_get_y(botan_mp_t y, botan_pubkey_t key);
1349* Loads Diffie Hellman private key
1351* @param key variable populated with key material
1352* @param p prime order of a Z_p group
1353* @param g group generator
1354* @param x private key
1356* @pre key is NULL on input
1357* @post function allocates memory and assigns to `key'
1359* @return 0 on success, a negative value on failure
1361BOTAN_FFI_EXPORT(2, 0) int botan_privkey_load_dh(botan_privkey_t* key, botan_mp_t p, botan_mp_t g, botan_mp_t x);
1375BOTAN_FFI_EXPORT(2, 0) int botan_pubkey_load_dh(botan_pubkey_t* key, botan_mp_t p, botan_mp_t g, botan_mp_t y);
1378* Algorithm specific key operations: ElGamal
1393BOTAN_FFI_EXPORT(2, 0) int botan_pubkey_load_elgamal(botan_pubkey_t* key, botan_mp_t p, botan_mp_t g, botan_mp_t y);
1408BOTAN_FFI_EXPORT(2, 0) int botan_privkey_load_elgamal(botan_privkey_t* key, botan_mp_t p, botan_mp_t g, botan_mp_t x);
1411* Algorithm specific key operations: Ed25519
1414BOTAN_FFI_EXPORT(2, 2) int botan_privkey_load_ed25519(botan_privkey_t* key, const uint8_t privkey[32]);
1416BOTAN_FFI_EXPORT(2, 2) int botan_pubkey_load_ed25519(botan_pubkey_t* key, const uint8_t pubkey[32]);
1418BOTAN_FFI_EXPORT(2, 2) int botan_privkey_ed25519_get_privkey(botan_privkey_t key, uint8_t output[64]);
1420BOTAN_FFI_EXPORT(2, 2) int botan_pubkey_ed25519_get_pubkey(botan_pubkey_t key, uint8_t pubkey[32]);
1423* Algorithm specific key operations: X25519
1426BOTAN_FFI_EXPORT(2, 8) int botan_privkey_load_x25519(botan_privkey_t* key, const uint8_t privkey[32]);
1428BOTAN_FFI_EXPORT(2, 8) int botan_pubkey_load_x25519(botan_pubkey_t* key, const uint8_t pubkey[32]);
1430BOTAN_FFI_EXPORT(2, 8) int botan_privkey_x25519_get_privkey(botan_privkey_t key, uint8_t output[32]);
1432BOTAN_FFI_EXPORT(2, 8) int botan_pubkey_x25519_get_pubkey(botan_pubkey_t key, uint8_t pubkey[32]);
1435* Algorithm specific key operations: Kyber
1438BOTAN_FFI_EXPORT(3, 1) int botan_privkey_load_kyber(botan_privkey_t* key, const uint8_t privkey[], size_t key_len);
1440BOTAN_FFI_EXPORT(3, 1) int botan_pubkey_load_kyber(botan_pubkey_t* key, const uint8_t pubkey[], size_t key_len);
1442BOTAN_FFI_EXPORT(3, 1)
1443int botan_privkey_view_kyber_raw_key(botan_privkey_t key, botan_view_ctx ctx, botan_view_bin_fn view);
1445BOTAN_FFI_EXPORT(3, 1)
1446int botan_pubkey_view_kyber_raw_key(botan_pubkey_t key, botan_view_ctx ctx, botan_view_bin_fn view);
1449* Algorithm specific key operations: ECDSA and ECDH
1451BOTAN_FFI_EXPORT(2, 2)
1452int botan_privkey_load_ecdsa(botan_privkey_t* key, const botan_mp_t scalar, const char* curve_name);
1454BOTAN_FFI_EXPORT(2, 2)
1455int botan_pubkey_load_ecdsa(botan_pubkey_t* key,
1456 const botan_mp_t public_x,
1457 const botan_mp_t public_y,
1458 const char* curve_name);
1460BOTAN_FFI_EXPORT(2, 2)
1461int botan_pubkey_load_ecdh(botan_pubkey_t* key,
1462 const botan_mp_t public_x,
1463 const botan_mp_t public_y,
1464 const char* curve_name);
1466BOTAN_FFI_EXPORT(2, 2)
1467int botan_privkey_load_ecdh(botan_privkey_t* key, const botan_mp_t scalar, const char* curve_name);
1469BOTAN_FFI_EXPORT(2, 2)
1470int botan_pubkey_load_sm2(botan_pubkey_t* key,
1471 const botan_mp_t public_x,
1472 const botan_mp_t public_y,
1473 const char* curve_name);
1475BOTAN_FFI_EXPORT(2, 2)
1476int botan_privkey_load_sm2(botan_privkey_t* key, const botan_mp_t scalar, const char* curve_name);
1479BOTAN_FFI_EXPORT(2, 2)
1480int botan_pubkey_load_sm2_enc(botan_pubkey_t* key,
1481 const botan_mp_t public_x,
1482 const botan_mp_t public_y,
1483 const char* curve_name);
1486BOTAN_FFI_EXPORT(2, 2)
1487int botan_privkey_load_sm2_enc(botan_privkey_t* key, const botan_mp_t scalar, const char* curve_name);
1489BOTAN_FFI_EXPORT(2, 3)
1490int botan_pubkey_sm2_compute_za(
1491 uint8_t out[], size_t* out_len, const char* ident, const char* hash_algo, const botan_pubkey_t key);
1496BOTAN_FFI_EXPORT(3, 0)
1497int botan_pubkey_view_ec_public_point(const botan_pubkey_t key, botan_view_ctx ctx, botan_view_bin_fn view);
1500* Public Key Encryption
1502typedef struct botan_pk_op_encrypt_struct* botan_pk_op_encrypt_t;
1504BOTAN_FFI_EXPORT(2, 0)
1505int botan_pk_op_encrypt_create(botan_pk_op_encrypt_t* op, botan_pubkey_t key, const char* padding, uint32_t flags);
1510BOTAN_FFI_EXPORT(2, 0) int botan_pk_op_encrypt_destroy(botan_pk_op_encrypt_t op);
1512BOTAN_FFI_EXPORT(2, 8)
1513int botan_pk_op_encrypt_output_length(botan_pk_op_encrypt_t op, size_t ptext_len, size_t* ctext_len);
1515BOTAN_FFI_EXPORT(2, 0)
1516int botan_pk_op_encrypt(botan_pk_op_encrypt_t op,
1520 const uint8_t plaintext[],
1521 size_t plaintext_len);
1524* Public Key Decryption
1526typedef struct botan_pk_op_decrypt_struct* botan_pk_op_decrypt_t;
1528BOTAN_FFI_EXPORT(2, 0)
1529int botan_pk_op_decrypt_create(botan_pk_op_decrypt_t* op, botan_privkey_t key, const char* padding, uint32_t flags);
1534BOTAN_FFI_EXPORT(2, 0) int botan_pk_op_decrypt_destroy(botan_pk_op_decrypt_t op);
1536BOTAN_FFI_EXPORT(2, 8)
1537int botan_pk_op_decrypt_output_length(botan_pk_op_decrypt_t op, size_t ctext_len, size_t* ptext_len);
1539BOTAN_FFI_EXPORT(2, 0)
1540int botan_pk_op_decrypt(
1541 botan_pk_op_decrypt_t op, uint8_t out[], size_t* out_len, const uint8_t ciphertext[], size_t ciphertext_len);
1544* Signature Generation
1547#define BOTAN_PUBKEY_DER_FORMAT_SIGNATURE 1
1549typedef struct botan_pk_op_sign_struct* botan_pk_op_sign_t;
1551BOTAN_FFI_EXPORT(2, 0)
1552int botan_pk_op_sign_create(botan_pk_op_sign_t* op, botan_privkey_t key, const char* hash_and_padding, uint32_t flags);
1557BOTAN_FFI_EXPORT(2, 0) int botan_pk_op_sign_destroy(botan_pk_op_sign_t op);
1559BOTAN_FFI_EXPORT(2, 8) int botan_pk_op_sign_output_length(botan_pk_op_sign_t op, size_t* olen);
1561BOTAN_FFI_EXPORT(2, 0) int botan_pk_op_sign_update(botan_pk_op_sign_t op, const uint8_t in[], size_t in_len);
1563BOTAN_FFI_EXPORT(2, 0)
1564int botan_pk_op_sign_finish(botan_pk_op_sign_t op, botan_rng_t rng, uint8_t sig[], size_t* sig_len);
1567* Signature Verification
1569typedef struct botan_pk_op_verify_struct* botan_pk_op_verify_t;
1571BOTAN_FFI_EXPORT(2, 0)
1572int botan_pk_op_verify_create(botan_pk_op_verify_t* op,
1574 const char* hash_and_padding,
1580BOTAN_FFI_EXPORT(2, 0) int botan_pk_op_verify_destroy(botan_pk_op_verify_t op);
1582BOTAN_FFI_EXPORT(2, 0) int botan_pk_op_verify_update(botan_pk_op_verify_t op, const uint8_t in[], size_t in_len);
1583BOTAN_FFI_EXPORT(2, 0) int botan_pk_op_verify_finish(botan_pk_op_verify_t op, const uint8_t sig[], size_t sig_len);
1588typedef struct botan_pk_op_ka_struct* botan_pk_op_ka_t;
1590BOTAN_FFI_EXPORT(2, 0)
1591int botan_pk_op_key_agreement_create(botan_pk_op_ka_t* op, botan_privkey_t key, const char* kdf, uint32_t flags);
1596BOTAN_FFI_EXPORT(2, 0) int botan_pk_op_key_agreement_destroy(botan_pk_op_ka_t op);
1598BOTAN_FFI_EXPORT(2, 0) int botan_pk_op_key_agreement_export_public(botan_privkey_t key, uint8_t out[], size_t* out_len);
1600BOTAN_FFI_EXPORT(3, 0)
1601int botan_pk_op_key_agreement_view_public(botan_privkey_t key, botan_view_ctx ctx, botan_view_bin_fn view);
1603BOTAN_FFI_EXPORT(2, 8) int botan_pk_op_key_agreement_size(botan_pk_op_ka_t op, size_t* out_len);
1605BOTAN_FFI_EXPORT(2, 0)
1606int botan_pk_op_key_agreement(botan_pk_op_ka_t op,
1609 const uint8_t other_key[],
1610 size_t other_key_len,
1611 const uint8_t salt[],
1617typedef struct botan_pk_op_kem_encrypt_struct* botan_pk_op_kem_encrypt_t;
1619BOTAN_FFI_EXPORT(3, 0)
1620int botan_pk_op_kem_encrypt_create(botan_pk_op_kem_encrypt_t* op, botan_pubkey_t key, const char* kdf);
1625BOTAN_FFI_EXPORT(3, 0) int botan_pk_op_kem_encrypt_destroy(botan_pk_op_kem_encrypt_t op);
1627BOTAN_FFI_EXPORT(3, 0)
1628int botan_pk_op_kem_encrypt_shared_key_length(botan_pk_op_kem_encrypt_t op,
1629 size_t desired_shared_key_length,
1630 size_t* output_shared_key_length);
1632BOTAN_FFI_EXPORT(3, 0)
1633int botan_pk_op_kem_encrypt_encapsulated_key_length(botan_pk_op_kem_encrypt_t op,
1634 size_t* output_encapsulated_key_length);
1636BOTAN_FFI_EXPORT(3, 0)
1637int botan_pk_op_kem_encrypt_create_shared_key(botan_pk_op_kem_encrypt_t op,
1639 const uint8_t salt[],
1641 size_t desired_shared_key_len,
1642 uint8_t shared_key[],
1643 size_t* shared_key_len,
1644 uint8_t encapsulated_key[],
1645 size_t* encapsulated_key_len);
1647typedef struct botan_pk_op_kem_decrypt_struct* botan_pk_op_kem_decrypt_t;
1649BOTAN_FFI_EXPORT(3, 0)
1650int botan_pk_op_kem_decrypt_create(botan_pk_op_kem_decrypt_t* op, botan_privkey_t key, const char* kdf);
1655BOTAN_FFI_EXPORT(3, 0) int botan_pk_op_kem_decrypt_destroy(botan_pk_op_kem_decrypt_t op);
1657BOTAN_FFI_EXPORT(3, 0)
1658int botan_pk_op_kem_decrypt_shared_key_length(botan_pk_op_kem_decrypt_t op,
1659 size_t desired_shared_key_length,
1660 size_t* output_shared_key_length);
1662BOTAN_FFI_EXPORT(3, 0)
1663int botan_pk_op_kem_decrypt_shared_key(botan_pk_op_kem_decrypt_t op,
1664 const uint8_t salt[],
1666 const uint8_t encapsulated_key[],
1667 size_t encapsulated_key_len,
1668 size_t desired_shared_key_len,
1669 uint8_t shared_key[],
1670 size_t* shared_key_len);
1676BOTAN_FFI_EXPORT(2, 0) int botan_pkcs_hash_id(const char* hash_name, uint8_t pkcs_id[], size_t* pkcs_id_len);
1679* Always returns BOTAN_FFI_ERROR_NOT_IMPLEMENTED
1681BOTAN_FFI_DEPRECATED("No longer implemented
")
1682BOTAN_FFI_EXPORT(2, 0)
1683int botan_mceies_encrypt(botan_pubkey_t mce_key,
1694* Always returns BOTAN_FFI_ERROR_NOT_IMPLEMENTED
1696BOTAN_FFI_DEPRECATED("No longer implemented
")
1697BOTAN_FFI_EXPORT(2, 0)
1698int botan_mceies_decrypt(botan_privkey_t mce_key,
1709**************************/
1711typedef struct botan_x509_cert_struct* botan_x509_cert_t;
1713BOTAN_FFI_EXPORT(2, 0) int botan_x509_cert_load(botan_x509_cert_t* cert_obj, const uint8_t cert[], size_t cert_len);
1714BOTAN_FFI_EXPORT(2, 0) int botan_x509_cert_load_file(botan_x509_cert_t* cert_obj, const char* filename);
1719BOTAN_FFI_EXPORT(2, 0) int botan_x509_cert_destroy(botan_x509_cert_t cert);
1721BOTAN_FFI_EXPORT(2, 8) int botan_x509_cert_dup(botan_x509_cert_t* new_cert, botan_x509_cert_t cert);
1723/* Prefer botan_x509_cert_not_before and botan_x509_cert_not_after */
1724BOTAN_FFI_EXPORT(2, 0) int botan_x509_cert_get_time_starts(botan_x509_cert_t cert, char out[], size_t* out_len);
1725BOTAN_FFI_EXPORT(2, 0) int botan_x509_cert_get_time_expires(botan_x509_cert_t cert, char out[], size_t* out_len);
1727BOTAN_FFI_EXPORT(2, 8) int botan_x509_cert_not_before(botan_x509_cert_t cert, uint64_t* time_since_epoch);
1728BOTAN_FFI_EXPORT(2, 8) int botan_x509_cert_not_after(botan_x509_cert_t cert, uint64_t* time_since_epoch);
1730BOTAN_FFI_EXPORT(2, 0)
1731int botan_x509_cert_get_fingerprint(botan_x509_cert_t cert, const char* hash, uint8_t out[], size_t* out_len);
1733BOTAN_FFI_EXPORT(2, 0) int botan_x509_cert_get_serial_number(botan_x509_cert_t cert, uint8_t out[], size_t* out_len);
1734BOTAN_FFI_EXPORT(2, 0) int botan_x509_cert_get_authority_key_id(botan_x509_cert_t cert, uint8_t out[], size_t* out_len);
1735BOTAN_FFI_EXPORT(2, 0) int botan_x509_cert_get_subject_key_id(botan_x509_cert_t cert, uint8_t out[], size_t* out_len);
1737BOTAN_FFI_EXPORT(2, 0) int botan_x509_cert_get_public_key_bits(botan_x509_cert_t cert, uint8_t out[], size_t* out_len);
1739BOTAN_FFI_EXPORT(3, 0)
1740int botan_x509_cert_view_public_key_bits(botan_x509_cert_t cert, botan_view_ctx ctx, botan_view_bin_fn view);
1742BOTAN_FFI_EXPORT(2, 0) int botan_x509_cert_get_public_key(botan_x509_cert_t cert, botan_pubkey_t* key);
1744BOTAN_FFI_EXPORT(2, 0)
1745int botan_x509_cert_get_issuer_dn(
1746 botan_x509_cert_t cert, const char* key, size_t index, uint8_t out[], size_t* out_len);
1748BOTAN_FFI_EXPORT(2, 0)
1749int botan_x509_cert_get_subject_dn(
1750 botan_x509_cert_t cert, const char* key, size_t index, uint8_t out[], size_t* out_len);
1752BOTAN_FFI_EXPORT(2, 0) int botan_x509_cert_to_string(botan_x509_cert_t cert, char out[], size_t* out_len);
1754BOTAN_FFI_EXPORT(3, 0)
1755int botan_x509_cert_view_as_string(botan_x509_cert_t cert, botan_view_ctx ctx, botan_view_str_fn view);
1757/* Must match values of Key_Constraints in key_constraints.h */
1758enum botan_x509_cert_key_constraints {
1760 DIGITAL_SIGNATURE = 32768,
1761 NON_REPUDIATION = 16384,
1762 KEY_ENCIPHERMENT = 8192,
1763 DATA_ENCIPHERMENT = 4096,
1764 KEY_AGREEMENT = 2048,
1765 KEY_CERT_SIGN = 1024,
1767 ENCIPHER_ONLY = 256,
1771BOTAN_FFI_EXPORT(2, 0) int botan_x509_cert_allowed_usage(botan_x509_cert_t cert, unsigned int key_usage);
1777BOTAN_FFI_EXPORT(2, 5) int botan_x509_cert_hostname_match(botan_x509_cert_t cert, const char* hostname);
1787BOTAN_FFI_EXPORT(2, 8)
1788int botan_x509_cert_verify(int* validation_result,
1789 botan_x509_cert_t cert,
1790 const botan_x509_cert_t* intermediates,
1791 size_t intermediates_len,
1792 const botan_x509_cert_t* trusted,
1794 const char* trusted_path,
1795 size_t required_strength,
1796 const char* hostname,
1797 uint64_t reference_time);
1803BOTAN_FFI_EXPORT(2, 8) const char* botan_x509_cert_validation_status(int code);
1807**************************/
1809typedef struct botan_x509_crl_struct* botan_x509_crl_t;
1811BOTAN_FFI_EXPORT(2, 13) int botan_x509_crl_load_file(botan_x509_crl_t* crl_obj, const char* crl_path);
1812BOTAN_FFI_EXPORT(2, 13)
1813int botan_x509_crl_load(botan_x509_crl_t* crl_obj, const uint8_t crl_bits[], size_t crl_bits_len);
1815BOTAN_FFI_EXPORT(2, 13) int botan_x509_crl_destroy(botan_x509_crl_t crl);
1821BOTAN_FFI_EXPORT(2, 13) int botan_x509_is_revoked(botan_x509_crl_t crl, botan_x509_cert_t cert);
1827BOTAN_FFI_EXPORT(2, 13)
1828int botan_x509_cert_verify_with_crl(int* validation_result,
1829 botan_x509_cert_t cert,
1830 const botan_x509_cert_t* intermediates,
1831 size_t intermediates_len,
1832 const botan_x509_cert_t* trusted,
1834 const botan_x509_crl_t* crls,
1836 const char* trusted_path,
1837 size_t required_strength,
1838 const char* hostname,
1839 uint64_t reference_time);
1845BOTAN_FFI_EXPORT(2, 2)
1846int botan_key_wrap3394(const uint8_t key[],
1848 const uint8_t kek[],
1850 uint8_t wrapped_key[],
1851 size_t* wrapped_key_len);
1854BOTAN_FFI_EXPORT(2, 2)
1855int botan_key_unwrap3394(const uint8_t wrapped_key[],
1856 size_t wrapped_key_len,
1857 const uint8_t kek[],
1862BOTAN_FFI_EXPORT(3, 0)
1863int botan_nist_kw_enc(const char* cipher_algo,
1865 const uint8_t key[],
1867 const uint8_t kek[],
1869 uint8_t wrapped_key[],
1870 size_t* wrapped_key_len);
1872BOTAN_FFI_EXPORT(3, 0)
1873int botan_nist_kw_dec(const char* cipher_algo,
1875 const uint8_t wrapped_key[],
1876 size_t wrapped_key_len,
1877 const uint8_t kek[],
1886typedef struct botan_hotp_struct* botan_hotp_t;
1891BOTAN_FFI_EXPORT(2, 8)
1892int botan_hotp_init(botan_hotp_t* hotp, const uint8_t key[], size_t key_len, const char* hash_algo, size_t digits);
1898BOTAN_FFI_EXPORT(2, 8)
1899int botan_hotp_destroy(botan_hotp_t hotp);
1904BOTAN_FFI_EXPORT(2, 8)
1905int botan_hotp_generate(botan_hotp_t hotp, uint32_t* hotp_code, uint64_t hotp_counter);
1910BOTAN_FFI_EXPORT(2, 8)
1911int botan_hotp_check(
1912 botan_hotp_t hotp, uint64_t* next_hotp_counter, uint32_t hotp_code, uint64_t hotp_counter, size_t resync_range);
1918typedef struct botan_totp_struct* botan_totp_t;
1923BOTAN_FFI_EXPORT(2, 8)
1925 botan_totp_t* totp, const uint8_t key[], size_t key_len, const char* hash_algo, size_t digits, size_t time_step);
1931BOTAN_FFI_EXPORT(2, 8)
1932int botan_totp_destroy(botan_totp_t totp);
1940BOTAN_FFI_EXPORT(2, 8)
1941int botan_totp_generate(botan_totp_t totp, uint32_t* totp_code, uint64_t timestamp);
1951BOTAN_FFI_EXPORT(2, 8)
1952int botan_totp_check(botan_totp_t totp, uint32_t totp_code, uint64_t timestamp, size_t acceptable_clock_drift);
1958typedef struct botan_fpe_struct* botan_fpe_t;
1960#define BOTAN_FPE_FLAG_FE1_COMPAT_MODE 1
1962BOTAN_FFI_EXPORT(2, 8)
1963int botan_fpe_fe1_init(
1964 botan_fpe_t* fpe, botan_mp_t n, const uint8_t key[], size_t key_len, size_t rounds, uint32_t flags);
1969BOTAN_FFI_EXPORT(2, 8)
1970int botan_fpe_destroy(botan_fpe_t fpe);
1972BOTAN_FFI_EXPORT(2, 8)
1973int botan_fpe_encrypt(botan_fpe_t fpe, botan_mp_t x, const uint8_t tweak[], size_t tweak_len);
1975BOTAN_FFI_EXPORT(2, 8)
1976int botan_fpe_decrypt(botan_fpe_t fpe, botan_mp_t x, const uint8_t tweak[], size_t tweak_len);
1981typedef struct botan_srp6_server_session_struct* botan_srp6_server_session_t;
1987BOTAN_FFI_EXPORT(3, 0)
1988int botan_srp6_server_session_init(botan_srp6_server_session_t* srp6);
1995BOTAN_FFI_EXPORT(3, 0)
1996int botan_srp6_server_session_destroy(botan_srp6_server_session_t srp6);
2010BOTAN_FFI_EXPORT(3, 0)
2011int botan_srp6_server_session_step1(botan_srp6_server_session_t srp6,
2012 const uint8_t verifier[],
2013 size_t verifier_len,
2014 const char* group_id,
2015 const char* hash_id,
2016 botan_rng_t rng_obj,
2029BOTAN_FFI_EXPORT(3, 0)
2030int botan_srp6_server_session_step2(
2031 botan_srp6_server_session_t srp6, const uint8_t A[], size_t A_len, uint8_t key[], size_t* key_len);
2045BOTAN_FFI_EXPORT(3, 0)
2046int botan_srp6_generate_verifier(const char* identifier,
2047 const char* password,
2048 const uint8_t salt[],
2050 const char* group_id,
2051 const char* hash_id,
2053 size_t* verifier_len);
2072BOTAN_FFI_EXPORT(3, 0)
2073int botan_srp6_client_agree(const char* username,
2074 const char* password,
2075 const char* group_id,
2076 const char* hash_id,
2077 const uint8_t salt[],
2081 botan_rng_t rng_obj,
2090BOTAN_FFI_EXPORT(3, 0)
2091int botan_srp6_group_size(const char* group_id, size_t* group_p_bytes);
2111BOTAN_FFI_EXPORT(3, 0)
2112int botan_zfec_encode(size_t K, size_t N, const uint8_t* input, size_t size, uint8_t** outputs);
2132BOTAN_FFI_EXPORT(3, 0)
2133int botan_zfec_decode(
2134 size_t K, size_t N, const size_t* indexes, uint8_t* const* const inputs, size_t shareSize, uint8_t** outputs);
BOTAN_DLL int botan_mp_is_odd(const botan_mp_t mp)
BOTAN_DLL int botan_mp_set_bit(botan_mp_t n, size_t bit)
BOTAN_DLL int botan_mp_sub(botan_mp_t result, const botan_mp_t x, const botan_mp_t y)
BOTAN_DLL int botan_privkey_create_elgamal(botan_privkey_t *key, botan_rng_t rng, size_t pbits, size_t qbits)
BOTAN_DLL int botan_mp_is_prime(const botan_mp_t n, botan_rng_t rng, size_t test_prob)
BOTAN_DLL int botan_mac_output_length(botan_mac_t mac, size_t *output_length)
BOTAN_DLL int botan_mp_powmod(botan_mp_t out, const botan_mp_t base, const botan_mp_t exponent, const botan_mp_t modulus)
BOTAN_DLL int botan_mp_clear(botan_mp_t mp)
BOTAN_DLL uint32_t botan_version_datestamp(void)
BOTAN_DLL int botan_cipher_valid_nonce_length(botan_cipher_t cipher, size_t nl)
BOTAN_DLL uint32_t botan_ffi_api_version(void)
BOTAN_DLL int botan_privkey_create_dh(botan_privkey_t *key, botan_rng_t rng, const char *param)
BOTAN_DLL int botan_cipher_query_keylen(botan_cipher_t, size_t *out_minimum_keylength, size_t *out_maximum_keylength)
BOTAN_DLL int botan_mp_rshift(botan_mp_t out, const botan_mp_t in, size_t shift)
BOTAN_DLL int botan_mp_to_uint32(const botan_mp_t mp, uint32_t *val)
BOTAN_DLL 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)
BOTAN_DLL int botan_mp_mod_inverse(botan_mp_t out, const botan_mp_t in, const botan_mp_t modulus)
BOTAN_DLL int botan_scrub_mem(void *mem, size_t bytes)
BOTAN_DLL int botan_mp_is_negative(const botan_mp_t mp)
BOTAN_DLL int botan_bcrypt_is_valid(const char *pass, const char *hash)
BOTAN_DLL int botan_rng_reseed(botan_rng_t rng, size_t bits)
BOTAN_DLL int botan_mp_gcd(botan_mp_t out, const botan_mp_t x, const botan_mp_t y)
BOTAN_DLL int botan_base64_decode(const char *base64_str, size_t in_len, uint8_t *out, size_t *out_len)
BOTAN_DLL int botan_mp_cmp(int *result, const botan_mp_t x, const botan_mp_t y)
BOTAN_DLL int botan_rng_init(botan_rng_t *rng, const char *rng_type)
#define BOTAN_FFI_EXPORT(maj, min)
BOTAN_DLL int botan_cipher_clear(botan_cipher_t hash)
BOTAN_DLL int botan_block_cipher_init(botan_block_cipher_t *bc, const char *cipher_name)
BOTAN_DLL int botan_pbkdf(const char *pbkdf_algo, uint8_t out[], size_t out_len, const char *passphrase, const uint8_t salt[], size_t salt_len, size_t iterations)
BOTAN_DLL int botan_mac_set_nonce(botan_mac_t mac, const uint8_t *nonce, size_t nonce_len)
BOTAN_DLL 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)
BOTAN_DLL int botan_privkey_get_field(botan_mp_t output, botan_privkey_t key, const char *field_name)
struct botan_mac_struct * botan_mac_t
BOTAN_DLL int botan_mp_add(botan_mp_t result, const botan_mp_t x, const botan_mp_t y)
BOTAN_DLL int botan_cipher_set_key(botan_cipher_t cipher, const uint8_t *key, size_t key_len)
BOTAN_DLL int botan_hash_output_length(botan_hash_t hash, size_t *output_length)
BOTAN_DLL int botan_mp_div(botan_mp_t quotient, botan_mp_t remainder, const botan_mp_t x, const botan_mp_t y)
BOTAN_DLL const char * botan_error_description(int err)
BOTAN_DLL int botan_ffi_supports_api(uint32_t api_version)
struct botan_privkey_struct * botan_privkey_t
BOTAN_DLL int botan_mp_is_even(const botan_mp_t mp)
BOTAN_DLL int botan_mp_add_u32(botan_mp_t result, const botan_mp_t x, uint32_t y)
BOTAN_DLL int botan_privkey_create_dsa(botan_privkey_t *key, botan_rng_t rng, size_t pbits, size_t qbits)
BOTAN_DLL int botan_pubkey_get_field(botan_mp_t output, botan_pubkey_t key, const char *field_name)
BOTAN_DLL int botan_privkey_check_key(botan_privkey_t key, botan_rng_t rng, uint32_t flags)
BOTAN_DLL int botan_cipher_set_associated_data(botan_cipher_t cipher, const uint8_t *ad, size_t ad_len)
BOTAN_DLL int botan_privkey_load_sm2(botan_privkey_t *key, const botan_mp_t scalar, const char *curve_name)
BOTAN_DLL int botan_mp_destroy(botan_mp_t mp)
BOTAN_DLL int botan_mac_update(botan_mac_t mac, const uint8_t *buf, size_t len)
#define BOTAN_FFI_DEPRECATED(msg)
BOTAN_DLL int botan_mp_sub_u32(botan_mp_t result, const botan_mp_t x, uint32_t y)
BOTAN_DLL int botan_rng_add_entropy(botan_rng_t rng, const uint8_t *entropy, size_t entropy_len)
BOTAN_DLL int botan_same_mem(const uint8_t *x, const uint8_t *y, size_t len)
BOTAN_DLL int botan_constant_time_compare(const uint8_t *x, const uint8_t *y, size_t len)
BOTAN_DLL uint32_t botan_version_patch(void)
BOTAN_DLL int botan_cipher_destroy(botan_cipher_t cipher)
BOTAN_DLL int botan_block_cipher_encrypt_blocks(botan_block_cipher_t bc, const uint8_t in[], uint8_t out[], size_t blocks)
BOTAN_DLL int botan_hash_copy_state(botan_hash_t *dest, const botan_hash_t source)
BOTAN_DLL int botan_mp_equal(const botan_mp_t x, const botan_mp_t y)
BOTAN_DLL int botan_mp_num_bytes(const botan_mp_t n, size_t *bytes)
BOTAN_DLL int botan_block_cipher_name(botan_block_cipher_t cipher, char *name, size_t *name_len)
BOTAN_DLL int botan_cipher_output_length(botan_cipher_t cipher, size_t in_len, size_t *out_len)
BOTAN_DLL int botan_mp_swap(botan_mp_t x, botan_mp_t y)
BOTAN_DLL int botan_cipher_start(botan_cipher_t cipher, const uint8_t *nonce, size_t nonce_len)
BOTAN_DLL int botan_hash_destroy(botan_hash_t hash)
BOTAN_DLL int botan_block_cipher_block_size(botan_block_cipher_t bc)
BOTAN_DLL int botan_nist_kw_enc(const char *cipher_algo, int padded, const uint8_t key[], size_t key_len, const uint8_t kek[], size_t kek_len, uint8_t wrapped_key[], size_t *wrapped_key_len)
BOTAN_DLL int botan_mp_from_bin(const botan_mp_t mp, const uint8_t vec[], size_t vec_len)
BOTAN_DLL int botan_mp_is_zero(const botan_mp_t mp)
BOTAN_DLL int botan_pubkey_load_sm2(botan_pubkey_t *key, const botan_mp_t public_x, const botan_mp_t public_y, const char *curve_name)
BOTAN_DLL int botan_cipher_get_ideal_update_granularity(botan_cipher_t cipher, size_t *ug)
BOTAN_DLL int botan_mp_mod_mul(botan_mp_t result, const botan_mp_t x, const botan_mp_t y, const botan_mp_t mod)
BOTAN_DLL int botan_privkey_view_der(botan_privkey_t key, botan_view_ctx ctx, botan_view_bin_fn view)
BOTAN_DLL int botan_mac_final(botan_mac_t mac, uint8_t out[])
BOTAN_DLL int botan_mp_num_bits(const botan_mp_t n, size_t *bits)
BOTAN_DLL int botan_mac_init(botan_mac_t *mac, const char *mac_name, uint32_t flags)
BOTAN_DLL int botan_mac_destroy(botan_mac_t mac)
BOTAN_DLL int botan_block_cipher_set_key(botan_block_cipher_t bc, const uint8_t key[], size_t len)
struct botan_block_cipher_struct * botan_block_cipher_t
BOTAN_DLL int botan_hash_name(botan_hash_t hash, char *name, size_t *name_len)
BOTAN_DLL int botan_hex_encode(const uint8_t *x, size_t len, char *out, uint32_t flags)
BOTAN_DLL int botan_mp_set_from_int(botan_mp_t mp, int initial_value)
BOTAN_DLL int botan_block_cipher_clear(botan_block_cipher_t bc)
BOTAN_DLL int botan_rng_init_custom(botan_rng_t *rng_out, const char *rng_name, void *context, int(*get_cb)(void *context, uint8_t *out, size_t out_len), int(*add_entropy_cb)(void *context, const uint8_t input[], size_t length), void(*destroy_cb)(void *context))
BOTAN_DLL int botan_mp_mul(botan_mp_t result, const botan_mp_t x, const botan_mp_t y)
BOTAN_DLL int botan_privkey_destroy(botan_privkey_t key)
BOTAN_DLL int botan_rng_reseed_from_rng(botan_rng_t rng, botan_rng_t source_rng, size_t bits)
BOTAN_DLL int botan_privkey_create_mceliece(botan_privkey_t *key, botan_rng_t rng, size_t n, size_t t)
int(* botan_view_bin_fn)(botan_view_ctx view_ctx, const uint8_t *data, size_t len)
BOTAN_DLL int botan_hash_update(botan_hash_t hash, const uint8_t *in, size_t in_len)
BOTAN_DLL int botan_mac_clear(botan_mac_t mac)
BOTAN_DLL int botan_mp_to_bin(const botan_mp_t mp, uint8_t vec[])
BOTAN_DLL int botan_mac_set_key(botan_mac_t mac, const uint8_t *key, size_t key_len)
BOTAN_DLL int botan_cipher_update(botan_cipher_t cipher, uint32_t flags, uint8_t output[], size_t output_size, size_t *output_written, const uint8_t input_bytes[], size_t input_size, size_t *input_consumed)
BOTAN_DLL int botan_mp_set_from_mp(botan_mp_t dest, const botan_mp_t source)
BOTAN_DLL int botan_nist_kw_dec(const char *cipher_algo, int padded, const uint8_t wrapped_key[], size_t wrapped_key_len, const uint8_t kek[], size_t kek_len, uint8_t key[], size_t *key_len)
BOTAN_DLL int botan_hash_clear(botan_hash_t hash)
BOTAN_DLL int botan_privkey_algo_name(botan_privkey_t key, char out[], size_t *out_len)
BOTAN_DLL int botan_block_cipher_destroy(botan_block_cipher_t bc)
BOTAN_DLL int botan_scrypt(uint8_t out[], size_t out_len, const char *passphrase, const uint8_t salt[], size_t salt_len, size_t N, size_t r, size_t p)
BOTAN_DLL int botan_cipher_get_update_granularity(botan_cipher_t cipher, size_t *ug)
BOTAN_DLL int botan_block_cipher_get_keyspec(botan_block_cipher_t cipher, size_t *out_minimum_keylength, size_t *out_maximum_keylength, size_t *out_keylength_modulo)
BOTAN_DLL int botan_cipher_reset(botan_cipher_t cipher)
BOTAN_DLL int botan_mp_to_hex(const botan_mp_t mp, char *out)
BOTAN_DLL int botan_block_cipher_decrypt_blocks(botan_block_cipher_t bc, const uint8_t in[], uint8_t out[], size_t blocks)
BOTAN_DLL int botan_mp_set_from_radix_str(botan_mp_t dest, const char *str, size_t radix)
BOTAN_DLL 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)
BOTAN_DLL int botan_cipher_get_default_nonce_length(botan_cipher_t cipher, size_t *nl)
struct botan_mp_struct * botan_mp_t
BOTAN_DLL int botan_privkey_load(botan_privkey_t *key, botan_rng_t rng, const uint8_t bits[], size_t len, const char *password)
struct botan_rng_struct * botan_rng_t
BOTAN_DLL int botan_system_rng_get(uint8_t *out, size_t out_len)
BOTAN_DLL int botan_rng_destroy(botan_rng_t rng)
@ BOTAN_FFI_ERROR_NOT_IMPLEMENTED
@ BOTAN_FFI_ERROR_INVALID_KEY_LENGTH
@ BOTAN_FFI_ERROR_KEY_NOT_SET
@ BOTAN_FFI_ERROR_TLS_ERROR
@ BOTAN_FFI_ERROR_EXCEPTION_THROWN
@ BOTAN_FFI_ERROR_OUT_OF_MEMORY
@ BOTAN_FFI_ERROR_INTERNAL_ERROR
@ BOTAN_FFI_INVALID_VERIFIER
@ BOTAN_FFI_ERROR_INVALID_OBJECT
@ BOTAN_FFI_ERROR_UNKNOWN_ERROR
@ BOTAN_FFI_ERROR_HTTP_ERROR
@ BOTAN_FFI_ERROR_BAD_FLAG
@ BOTAN_FFI_ERROR_INVALID_INPUT
@ BOTAN_FFI_ERROR_STRING_CONVERSION_ERROR
@ BOTAN_FFI_ERROR_NULL_POINTER
@ BOTAN_FFI_ERROR_SYSTEM_ERROR
@ BOTAN_FFI_ERROR_ROUGHTIME_ERROR
@ BOTAN_FFI_ERROR_INVALID_OBJECT_STATE
@ BOTAN_FFI_ERROR_INSUFFICIENT_BUFFER_SPACE
@ BOTAN_FFI_ERROR_BAD_MAC
@ BOTAN_FFI_ERROR_BAD_PARAMETER
BOTAN_DLL int botan_mp_lshift(botan_mp_t out, const botan_mp_t in, size_t shift)
BOTAN_DLL int botan_cipher_init(botan_cipher_t *cipher, const char *name, uint32_t flags)
BOTAN_DLL int botan_mp_to_str(const botan_mp_t mp, uint8_t base, char *out, size_t *out_len)
BOTAN_DLL int botan_privkey_view_pem(botan_privkey_t key, botan_view_ctx ctx, botan_view_str_fn view)
BOTAN_DLL const char * botan_error_last_exception_message(void)
BOTAN_DLL int botan_mac_get_keyspec(botan_mac_t mac, size_t *out_minimum_keylength, size_t *out_maximum_keylength, size_t *out_keylength_modulo)
BOTAN_DLL int botan_privkey_create_ecdh(botan_privkey_t *key, botan_rng_t rng, const char *params)
BOTAN_DLL int botan_base64_encode(const uint8_t *x, size_t len, char *out, size_t *out_len)
BOTAN_DLL int botan_rng_get(botan_rng_t rng, uint8_t *out, size_t out_len)
struct botan_cipher_struct * botan_cipher_t
BOTAN_DLL int botan_mp_rand_range(botan_mp_t rand_out, botan_rng_t rng, const botan_mp_t lower_bound, const botan_mp_t upper_bound)
BOTAN_DLL int botan_privkey_create_rsa(botan_privkey_t *key, botan_rng_t rng, size_t n_bits)
BOTAN_DLL int botan_hash_init(botan_hash_t *hash, const char *hash_name, uint32_t flags)
int(* botan_view_str_fn)(botan_view_ctx view_ctx, const char *str, size_t len)
BOTAN_DLL int botan_mp_set_from_str(botan_mp_t dest, const char *str)
BOTAN_DLL int botan_mp_clear_bit(botan_mp_t n, size_t bit)
BOTAN_DLL int botan_hash_block_size(botan_hash_t hash, size_t *block_size)
BOTAN_DLL int botan_mp_is_positive(const botan_mp_t mp)
BOTAN_DLL int botan_hex_decode(const char *hex_str, size_t in_len, uint8_t *out, size_t *out_len)
BOTAN_DLL int botan_privkey_create(botan_privkey_t *key, const char *algo_name, const char *algo_params, botan_rng_t rng)
BOTAN_DLL int botan_cipher_name(botan_cipher_t cipher, char *name, size_t *name_len)
BOTAN_DLL int botan_privkey_export(botan_privkey_t key, uint8_t out[], size_t *out_len, uint32_t flags)
BOTAN_DLL int botan_cipher_get_tag_length(botan_cipher_t cipher, size_t *tag_size)
BOTAN_DLL int botan_mp_rand_bits(botan_mp_t rand_out, botan_rng_t rng, size_t bits)
BOTAN_DLL int botan_privkey_create_ecdsa(botan_privkey_t *key, botan_rng_t rng, const char *params)
int BOTAN_DLL botan_pwdhash(const char *algo, size_t param1, size_t param2, size_t param3, uint8_t out[], size_t out_len, const char *passphrase, size_t passphrase_len, const uint8_t salt[], size_t salt_len)
BOTAN_DLL uint32_t botan_version_major(void)
BOTAN_DLL int botan_hash_final(botan_hash_t hash, uint8_t out[])
BOTAN_DLL int botan_mac_name(botan_mac_t mac, char *name, size_t *name_len)
BOTAN_DLL int botan_mp_init(botan_mp_t *mp)
BOTAN_DLL int botan_mp_get_bit(const botan_mp_t n, size_t bit)
int BOTAN_DLL botan_pwdhash_timed(const char *algo, uint32_t msec, size_t *param1, size_t *param2, size_t *param3, uint8_t out[], size_t out_len, const char *passphrase, size_t passphrase_len, const uint8_t salt[], size_t salt_len)
BOTAN_DLL int botan_mp_flip_sign(botan_mp_t mp)
BOTAN_DLL int botan_cipher_get_keyspec(botan_cipher_t, size_t *min_keylen, size_t *max_keylen, size_t *mod_keylen)
struct botan_hash_struct * botan_hash_t
BOTAN_DLL uint32_t botan_version_minor(void)
BOTAN_DLL const char * botan_version_string(void)