52#include <botan/build.h>
154#define BOTAN_FFI_HEX_LOWER_CASE 1
185 uint8_t* out,
size_t* out_len);
214 int(* get_cb)(
void* context, uint8_t* out,
size_t out_len),
215 int(* add_entropy_cb)(
void* context, const uint8_t input[],
size_t length),
216 void(* destroy_cb)(
void* context));
258 const uint8_t* entropy,
423 size_t* out_minimum_keylength,
424 size_t* out_maximum_keylength,
425 size_t* out_keylength_modulo);
439#define BOTAN_CIPHER_INIT_FLAG_MASK_DIRECTION 1
440#define BOTAN_CIPHER_INIT_FLAG_ENCRYPT 0
441#define BOTAN_CIPHER_INIT_FLAG_DECRYPT 1
483 size_t* out_minimum_keylength,
484 size_t* out_maximum_keylength);
498 const uint8_t* key,
size_t key_len);
514 const uint8_t* ad,
size_t ad_len);
520 const uint8_t* nonce,
size_t nonce_len);
522#define BOTAN_CIPHER_UPDATE_FLAG_FINAL (1U << 0)
531 size_t* output_written,
532 const uint8_t input_bytes[],
534 size_t* input_consumed);
565 uint8_t out[],
size_t out_len,
566 const
char* passphrase,
567 const uint8_t salt[],
size_t salt_len,
595 uint8_t out[],
size_t out_len,
596 const
char* passphrase,
597 const uint8_t salt[],
size_t salt_len,
598 size_t milliseconds_to_run,
599 size_t* out_iterations_used);
624 const
char* passphrase,
625 size_t passphrase_len,
626 const uint8_t salt[],
653 const
char* passphrase,
654 size_t passphrase_len,
655 const uint8_t salt[],
666 const
char* passphrase,
667 const uint8_t salt[],
size_t salt_len,
668 size_t N,
size_t r,
size_t p);
684 uint8_t out[],
size_t out_len,
685 const uint8_t secret[],
size_t secret_len,
686 const uint8_t salt[],
size_t salt_len,
687 const uint8_t label[],
size_t label_len);
698 const
char* cipher_name);
716 const uint8_t key[],
size_t len);
747 char*
name,
size_t* name_len);
758 size_t* out_minimum_keylength,
759 size_t* out_maximum_keylength,
760 size_t* out_keylength_modulo);
948 const
char* password,
977 const
char* algo_name,
978 const
char* algo_params,
981#define BOTAN_CHECK_KEY_EXPENSIVE_TESTS 1
1052 const uint8_t bits[],
size_t len,
1053 const
char* password);
1060#define BOTAN_PRIVKEY_EXPORT_FLAG_DER 0
1061#define BOTAN_PRIVKEY_EXPORT_FLAG_PEM 1
1071 uint8_t out[],
size_t* out_len,
1079BOTAN_DEPRECATED("Use botan_privkey_export_encrypted_pbkdf_{msec,iter}
")
1080BOTAN_PUBLIC_API(2,0) int botan_privkey_export_encrypted(botan_privkey_t key,
1081 uint8_t out[], size_t* out_len,
1083 const char* passphrase,
1084 const char* encryption_algo,
1088* Export a private key, running PBKDF for specified amount of time
1089* @param key the private key to export
1091BOTAN_PUBLIC_API(2,0) int botan_privkey_export_encrypted_pbkdf_msec(botan_privkey_t key,
1092 uint8_t out[], size_t* out_len,
1094 const char* passphrase,
1095 uint32_t pbkdf_msec_runtime,
1096 size_t* pbkdf_iterations_out,
1097 const char* cipher_algo,
1098 const char* pbkdf_algo,
1104BOTAN_PUBLIC_API(2,0) int botan_privkey_export_encrypted_pbkdf_iter(botan_privkey_t key,
1105 uint8_t out[], size_t* out_len,
1107 const char* passphrase,
1108 size_t pbkdf_iterations,
1109 const char* cipher_algo,
1110 const char* pbkdf_algo,
1113typedef struct botan_pubkey_struct* botan_pubkey_t;
1115BOTAN_PUBLIC_API(2,0) int botan_pubkey_load(botan_pubkey_t* key, const uint8_t bits[], size_t len);
1117BOTAN_PUBLIC_API(2,0) int botan_privkey_export_pubkey(botan_pubkey_t* out, botan_privkey_t in);
1119BOTAN_PUBLIC_API(2,0) int botan_pubkey_export(botan_pubkey_t key, uint8_t out[], size_t* out_len, uint32_t flags);
1121BOTAN_PUBLIC_API(2,0) int botan_pubkey_algo_name(botan_pubkey_t key, char out[], size_t* out_len);
1126BOTAN_PUBLIC_API(2,0) int botan_pubkey_check_key(botan_pubkey_t key, botan_rng_t rng, uint32_t flags);
1128BOTAN_PUBLIC_API(2,0) int botan_pubkey_estimated_strength(botan_pubkey_t key, size_t* estimate);
1130BOTAN_PUBLIC_API(2,0) int botan_pubkey_fingerprint(botan_pubkey_t key, const char* hash,
1131 uint8_t out[], size_t* out_len);
1136BOTAN_PUBLIC_API(2,0) int botan_pubkey_destroy(botan_pubkey_t key);
1139* Get arbitrary named fields from public or privat keys
1141BOTAN_PUBLIC_API(2,0) int botan_pubkey_get_field(botan_mp_t output,
1143 const char* field_name);
1145BOTAN_PUBLIC_API(2,0) int botan_privkey_get_field(botan_mp_t output,
1146 botan_privkey_t key,
1147 const char* field_name);
1150* Algorithm specific key operations: RSA
1152BOTAN_PUBLIC_API(2,0) int botan_privkey_load_rsa(botan_privkey_t* key,
1157BOTAN_PUBLIC_API(2,8) int botan_privkey_load_rsa_pkcs1(botan_privkey_t* key,
1158 const uint8_t bits[],
1162int botan_privkey_rsa_get_p(botan_mp_t p, botan_privkey_t rsa_key);
1164int botan_privkey_rsa_get_q(botan_mp_t q, botan_privkey_t rsa_key);
1166int botan_privkey_rsa_get_d(botan_mp_t d, botan_privkey_t rsa_key);
1168int botan_privkey_rsa_get_n(botan_mp_t n, botan_privkey_t rsa_key);
1170int botan_privkey_rsa_get_e(botan_mp_t e, botan_privkey_t rsa_key);
1172BOTAN_PUBLIC_API(2,8) int botan_privkey_rsa_get_privkey(botan_privkey_t rsa_key,
1173 uint8_t out[], size_t* out_len,
1176BOTAN_PUBLIC_API(2,0) int botan_pubkey_load_rsa(botan_pubkey_t* key,
1181int botan_pubkey_rsa_get_e(botan_mp_t e, botan_pubkey_t rsa_key);
1183int botan_pubkey_rsa_get_n(botan_mp_t n, botan_pubkey_t rsa_key);
1186* Algorithm specific key operations: DSA
1188BOTAN_PUBLIC_API(2,0) int botan_privkey_load_dsa(botan_privkey_t* key,
1194BOTAN_PUBLIC_API(2,0) int botan_pubkey_load_dsa(botan_pubkey_t* key,
1201int botan_privkey_dsa_get_x(botan_mp_t n, botan_privkey_t key);
1204int botan_pubkey_dsa_get_p(botan_mp_t p, botan_pubkey_t key);
1206int botan_pubkey_dsa_get_q(botan_mp_t q, botan_pubkey_t key);
1208int botan_pubkey_dsa_get_g(botan_mp_t d, botan_pubkey_t key);
1210int botan_pubkey_dsa_get_y(botan_mp_t y, botan_pubkey_t key);
1213* Loads Diffie Hellman private key
1215* @param key variable populated with key material
1216* @param p prime order of a Z_p group
1217* @param g group generator
1218* @param x private key
1220* @pre key is NULL on input
1221* @post function allocates memory and assigns to `key'
1223* @return 0 on success, a negative value on failure
1225BOTAN_PUBLIC_API(2,0) int botan_privkey_load_dh(botan_privkey_t* key,
1242BOTAN_PUBLIC_API(2,0) int botan_pubkey_load_dh(botan_pubkey_t* key,
1248* Algorithm specific key operations: ElGamal
1263BOTAN_PUBLIC_API(2,0) int botan_pubkey_load_elgamal(botan_pubkey_t* key,
1281BOTAN_PUBLIC_API(2,0) int botan_privkey_load_elgamal(botan_privkey_t* key,
1287* Algorithm specific key operations: Ed25519
1290BOTAN_PUBLIC_API(2,2) int botan_privkey_load_ed25519(botan_privkey_t* key,
1291 const uint8_t privkey[32]);
1293BOTAN_PUBLIC_API(2,2) int botan_pubkey_load_ed25519(botan_pubkey_t* key,
1294 const uint8_t pubkey[32]);
1296BOTAN_PUBLIC_API(2,2) int botan_privkey_ed25519_get_privkey(botan_privkey_t key,
1297 uint8_t output[64]);
1299BOTAN_PUBLIC_API(2,2) int botan_pubkey_ed25519_get_pubkey(botan_pubkey_t key,
1300 uint8_t pubkey[32]);
1303* Algorithm specific key operations: X25519
1306BOTAN_PUBLIC_API(2,8) int botan_privkey_load_x25519(botan_privkey_t* key,
1307 const uint8_t privkey[32]);
1309BOTAN_PUBLIC_API(2,8) int botan_pubkey_load_x25519(botan_pubkey_t* key,
1310 const uint8_t pubkey[32]);
1312BOTAN_PUBLIC_API(2,8) int botan_privkey_x25519_get_privkey(botan_privkey_t key,
1313 uint8_t output[32]);
1315BOTAN_PUBLIC_API(2,8) int botan_pubkey_x25519_get_pubkey(botan_pubkey_t key,
1316 uint8_t pubkey[32]);
1319* Algorithm specific key operations: ECDSA and ECDH
1321BOTAN_PUBLIC_API(2,2)
1322int botan_privkey_load_ecdsa(botan_privkey_t* key,
1323 const botan_mp_t scalar,
1324 const char* curve_name);
1326BOTAN_PUBLIC_API(2,2)
1327int botan_pubkey_load_ecdsa(botan_pubkey_t* key,
1328 const botan_mp_t public_x,
1329 const botan_mp_t public_y,
1330 const char* curve_name);
1332BOTAN_PUBLIC_API(2,2)
1333int botan_pubkey_load_ecdh(botan_pubkey_t* key,
1334 const botan_mp_t public_x,
1335 const botan_mp_t public_y,
1336 const char* curve_name);
1338BOTAN_PUBLIC_API(2,2)
1339int botan_privkey_load_ecdh(botan_privkey_t* key,
1340 const botan_mp_t scalar,
1341 const char* curve_name);
1343BOTAN_PUBLIC_API(2,2)
1344int botan_pubkey_load_sm2(botan_pubkey_t* key,
1345 const botan_mp_t public_x,
1346 const botan_mp_t public_y,
1347 const char* curve_name);
1349BOTAN_PUBLIC_API(2,2)
1350int botan_privkey_load_sm2(botan_privkey_t* key,
1351 const botan_mp_t scalar,
1352 const char* curve_name);
1355int botan_pubkey_load_sm2_enc(botan_pubkey_t* key,
1356 const botan_mp_t public_x,
1357 const botan_mp_t public_y,
1358 const char* curve_name);
1361int botan_privkey_load_sm2_enc(botan_privkey_t* key,
1362 const botan_mp_t scalar,
1363 const char* curve_name);
1365BOTAN_PUBLIC_API(2,3)
1366int botan_pubkey_sm2_compute_za(uint8_t out[],
1369 const char* hash_algo,
1370 const botan_pubkey_t key);
1373* Public Key Encryption
1375typedef struct botan_pk_op_encrypt_struct* botan_pk_op_encrypt_t;
1377BOTAN_PUBLIC_API(2,0) int botan_pk_op_encrypt_create(botan_pk_op_encrypt_t* op,
1379 const char* padding,
1385BOTAN_PUBLIC_API(2,0) int botan_pk_op_encrypt_destroy(botan_pk_op_encrypt_t op);
1387BOTAN_PUBLIC_API(2,8) int botan_pk_op_encrypt_output_length(botan_pk_op_encrypt_t op,
1391BOTAN_PUBLIC_API(2,0) int botan_pk_op_encrypt(botan_pk_op_encrypt_t op,
1395 const uint8_t plaintext[],
1396 size_t plaintext_len);
1399* Public Key Decryption
1401typedef struct botan_pk_op_decrypt_struct* botan_pk_op_decrypt_t;
1403BOTAN_PUBLIC_API(2,0) int botan_pk_op_decrypt_create(botan_pk_op_decrypt_t* op,
1404 botan_privkey_t key,
1405 const char* padding,
1411BOTAN_PUBLIC_API(2,0) int botan_pk_op_decrypt_destroy(botan_pk_op_decrypt_t op);
1413BOTAN_PUBLIC_API(2,8) int botan_pk_op_decrypt_output_length(botan_pk_op_decrypt_t op,
1417BOTAN_PUBLIC_API(2,0) int botan_pk_op_decrypt(botan_pk_op_decrypt_t op,
1418 uint8_t out[], size_t* out_len,
1419 const uint8_t ciphertext[], size_t ciphertext_len);
1422* Signature Generation
1425#define BOTAN_PUBKEY_DER_FORMAT_SIGNATURE 1
1427typedef struct botan_pk_op_sign_struct* botan_pk_op_sign_t;
1429BOTAN_PUBLIC_API(2,0)
1430int botan_pk_op_sign_create(botan_pk_op_sign_t* op,
1431 botan_privkey_t key,
1432 const char* hash_and_padding,
1438BOTAN_PUBLIC_API(2,0) int botan_pk_op_sign_destroy(botan_pk_op_sign_t op);
1440BOTAN_PUBLIC_API(2,8) int botan_pk_op_sign_output_length(botan_pk_op_sign_t op, size_t* olen);
1442BOTAN_PUBLIC_API(2,0) int botan_pk_op_sign_update(botan_pk_op_sign_t op, const uint8_t in[], size_t in_len);
1444BOTAN_PUBLIC_API(2,0)
1445int botan_pk_op_sign_finish(botan_pk_op_sign_t op, botan_rng_t rng,
1446 uint8_t sig[], size_t* sig_len);
1449* Signature Verification
1451typedef struct botan_pk_op_verify_struct* botan_pk_op_verify_t;
1453BOTAN_PUBLIC_API(2,0)
1454int botan_pk_op_verify_create(botan_pk_op_verify_t* op,
1456 const char* hash_and_padding,
1462BOTAN_PUBLIC_API(2,0) int botan_pk_op_verify_destroy(botan_pk_op_verify_t op);
1464BOTAN_PUBLIC_API(2,0) int botan_pk_op_verify_update(botan_pk_op_verify_t op, const uint8_t in[], size_t in_len);
1465BOTAN_PUBLIC_API(2,0) int botan_pk_op_verify_finish(botan_pk_op_verify_t op, const uint8_t sig[], size_t sig_len);
1470typedef struct botan_pk_op_ka_struct* botan_pk_op_ka_t;
1472BOTAN_PUBLIC_API(2,0)
1473int botan_pk_op_key_agreement_create(botan_pk_op_ka_t* op,
1474 botan_privkey_t key,
1481BOTAN_PUBLIC_API(2,0) int botan_pk_op_key_agreement_destroy(botan_pk_op_ka_t op);
1483BOTAN_PUBLIC_API(2,0) int botan_pk_op_key_agreement_export_public(botan_privkey_t key,
1484 uint8_t out[], size_t* out_len);
1486BOTAN_PUBLIC_API(2,8) int botan_pk_op_key_agreement_size(botan_pk_op_ka_t op, size_t* out_len);
1488BOTAN_PUBLIC_API(2,0)
1489int botan_pk_op_key_agreement(botan_pk_op_ka_t op,
1490 uint8_t out[], size_t* out_len,
1491 const uint8_t other_key[], size_t other_key_len,
1492 const uint8_t salt[], size_t salt_len);
1494BOTAN_PUBLIC_API(2,0) int botan_pkcs_hash_id(const char* hash_name, uint8_t pkcs_id[], size_t* pkcs_id_len);
1499* @param mce_key must be a McEliece key
1500* ct_len should be pt_len + n/8 + a few?
1502BOTAN_PUBLIC_API(2,0) BOTAN_DEPRECATED("Poorly specified, avoid in
new code
")
1503int botan_mceies_encrypt(botan_pubkey_t mce_key,
1506 const uint8_t pt[], size_t pt_len,
1507 const uint8_t ad[], size_t ad_len,
1508 uint8_t ct[], size_t* ct_len);
1510BOTAN_PUBLIC_API(2,0) BOTAN_DEPRECATED("Poorly specified, avoid in
new code
")
1511int botan_mceies_decrypt(botan_privkey_t mce_key,
1513 const uint8_t ct[], size_t ct_len,
1514 const uint8_t ad[], size_t ad_len,
1515 uint8_t pt[], size_t* pt_len);
1519**************************/
1521typedef struct botan_x509_cert_struct* botan_x509_cert_t;
1523BOTAN_PUBLIC_API(2,0) int botan_x509_cert_load(botan_x509_cert_t* cert_obj, const uint8_t cert[], size_t cert_len);
1524BOTAN_PUBLIC_API(2,0) int botan_x509_cert_load_file(botan_x509_cert_t* cert_obj, const char* filename);
1529BOTAN_PUBLIC_API(2,0) int botan_x509_cert_destroy(botan_x509_cert_t cert);
1531BOTAN_PUBLIC_API(2,8) int botan_x509_cert_dup(botan_x509_cert_t* new_cert, botan_x509_cert_t cert);
1533/* Prefer botan_x509_cert_not_before and botan_x509_cert_not_after */
1534BOTAN_PUBLIC_API(2,0) int botan_x509_cert_get_time_starts(botan_x509_cert_t cert, char out[], size_t* out_len);
1535BOTAN_PUBLIC_API(2,0) int botan_x509_cert_get_time_expires(botan_x509_cert_t cert, char out[], size_t* out_len);
1537BOTAN_PUBLIC_API(2,8) int botan_x509_cert_not_before(botan_x509_cert_t cert, uint64_t* time_since_epoch);
1538BOTAN_PUBLIC_API(2,8) int botan_x509_cert_not_after(botan_x509_cert_t cert, uint64_t* time_since_epoch);
1540BOTAN_PUBLIC_API(2,0) int botan_x509_cert_get_fingerprint(botan_x509_cert_t cert, const char* hash, uint8_t out[], size_t* out_len);
1542BOTAN_PUBLIC_API(2,0) int botan_x509_cert_get_serial_number(botan_x509_cert_t cert, uint8_t out[], size_t* out_len);
1543BOTAN_PUBLIC_API(2,0) int botan_x509_cert_get_authority_key_id(botan_x509_cert_t cert, uint8_t out[], size_t* out_len);
1544BOTAN_PUBLIC_API(2,0) int botan_x509_cert_get_subject_key_id(botan_x509_cert_t cert, uint8_t out[], size_t* out_len);
1546BOTAN_PUBLIC_API(2,0) int botan_x509_cert_get_public_key_bits(botan_x509_cert_t cert,
1547 uint8_t out[], size_t* out_len);
1549BOTAN_PUBLIC_API(2,0) int botan_x509_cert_get_public_key(botan_x509_cert_t cert, botan_pubkey_t* key);
1551BOTAN_PUBLIC_API(2,0)
1552int botan_x509_cert_get_issuer_dn(botan_x509_cert_t cert,
1553 const char* key, size_t index,
1554 uint8_t out[], size_t* out_len);
1556BOTAN_PUBLIC_API(2,0)
1557int botan_x509_cert_get_subject_dn(botan_x509_cert_t cert,
1558 const char* key, size_t index,
1559 uint8_t out[], size_t* out_len);
1561BOTAN_PUBLIC_API(2,0) int botan_x509_cert_to_string(botan_x509_cert_t cert, char out[], size_t* out_len);
1563/* Must match values of Key_Constraints in key_constraints.h */
1564enum botan_x509_cert_key_constraints {
1566 DIGITAL_SIGNATURE = 32768,
1567 NON_REPUDIATION = 16384,
1568 KEY_ENCIPHERMENT = 8192,
1569 DATA_ENCIPHERMENT = 4096,
1570 KEY_AGREEMENT = 2048,
1571 KEY_CERT_SIGN = 1024,
1573 ENCIPHER_ONLY = 256,
1577BOTAN_PUBLIC_API(2,0) int botan_x509_cert_allowed_usage(botan_x509_cert_t cert, unsigned int key_usage);
1583BOTAN_PUBLIC_API(2,5) int botan_x509_cert_hostname_match(botan_x509_cert_t cert, const char* hostname);
1593BOTAN_PUBLIC_API(2,8) int botan_x509_cert_verify(
1594 int* validation_result,
1595 botan_x509_cert_t cert,
1596 const botan_x509_cert_t* intermediates,
1597 size_t intermediates_len,
1598 const botan_x509_cert_t* trusted,
1600 const char* trusted_path,
1601 size_t required_strength,
1602 const char* hostname,
1603 uint64_t reference_time);
1609BOTAN_PUBLIC_API(2,8) const char* botan_x509_cert_validation_status(int code);
1613**************************/
1615typedef struct botan_x509_crl_struct* botan_x509_crl_t;
1617BOTAN_PUBLIC_API(2,13) int botan_x509_crl_load_file(botan_x509_crl_t* crl_obj, const char* crl_path);
1618BOTAN_PUBLIC_API(2,13) int botan_x509_crl_load(botan_x509_crl_t* crl_obj, const uint8_t crl_bits[], size_t crl_bits_len);
1620BOTAN_PUBLIC_API(2,13) int botan_x509_crl_destroy(botan_x509_crl_t crl);
1626BOTAN_PUBLIC_API(2,13) int botan_x509_is_revoked(botan_x509_crl_t crl, botan_x509_cert_t cert);
1632BOTAN_PUBLIC_API(2,13) int botan_x509_cert_verify_with_crl(
1633 int* validation_result,
1634 botan_x509_cert_t cert,
1635 const botan_x509_cert_t* intermediates,
1636 size_t intermediates_len,
1637 const botan_x509_cert_t* trusted,
1639 const botan_x509_crl_t* crls,
1641 const char* trusted_path,
1642 size_t required_strength,
1643 const char* hostname,
1644 uint64_t reference_time);
1649BOTAN_PUBLIC_API(2,2)
1650int botan_key_wrap3394(const uint8_t key[], size_t key_len,
1651 const uint8_t kek[], size_t kek_len,
1652 uint8_t wrapped_key[], size_t *wrapped_key_len);
1654BOTAN_PUBLIC_API(2,2)
1655int botan_key_unwrap3394(const uint8_t wrapped_key[], size_t wrapped_key_len,
1656 const uint8_t kek[], size_t kek_len,
1657 uint8_t key[], size_t *key_len);
1663typedef struct botan_hotp_struct* botan_hotp_t;
1668BOTAN_PUBLIC_API(2,8)
1669int botan_hotp_init(botan_hotp_t* hotp,
1670 const uint8_t key[], size_t key_len,
1671 const char* hash_algo,
1678BOTAN_PUBLIC_API(2,8)
1679int botan_hotp_destroy(botan_hotp_t hotp);
1684BOTAN_PUBLIC_API(2,8)
1685int botan_hotp_generate(botan_hotp_t hotp,
1686 uint32_t* hotp_code,
1687 uint64_t hotp_counter);
1692BOTAN_PUBLIC_API(2,8)
1693int botan_hotp_check(botan_hotp_t hotp,
1694 uint64_t* next_hotp_counter,
1696 uint64_t hotp_counter,
1697 size_t resync_range);
1704typedef struct botan_totp_struct* botan_totp_t;
1709BOTAN_PUBLIC_API(2,8)
1710int botan_totp_init(botan_totp_t* totp,
1711 const uint8_t key[], size_t key_len,
1712 const char* hash_algo,
1720BOTAN_PUBLIC_API(2,8)
1721int botan_totp_destroy(botan_totp_t totp);
1729BOTAN_PUBLIC_API(2,8)
1730int botan_totp_generate(botan_totp_t totp,
1731 uint32_t* totp_code,
1732 uint64_t timestamp);
1742BOTAN_PUBLIC_API(2,8)
1743int botan_totp_check(botan_totp_t totp,
1746 size_t acceptable_clock_drift);
1753typedef struct botan_fpe_struct* botan_fpe_t;
1755#define BOTAN_FPE_FLAG_FE1_COMPAT_MODE 1
1757BOTAN_PUBLIC_API(2,8)
1758int botan_fpe_fe1_init(botan_fpe_t* fpe, botan_mp_t n,
1759 const uint8_t key[], size_t key_len,
1760 size_t rounds, uint32_t flags);
1765BOTAN_PUBLIC_API(2,8)
1766int botan_fpe_destroy(botan_fpe_t fpe);
1768BOTAN_PUBLIC_API(2,8)
1769int botan_fpe_encrypt(botan_fpe_t fpe, botan_mp_t x, const uint8_t tweak[], size_t tweak_len);
1771BOTAN_PUBLIC_API(2,8)
1772int botan_fpe_decrypt(botan_fpe_t fpe, botan_mp_t x, const uint8_t tweak[], size_t tweak_len);
#define BOTAN_PUBLIC_API(maj, min)
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)
int botan_block_cipher_init(botan_block_cipher_t *bc, const char *cipher_name)
int botan_rng_reseed_from_rng(botan_rng_t rng, botan_rng_t source_rng, size_t bits)
uint32_t botan_version_minor(void)
int botan_mp_set_from_int(botan_mp_t mp, int initial_value)
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)
int botan_privkey_check_key(botan_privkey_t key, botan_rng_t rng, uint32_t flags)
int botan_base64_encode(const uint8_t *x, size_t len, char *out, size_t *out_len)
int botan_privkey_create_elgamal(botan_privkey_t *key, botan_rng_t rng, size_t pbits, size_t qbits)
int botan_mp_set_from_mp(botan_mp_t dest, const botan_mp_t source)
int botan_mp_to_bin(const botan_mp_t mp, uint8_t vec[])
int botan_hash_update(botan_hash_t hash, const uint8_t *in, size_t in_len)
int botan_privkey_create_rsa(botan_privkey_t *key, botan_rng_t rng, size_t n_bits)
uint32_t botan_version_datestamp(void)
uint32_t botan_version_patch(void)
int botan_privkey_create_ecdsa(botan_privkey_t *key, botan_rng_t rng, const char *params)
int botan_mp_cmp(int *result, const botan_mp_t x, const botan_mp_t y)
int botan_mp_set_from_radix_str(botan_mp_t dest, const char *str, size_t radix)
int botan_rng_add_entropy(botan_rng_t rng, const uint8_t *entropy, size_t entropy_len)
int botan_cipher_start(botan_cipher_t cipher, const uint8_t *nonce, size_t nonce_len)
uint32_t botan_version_major(void)
int botan_cipher_valid_nonce_length(botan_cipher_t cipher, size_t nl)
int botan_mac_init(botan_mac_t *mac, const char *mac_name, uint32_t flags)
int botan_mp_sub(botan_mp_t result, const botan_mp_t x, const botan_mp_t y)
int botan_privkey_create_dh(botan_privkey_t *key, botan_rng_t rng, const char *param)
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)
int botan_hash_name(botan_hash_t hash, char *name, size_t *name_len)
int botan_mp_to_str(const botan_mp_t mp, uint8_t base, char *out, size_t *out_len)
int botan_mp_gcd(botan_mp_t out, const botan_mp_t x, const botan_mp_t y)
int botan_cipher_get_tag_length(botan_cipher_t cipher, size_t *tag_size)
int botan_mp_from_bin(const botan_mp_t mp, const uint8_t vec[], size_t vec_len)
int botan_privkey_get_field(botan_mp_t output, botan_privkey_t key, const char *field_name)
int botan_mp_add_u32(botan_mp_t result, const botan_mp_t x, uint32_t y)
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))
int 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)
int botan_rng_reseed(botan_rng_t rng, size_t bits)
int botan_mp_init(botan_mp_t *mp)
int botan_same_mem(const uint8_t *x, const uint8_t *y, size_t len)
int botan_mp_mod_mul(botan_mp_t result, const botan_mp_t x, const botan_mp_t y, const botan_mp_t mod)
int botan_privkey_load(botan_privkey_t *key, botan_rng_t rng, const uint8_t bits[], size_t len, const char *password)
struct botan_mac_struct * botan_mac_t
int botan_base64_decode(const char *base64_str, size_t in_len, uint8_t *out, size_t *out_len)
int botan_mac_destroy(botan_mac_t mac)
struct botan_privkey_struct * botan_privkey_t
int botan_cipher_output_length(botan_cipher_t cipher, size_t in_len, size_t *out_len)
int botan_mp_mul(botan_mp_t result, const botan_mp_t x, const botan_mp_t y)
int botan_cipher_reset(botan_cipher_t cipher)
int botan_cipher_init(botan_cipher_t *cipher, const char *name, uint32_t flags)
int botan_mp_is_zero(const botan_mp_t mp)
int botan_block_cipher_clear(botan_block_cipher_t bc)
int botan_privkey_export(botan_privkey_t key, uint8_t out[], size_t *out_len, uint32_t flags)
int botan_hash_destroy(botan_hash_t hash)
int botan_block_cipher_block_size(botan_block_cipher_t bc)
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)
int botan_cipher_destroy(botan_cipher_t cipher)
int botan_mp_sub_u32(botan_mp_t result, const botan_mp_t x, uint32_t y)
int botan_mp_is_even(const botan_mp_t mp)
int botan_cipher_name(botan_cipher_t cipher, char *name, size_t *name_len)
int botan_cipher_set_associated_data(botan_cipher_t cipher, const uint8_t *ad, size_t ad_len)
int botan_cipher_get_keyspec(botan_cipher_t, size_t *min_keylen, size_t *max_keylen, size_t *mod_keylen)
int botan_privkey_destroy(botan_privkey_t key)
int botan_block_cipher_decrypt_blocks(botan_block_cipher_t bc, const uint8_t in[], uint8_t out[], size_t blocks)
int botan_mp_is_prime(const botan_mp_t n, botan_rng_t rng, size_t test_prob)
int botan_hash_clear(botan_hash_t hash)
int botan_mp_swap(botan_mp_t x, botan_mp_t y)
int botan_mp_destroy(botan_mp_t mp)
uint32_t botan_ffi_api_version(void)
int botan_mp_is_positive(const botan_mp_t mp)
int botan_hash_output_length(botan_hash_t hash, size_t *output_length)
int botan_privkey_load_sm2(botan_privkey_t *key, const botan_mp_t scalar, const char *curve_name)
int botan_mp_rand_bits(botan_mp_t rand_out, botan_rng_t rng, size_t bits)
int botan_cipher_set_key(botan_cipher_t cipher, const uint8_t *key, size_t key_len)
int botan_cipher_query_keylen(botan_cipher_t, size_t *out_minimum_keylength, size_t *out_maximum_keylength)
int botan_mp_set_from_str(botan_mp_t dest, const char *str)
int botan_mp_flip_sign(botan_mp_t mp)
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)
int botan_mp_clear_bit(botan_mp_t n, size_t bit)
int botan_mp_mod_inverse(botan_mp_t out, const botan_mp_t in, const botan_mp_t modulus)
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)
struct botan_block_cipher_struct * botan_block_cipher_t
const char * botan_version_string(void)
int botan_mp_num_bits(const botan_mp_t n, size_t *bits)
int botan_hex_encode(const uint8_t *x, size_t len, char *out, uint32_t flags)
int botan_mp_clear(botan_mp_t mp)
int botan_hash_copy_state(botan_hash_t *dest, const botan_hash_t source)
int botan_mac_final(botan_mac_t mac, uint8_t out[])
int botan_block_cipher_name(botan_block_cipher_t cipher, char *name, size_t *name_len)
int botan_rng_get(botan_rng_t rng, uint8_t *out, size_t out_len)
int botan_scrub_mem(void *mem, size_t bytes)
int botan_privkey_create(botan_privkey_t *key, const char *algo_name, const char *algo_params, botan_rng_t rng)
int botan_mp_is_odd(const botan_mp_t mp)
int botan_mac_update(botan_mac_t mac, const uint8_t *buf, size_t len)
int botan_mp_div(botan_mp_t quotient, botan_mp_t remainder, const botan_mp_t x, const botan_mp_t y)
int botan_privkey_create_mceliece(botan_privkey_t *key, botan_rng_t rng, size_t n, size_t t)
int botan_privkey_algo_name(botan_privkey_t key, char out[], size_t *out_len)
int botan_hash_block_size(botan_hash_t hash, size_t *block_size)
int botan_mp_rshift(botan_mp_t out, const botan_mp_t in, size_t shift)
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_to_uint32(const botan_mp_t mp, uint32_t *val)
int botan_pubkey_get_field(botan_mp_t output, botan_pubkey_t key, const char *field_name)
int botan_privkey_create_dsa(botan_privkey_t *key, botan_rng_t rng, size_t pbits, size_t qbits)
struct botan_mp_struct * botan_mp_t
struct botan_rng_struct * botan_rng_t
int botan_block_cipher_destroy(botan_block_cipher_t bc)
@ 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_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
int 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)
int botan_mac_name(botan_mac_t mac, char *name, size_t *name_len)
int botan_cipher_clear(botan_cipher_t hash)
int botan_mp_is_negative(const botan_mp_t mp)
int botan_mp_get_bit(const botan_mp_t n, size_t bit)
int botan_mp_to_hex(const botan_mp_t mp, char *out)
int botan_rng_destroy(botan_rng_t rng)
int botan_ffi_supports_api(uint32_t api_version)
const char * botan_error_description(int err)
int botan_mp_num_bytes(const botan_mp_t n, size_t *bytes)
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_mac_get_keyspec(botan_mac_t mac, size_t *out_minimum_keylength, size_t *out_maximum_keylength, size_t *out_keylength_modulo)
struct botan_cipher_struct * botan_cipher_t
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)
int botan_mac_output_length(botan_mac_t mac, size_t *output_length)
int botan_mp_add(botan_mp_t result, const botan_mp_t x, const botan_mp_t y)
int botan_constant_time_compare(const uint8_t *x, const uint8_t *y, size_t len)
int botan_hex_decode(const char *hex_str, size_t in_len, uint8_t *out, size_t *out_len)
int botan_mac_set_key(botan_mac_t mac, const uint8_t *key, size_t key_len)
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_privkey_create_ecdh(botan_privkey_t *key, botan_rng_t rng, const char *params)
int botan_rng_init(botan_rng_t *rng, const char *rng_type)
int botan_block_cipher_encrypt_blocks(botan_block_cipher_t bc, const uint8_t in[], uint8_t out[], size_t blocks)
int botan_mp_lshift(botan_mp_t out, const botan_mp_t in, size_t shift)
int botan_cipher_get_default_nonce_length(botan_cipher_t cipher, size_t *nl)
int botan_mp_equal(const botan_mp_t x, const botan_mp_t y)
int botan_cipher_get_update_granularity(botan_cipher_t cipher, size_t *ug)
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)
int botan_mac_clear(botan_mac_t mac)
int botan_block_cipher_set_key(botan_block_cipher_t bc, const uint8_t key[], size_t len)
int botan_mp_set_bit(botan_mp_t n, size_t bit)
int botan_bcrypt_is_valid(const char *pass, const char *hash)
struct botan_hash_struct * botan_hash_t