Botan 2.1.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

ffi.h
Go to the documentation of this file.
1 /*
2 * FFI (C89 API)
3 * (C) 2015,2017 Jack Lloyd
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 */
7
8 #ifndef BOTAN_FFI_H__
9 #define BOTAN_FFI_H__
10
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14
15 /*
16 This header exports some of botan's functionality via a C89
17 interface. This API is uesd by the Python and OCaml bindings via those
18 languages respective ctypes libraries.
19
20 The API is intended to be as easy as possible to call from other
21 languages, which often have easy ways to call C, because C. But some C
22 code is easier to deal with than others, so to make things easy this
23 API follows a few simple rules:
24
25 - All interactions are via pointers to opaque structs. No need to worry about
26 structure padding issues and the like.
27
28 - All functions return an int error code (except the version calls, which are
29 assumed to always have something to say).
30
31 - Use simple types: size_t for lengths, const char* NULL terminated strings,
32 uint8_t for binary.
33
34 - No ownership of memory transfers across the API boundary. The API will
35 consume data from const pointers, and will produce output by writing to
36 variables provided by the caller.
37
38 - If exporting a value (a string or a blob) the function takes a pointer to the
39 output array and a read/write pointer to the length. If the length is insufficient, an
40 error is returned. So passing nullptr/0 allows querying the final value.
41
42 Note this does not apply to all functions, like `botan_hash_final`
43 which is not idempotent and are documented specially. But it's a
44 general theory of operation.
45
46 The API is not currently documented, nor should it be considered
47 stable. It is buggy as heck, most likely, and error handling is a
48 mess. However the goal is to provide a long term API usable for
49 language bindings, or for use by systems written in C. Suggestions on
50 how to provide the cleanest API for such users would be most welcome.
51
52 * TODO:
53 * - Better error reporting
54 * - User callback for exception logging?
55 * - Doxygen comments for all functions/params
56 * - X.509 certs and PKIX path validation goo
57 * - TLS
58 */
59
60 #include <botan/build.h>
61 #include <stdint.h>
62 #include <stddef.h>
63
64 /**
65 * Return the version of the currently supported FFI API. This is
66 * expressed in the form YYYYMMDD of the release date of this version
67 * of the API.
68 */
69 BOTAN_DLL uint32_t botan_ffi_api_version();
70
71 /**
72 * Return 0 (ok) if the version given is one this library supports.
73 * botan_ffi_supports_api(botan_ffi_api_version()) will always return 0.
74 */
75 BOTAN_DLL int botan_ffi_supports_api(uint32_t api_version);
76
77 /**
78 * Return a free-form version string, e.g., 2.0.0
79 */
80 BOTAN_DLL const char* botan_version_string();
81
82 /**
83 * Return the major version of the library
84 */
85 BOTAN_DLL uint32_t botan_version_major();
86
87 /**
88 * Return the minor version of the library
89 */
90 BOTAN_DLL uint32_t botan_version_minor();
91
92 /**
93 * Return the patch version of the library
94 */
95 BOTAN_DLL uint32_t botan_version_patch();
96
97 /**
98 * Return the date this version was released as
99 * an integer, or 0 if an unreleased version
100 */
101 BOTAN_DLL uint32_t botan_version_datestamp();
102
103 /*
104 * Error handling
105 *
106 * Some way of exporting these values to other languages would be useful
107
108
109 THIS FUNCTION ASSUMES BOTH ARGUMENTS ARE LITERAL STRINGS
110 so it retains only the pointers and does not make a copy.
111
112 int botan_make_error(const char* msg, const char* func, int line);
113 * This value is returned to callers ^^
114
115 normally called like
116 return botan_make_error(BOTAN_ERROR_STRING_NOT_IMPLEMENTED, BOTAN_FUNCTION, __LINE__);
117
118 // This would seem to require both saving the message permanently
119 catch(std::exception& e) {
120 return botan_make_error_from_transient_string(e.what(), BOTAN_FUNCTION, __LINE__);
121 }
122
123 #define botan_make_error_inf(s) return botan_make_error(s, BOTAN_FUNCTION, __LINE__);
124
125 Easier to return a const char* from each function directly? However,
126
127 catch(std::exception& e) { return e.what(); }
128
129 doesn't exactly work well either!
130
131 *
132 * Later call:
133 * const char* botan_get_error_str(int);
134 * To recover the msg, func, and line
135
136 */
137 #define BOTAN_FFI_ERROR_INSUFFICIENT_BUFFER_SPACE (-10)
138 #define BOTAN_FFI_ERROR_EXCEPTION_THROWN (-20)
139 #define BOTAN_FFI_ERROR_BAD_FLAG (-30)
140 #define BOTAN_FFI_ERROR_NULL_POINTER (-31)
141 #define BOTAN_FFI_ERROR_NOT_IMPLEMENTED (-40)
142
143 //const char* botan_error_description(int err);
144
145 /**
146 * Returns 0 if x[0..len] == y[0..len], or otherwise -1
147 */
148 BOTAN_DLL int botan_same_mem(const uint8_t* x, const uint8_t* y, size_t len);
149
150 #define BOTAN_FFI_HEX_LOWER_CASE 1
151
152 /**
153 * Perform hex encoding
154 * @param x is some binary data
155 * @param len length of x in bytes
156 * @param out an array of at least x*2 bytes
157 * @param flags flags out be upper or lower case?
158 * @return 0 on success, 1 on failure
159 */
160 BOTAN_DLL int botan_hex_encode(const uint8_t* x, size_t len, char* out, uint32_t flags);
161
162 // TODO: botan_hex_decode
163 // TODO: botan_base64_encode
164 // TODO: botan_base64_decode
165
166 /**
167 * RNG type
168 */
169 typedef struct botan_rng_struct* botan_rng_t;
170
171 /**
172 * Initialize a random number generator object
173 * @param rng rng object
174 * @param rng_type type of the rng, possible values:
175 * "system": System_RNG, "user": AutoSeeded_RNG
176 * Set rng_type to null or empty string to let the library choose
177 *
178 * TODO: replace rng_type with simple flags?
179 */
180 BOTAN_DLL int botan_rng_init(botan_rng_t* rng, const char* rng_type);
181
182 /**
183 * Get random bytes from a random number generator
184 * @param rng rng object
185 * @param out output buffer of size out_len
186 * @param out_len number of requested bytes
187 * @return 0 on success, negative on failure
188 *
189 * TODO: better name
190 */
191 BOTAN_DLL int botan_rng_get(botan_rng_t rng, uint8_t* out, size_t out_len);
192
193 /**
194 * Reseed a random number generator
195 * Uses the System_RNG as a seed generator.
196 *
197 * @param rng rng object
198 * @param bits number of bits to to reseed with
199 * @return 0 on success, a negative value on failure
200 */
201 BOTAN_DLL int botan_rng_reseed(botan_rng_t rng, size_t bits);
202
203 /**
204 * Frees all resources of the random number generator object
205 * @param rng rng object
206 * @return always returns 0
207 */
208 BOTAN_DLL int botan_rng_destroy(botan_rng_t rng);
209
210 /*
211 * Hash type
212 */
213 typedef struct botan_hash_struct* botan_hash_t;
214
215 /**
216 * Initialize a hash function object
217 * @param hash hash object
218 * @param hash_name name of the hash function, e.g., "SHA-384"
219 * @param flags should be 0 in current API revision, all other uses are reserved
220 * and return BOTAN_FFI_ERROR_BAD_FLAG
221 *
222 * TODO: since output_length is effectively required to use this API,
223 * return it from init as an output parameter
224 */
225 BOTAN_DLL int botan_hash_init(botan_hash_t* hash, const char* hash_name, uint32_t flags);
226
227 /**
228 * Writes the output length of the hash function to *output_length
229 * @param hash hash object
230 * @param output_length output buffer to hold the hash function output length
231 * @return 0 on success, a negative value on failure
232 */
233 BOTAN_DLL int botan_hash_output_length(botan_hash_t hash, size_t* output_length);
234
235 /**
236 * Send more input to the hash function
237 * @param hash hash object
238 * @param in input buffer
239 * @param in_len number of bytes to read from the input buffer
240 * @return 0 on success, a negative value on failure
241 */
242 BOTAN_DLL int botan_hash_update(botan_hash_t hash, const uint8_t* in, size_t in_len);
243
244 /**
245 * Finalizes the hash computation and writes the output to
246 * out[0:botan_hash_output_length()] then reinitializes for computing
247 * another digest as if botan_hash_clear had been called.
248 * @param hash hash object
249 * @param out output buffer
250 * @return 0 on success, a negative value on failure
251 */
252 BOTAN_DLL int botan_hash_final(botan_hash_t hash, uint8_t out[]);
253
254 /**
255 * Reinitializes the state of the hash computation. A hash can
256 * be computed (with update/final) immediately.
257 * @param hash hash object
258 * @return 0 on success, a negative value on failure
259 */
260 BOTAN_DLL int botan_hash_clear(botan_hash_t hash);
261
262 /**
263 * Frees all resources of the hash object
264 * @param hash hash object
265 * @return always returns 0
266 */
267 BOTAN_DLL int botan_hash_destroy(botan_hash_t hash);
268
269 /**
270 * TODO has no implementation
271 */
272 BOTAN_DLL int botan_hash_name(botan_hash_t hash, char* name, size_t name_len);
273
274 /*
275 * Message Authentication type
276 */
277 typedef struct botan_mac_struct* botan_mac_t;
278
279 /**
280 * Initialize a message authentication code object
281 * @param mac mac object
282 * @param mac_name name of the hash function, e.g., "HMAC(SHA-384)"
283 * @param flags should be 0 in current API revision, all other uses are reserved
284 * and return a negative value (error code)
285 * @return 0 on success, a negative value on failure
286 */
287 BOTAN_DLL int botan_mac_init(botan_mac_t* mac, const char* mac_name, uint32_t flags);
288
289 /**
290 * Writes the output length of the message authentication code to *output_length
291 * @param mac mac object
292 * @param output_length output buffer to hold the MAC output length
293 * @return 0 on success, a negative value on failure
294 */
295 BOTAN_DLL int botan_mac_output_length(botan_mac_t mac, size_t* output_length);
296
297 /**
298 * Sets the key on the MAC
299 * @param mac mac object
300 * @param key buffer holding the key
301 * @param key_len size of the key buffer in bytes
302 * @return 0 on success, a negative value on failure
303 */
304 BOTAN_DLL int botan_mac_set_key(botan_mac_t mac, const uint8_t* key, size_t key_len);
305
306 /**
307 * Send more input to the message authentication code
308 * @param mac mac object
309 * @param buf input buffer
310 * @param len number of bytes to read from the input buffer
311 * @return 0 on success, a negative value on failure
312 */
313 BOTAN_DLL int botan_mac_update(botan_mac_t mac, const uint8_t* buf, size_t len);
314
315 /**
316 * Finalizes the MAC computation and writes the output to
317 * out[0:botan_mac_output_length()] then reinitializes for computing
318 * another MAC as if botan_mac_clear had been called.
319 * @param mac mac object
320 * @param out output buffer
321 * @return 0 on success, a negative value on failure
322 */
323 BOTAN_DLL int botan_mac_final(botan_mac_t mac, uint8_t out[]);
324
325 /**
326 * Reinitializes the state of the MAC computation. A MAC can
327 * be computed (with update/final) immediately.
328 * @param mac mac object
329 * @return 0 on success, a negative value on failure
330 */
331 BOTAN_DLL int botan_mac_clear(botan_mac_t mac);
332
333 /**
334 * Frees all resources of the MAC object
335 * @param mac mac object
336 * @return always returns 0
337 */
338 BOTAN_DLL int botan_mac_destroy(botan_mac_t mac);
339
340 /*
341 * Cipher modes
342 */
343 typedef struct botan_cipher_struct* botan_cipher_t;
344
345 #define BOTAN_CIPHER_INIT_FLAG_MASK_DIRECTION 1
346 #define BOTAN_CIPHER_INIT_FLAG_ENCRYPT 0
347 #define BOTAN_CIPHER_INIT_FLAG_DECRYPT 1
348
349 BOTAN_DLL int botan_cipher_init(botan_cipher_t* cipher, const char* name, uint32_t flags);
350
351 BOTAN_DLL int botan_cipher_valid_nonce_length(botan_cipher_t cipher, size_t nl);
352 BOTAN_DLL int botan_cipher_get_tag_length(botan_cipher_t cipher, size_t* tag_size);
353 BOTAN_DLL int botan_cipher_get_default_nonce_length(botan_cipher_t cipher, size_t* nl);
354 BOTAN_DLL int botan_cipher_get_update_granularity(botan_cipher_t cipher, size_t* ug);
355
356 BOTAN_DLL int botan_cipher_query_keylen(botan_cipher_t,
357 size_t* out_minimum_keylength,
358 size_t* out_maximum_keylength);
359
360 BOTAN_DLL int botan_cipher_set_key(botan_cipher_t cipher,
361 const uint8_t* key, size_t key_len);
362
363 BOTAN_DLL int botan_cipher_set_associated_data(botan_cipher_t cipher,
364 const uint8_t* ad, size_t ad_len);
365
366 BOTAN_DLL int botan_cipher_start(botan_cipher_t cipher,
367 const uint8_t* nonce, size_t nonce_len);
368
369 #define BOTAN_CIPHER_UPDATE_FLAG_FINAL (1U << 0)
370
371 BOTAN_DLL int botan_cipher_update(botan_cipher_t cipher,
372 uint32_t flags,
373 uint8_t output[],
374 size_t output_size,
375 size_t* output_written,
376 const uint8_t input_bytes[],
377 size_t input_size,
378 size_t* input_consumed);
379
380 BOTAN_DLL int botan_cipher_clear(botan_cipher_t hash);
381 BOTAN_DLL int botan_cipher_destroy(botan_cipher_t cipher);
382
383 /*
384 * Derive a key from a passphrase for a number of iterations
385 * @param pbkdf_algo PBKDF algorithm, e.g., "PBKDF2"
386 * @param out buffer to store the derived key, must be of out_len bytes
387 * @param out_len the desired length of the key to produce
388 * @param passphrase the password to derive the key from
389 * @param salt a randomly chosen salt
390 * @param salt_len length of salt in bytes
391 * @param iterations the number of iterations to use (use 10K or more)
392 * @return 0 on success, a negative value on failure
393 */
394 BOTAN_DLL int botan_pbkdf(const char* pbkdf_algo,
395 uint8_t out[], size_t out_len,
396 const char* passphrase,
397 const uint8_t salt[], size_t salt_len,
398 size_t iterations);
399
400 /**
401 * Derive a key from a passphrase, running until msec time has elapsed.
402 * @param pbkdf_algo PBKDF algorithm, e.g., "PBKDF2"
403 * @param out buffer to store the derived key, must be of out_len bytes
404 * @param out_len the desired length of the key to produce
405 * @param passphrase the password to derive the key from
406 * @param salt a randomly chosen salt
407 * @param salt_len length of salt in bytes
408 * @param milliseconds_to_run if iterations is zero, then instead the PBKDF is
409 * run until milliseconds_to_run milliseconds has passed
410 * @param out_iterations_used set to the number iterations executed
411 * @return 0 on success, a negative value on failure
412 */
413 BOTAN_DLL int botan_pbkdf_timed(const char* pbkdf_algo,
414 uint8_t out[], size_t out_len,
415 const char* passphrase,
416 const uint8_t salt[], size_t salt_len,
417 size_t milliseconds_to_run,
418 size_t* out_iterations_used);
419
420 /**
421 * Derive a key
422 * @param kdf_algo KDF algorithm, e.g., "SP800-56C"
423 * @param out buffer holding the derived key, must be of length out_len
424 * @param out_len the desired output length in bytes
425 * @param secret the secret input
426 * @param secret_len size of secret in bytes
427 * @param salt a diversifier
428 * @param salt_len size of salt in bytes
429 * @param label purpose for the derived keying material
430 * @param label_len size of label in bytes
431 * @return 0 on success, a negative value on failure
432 */
433 BOTAN_DLL int botan_kdf(const char* kdf_algo,
434 uint8_t out[], size_t out_len,
435 const uint8_t secret[], size_t secret_len,
436 const uint8_t salt[], size_t salt_len,
437 const uint8_t label[], size_t label_len);
438
439 /**
440 * Create a password hash using Bcrypt
441 * @param out buffer holding the password hash, should be of length 64 bytes
442 * @param out_len the desired output length in bytes
443 * @param password the password
444 * @param rng a random number generator
445 * @param work_factor how much work to do to slow down guessing attacks
446 * @param flags should be 0 in current API revision, all other uses are reserved
447 * and return BOTAN_FFI_ERROR_BAD_FLAG
448 * @return 0 on success, a negative value on failure
449
450 * Output is formatted bcrypt $2a$...
451 */
452 BOTAN_DLL int botan_bcrypt_generate(uint8_t* out, size_t* out_len,
453 const char* password,
454 botan_rng_t rng,
455 size_t work_factor,
456 uint32_t flags);
457
458 /*
459 * Raw Block Cipher (PRP) interface
460 */
461 typedef struct botan_block_cipher_struct* botan_block_cipher_t;
462
463 /**
464 * Initialize a block cipher object
465 */
466 BOTAN_DLL int botan_block_cipher_init(botan_block_cipher_t* bc,
467 const char* cipher_name);
468
469 /**
470 * Destroy a block cipher object
471 */
472 BOTAN_DLL int botan_block_cipher_destroy(botan_block_cipher_t bc);
473
474 /**
475 * Reinitializes the block cipher
476 * @return 0 on success, a negative value on failure
477 */
478 BOTAN_DLL int botan_block_cipher_clear(botan_block_cipher_t bc);
479
480 /**
481 * Set the key for a block cipher instance
482 */
483 BOTAN_DLL int botan_block_cipher_set_key(botan_block_cipher_t bc,
484 const uint8_t key[], size_t len);
485
486 /**
487 * Return the positive block size of this block cipher, or negative to
488 * indicate an error
489 */
490 BOTAN_DLL int botan_block_cipher_block_size(botan_block_cipher_t bc);
491
492 BOTAN_DLL int botan_block_cipher_encrypt_blocks(botan_block_cipher_t bc,
493 const uint8_t in[],
494 uint8_t out[],
495 size_t blocks);
496
497 BOTAN_DLL int botan_block_cipher_decrypt_blocks(botan_block_cipher_t bc,
498 const uint8_t in[],
499 uint8_t out[],
500 size_t blocks);
501
502
503 /*
504 * Multiple precision integers
505 */
506 typedef struct botan_mp_struct* botan_mp_t;
507
508 BOTAN_DLL int botan_mp_init(botan_mp_t* mp);
509 BOTAN_DLL int botan_mp_destroy(botan_mp_t mp);
510
511 // writes botan_mp_num_bytes(mp)*2 + 1 bytes to out[]
512 BOTAN_DLL int botan_mp_to_hex(const botan_mp_t mp, char* out);
513 BOTAN_DLL int botan_mp_to_str(const botan_mp_t mp, uint8_t base, char* out, size_t* out_len);
514
515 BOTAN_DLL int botan_mp_clear(botan_mp_t mp);
516
517 BOTAN_DLL int botan_mp_set_from_int(botan_mp_t mp, int initial_value);
518 BOTAN_DLL int botan_mp_set_from_mp(botan_mp_t dest, const botan_mp_t source);
519 BOTAN_DLL int botan_mp_set_from_str(botan_mp_t dest, const char* str);
520 BOTAN_DLL int botan_mp_set_from_radix_str(botan_mp_t dest, const char* str, size_t radix);
521
522 BOTAN_DLL int botan_mp_num_bits(const botan_mp_t n, size_t* bits);
523 BOTAN_DLL int botan_mp_num_bytes(const botan_mp_t n, size_t* bytes);
524
525 // Writes botan_mp_num_bytes(mp) to vec
526 BOTAN_DLL int botan_mp_to_bin(const botan_mp_t mp, uint8_t vec[]);
527 BOTAN_DLL int botan_mp_from_bin(const botan_mp_t mp, const uint8_t vec[], size_t vec_len);
528
529 BOTAN_DLL int botan_mp_to_uint32(const botan_mp_t mp, uint32_t* val);
530
531 /**
532 * Return true iff mp is greater than 0
533 */
534 BOTAN_DLL int botan_mp_is_positive(const botan_mp_t mp);
535
536 /**
537 * Return true iff mp is less than 0
538 */
539 BOTAN_DLL int botan_mp_is_negative(const botan_mp_t mp);
540
541 BOTAN_DLL int botan_mp_flip_sign(botan_mp_t mp);
542 //BOTAN_DLL int botan_mp_set_negative(botan_mp_t mp);
543
544 BOTAN_DLL int botan_mp_is_zero(const botan_mp_t mp);
545 BOTAN_DLL int botan_mp_is_odd(const botan_mp_t mp);
546 BOTAN_DLL int botan_mp_is_even(const botan_mp_t mp);
547
548 BOTAN_DLL int botan_mp_add(botan_mp_t result, const botan_mp_t x, const botan_mp_t y);
549 BOTAN_DLL int botan_mp_sub(botan_mp_t result, const botan_mp_t x, const botan_mp_t y);
550 BOTAN_DLL int botan_mp_mul(botan_mp_t result, const botan_mp_t x, const botan_mp_t y);
551
552 BOTAN_DLL int botan_mp_div(botan_mp_t quotient,
553 botan_mp_t remainder,
554 const botan_mp_t x, const botan_mp_t y);
555
556 BOTAN_DLL int botan_mp_mod_mul(botan_mp_t result, const botan_mp_t x,
557 const botan_mp_t y, const botan_mp_t mod);
558
559 /*
560 * Returns 0 if x != y
561 * Returns 1 if x == y
562 * Returns negative number on error
563 */
564 BOTAN_DLL int botan_mp_equal(const botan_mp_t x, const botan_mp_t y);
565
566 /*
567 * Sets *result to comparison result:
568 * -1 if x < y, 0 if x == y, 1 if x > y
569 * Returns negative number on error or zero on success
570 */
571 BOTAN_DLL int botan_mp_cmp(int* result, const botan_mp_t x, const botan_mp_t y);
572
573 /*
574 * Swap two botan_mp_t
575 */
576 BOTAN_DLL int botan_mp_swap(botan_mp_t x, botan_mp_t y);
577
578 // Return (base^exponent) % modulus
579 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);
580
581 BOTAN_DLL int botan_mp_lshift(botan_mp_t out, const botan_mp_t in, size_t shift);
582 BOTAN_DLL int botan_mp_rshift(botan_mp_t out, const botan_mp_t in, size_t shift);
583
584 BOTAN_DLL int botan_mp_mod_inverse(botan_mp_t out, const botan_mp_t in, const botan_mp_t modulus);
585
586 BOTAN_DLL int botan_mp_rand_bits(botan_mp_t rand_out, botan_rng_t rng, size_t bits);
587
588 BOTAN_DLL int botan_mp_rand_range(botan_mp_t rand_out, botan_rng_t rng,
589 const botan_mp_t lower_bound, const botan_mp_t upper_bound);
590
591 BOTAN_DLL int botan_mp_gcd(botan_mp_t out, const botan_mp_t x, const botan_mp_t y);
592
593 /**
594 * Returns 0 if n is not prime
595 * Returns 1 if n is prime
596 * Returns negative number on error
597 */
598 BOTAN_DLL int botan_mp_is_prime(const botan_mp_t n, botan_rng_t rng, size_t test_prob);
599
600 /**
601 * Returns 0 if specified bit of n is not set
602 * Returns 1 if specified bit of n is set
603 * Returns negative number on error
604 */
605 BOTAN_DLL int botan_mp_get_bit(const botan_mp_t n, size_t bit);
606
607 /**
608 * Set the specified bit
609 */
610 BOTAN_DLL int botan_mp_set_bit(botan_mp_t n, size_t bit);
611
612 /**
613 * Clear the specified bit
614 */
615 BOTAN_DLL int botan_mp_clear_bit(botan_mp_t n, size_t bit);
616
617 /* Bcrypt password hashing */
618
619 /**
620 * Check a previously created password hash
621 * @param pass the password to check against
622 * @param hash the stored hash to check against
623 * @return 0 if if this password/hash combination is valid,
624 * 1 if the combination is not valid (but otherwise well formed),
625 * negative on error
626 */
627 BOTAN_DLL int botan_bcrypt_is_valid(const char* pass, const char* hash);
628
629 /*
630 * Public/private key creation, import, ...
631 */
632 typedef struct botan_privkey_struct* botan_privkey_t;
633
634 BOTAN_DLL int botan_privkey_create(botan_privkey_t* key,
635 const char* algo_name,
636 const char* algo_params,
637 botan_rng_t rng);
638
639 #define BOTAN_CHECK_KEY_EXPENSIVE_TESTS 1
640
641 BOTAN_DLL int botan_privkey_check_key(botan_privkey_t key, botan_rng_t rng, uint32_t flags);
642
643 BOTAN_DLL int botan_privkey_create_rsa(botan_privkey_t* key, botan_rng_t rng, size_t n_bits);
644 BOTAN_DLL int botan_privkey_create_ecdsa(botan_privkey_t* key, botan_rng_t rng, const char* params);
645 BOTAN_DLL int botan_privkey_create_ecdh(botan_privkey_t* key, botan_rng_t rng, const char* params);
646 BOTAN_DLL int botan_privkey_create_mceliece(botan_privkey_t* key, botan_rng_t rng, size_t n, size_t t);
647
648 /*
649 * Input currently assumed to be PKCS #8 structure;
650 * Set password to NULL to indicate no encryption expected
651 */
652 BOTAN_DLL int botan_privkey_load(botan_privkey_t* key, botan_rng_t rng,
653 const uint8_t bits[], size_t len,
654 const char* password);
655
656 BOTAN_DLL int botan_privkey_destroy(botan_privkey_t key);
657
658 #define BOTAN_PRIVKEY_EXPORT_FLAG_DER 0
659 #define BOTAN_PRIVKEY_EXPORT_FLAG_PEM 1
660
661 /*
662 * On input *out_len is number of bytes in out[]
663 * On output *out_len is number of bytes written (or required)
664 * If out is not big enough no output is written, *out_len is set and 1 is returned
665 * Returns 0 on success and sets
666 * If some other error occurs a negative integer is returned.
667 */
668 BOTAN_DLL int botan_privkey_export(botan_privkey_t key,
669 uint8_t out[], size_t* out_len,
670 uint32_t flags);
671
672 /*
673 * Set encryption_algo to NULL or "" to have the library choose a default (recommended)
674 */
675 BOTAN_DEPRECATED("Use botan_privkey_export_encrypted_pbkdf_{msec,iter}")
676 BOTAN_DLL int botan_privkey_export_encrypted(botan_privkey_t key,
677 uint8_t out[], size_t* out_len,
678 botan_rng_t rng,
679 const char* passphrase,
680 const char* encryption_algo,
681 uint32_t flags);
682
683 /*
684 * Export a private key, running PBKDF for specified amount of time
685 * @param key the private key to export
686 */
687 BOTAN_DLL int botan_privkey_export_encrypted_pbkdf_msec(botan_privkey_t key,
688 uint8_t out[], size_t* out_len,
689 botan_rng_t rng,
690 const char* passphrase,
691 uint32_t pbkdf_msec_runtime,
692 size_t* pbkdf_iterations_out,
693 const char* cipher_algo,
694 const char* pbkdf_algo,
695 uint32_t flags);
696
697 /*
698 * Export a private key using the specified number of iterations.
699 */
700 BOTAN_DLL int botan_privkey_export_encrypted_pbkdf_iter(botan_privkey_t key,
701 uint8_t out[], size_t* out_len,
702 botan_rng_t rng,
703 const char* passphrase,
704 size_t pbkdf_iterations,
705 const char* cipher_algo,
706 const char* pbkdf_algo,
707 uint32_t flags);
708
709 typedef struct botan_pubkey_struct* botan_pubkey_t;
710
711 BOTAN_DLL int botan_pubkey_load(botan_pubkey_t* key, const uint8_t bits[], size_t len);
712
713 BOTAN_DLL int botan_privkey_export_pubkey(botan_pubkey_t* out, botan_privkey_t in);
714
715 BOTAN_DLL int botan_pubkey_export(botan_pubkey_t key, uint8_t out[], size_t* out_len, uint32_t flags);
716
717 BOTAN_DLL int botan_pubkey_algo_name(botan_pubkey_t key, char out[], size_t* out_len);
718
719 /**
720 * Returns 0 if key is valid, negative if invalid key or some other error
721 */
722 BOTAN_DLL int botan_pubkey_check_key(botan_pubkey_t key, botan_rng_t rng, uint32_t flags);
723
724 BOTAN_DLL int botan_pubkey_estimated_strength(botan_pubkey_t key, size_t* estimate);
725
726 BOTAN_DLL int botan_pubkey_fingerprint(botan_pubkey_t key, const char* hash,
727 uint8_t out[], size_t* out_len);
728
729 BOTAN_DLL int botan_pubkey_destroy(botan_pubkey_t key);
730
731 /*
732 * Get arbitrary named fields from public or privat keys
733 */
734 BOTAN_DLL int botan_pubkey_get_field(botan_mp_t output,
735 botan_pubkey_t key,
736 const char* field_name);
737
738 BOTAN_DLL int botan_privkey_get_field(botan_mp_t output,
739 botan_privkey_t key,
740 const char* field_name);
741
742 /*
743 * Algorithm specific key operations: RSA
744 */
745 BOTAN_DLL int botan_privkey_load_rsa(botan_privkey_t* key,
746 botan_mp_t p,
747 botan_mp_t q,
748 botan_mp_t d);
749
750 BOTAN_DLL int botan_privkey_rsa_get_p(botan_mp_t p, botan_privkey_t rsa_key);
751 BOTAN_DLL int botan_privkey_rsa_get_q(botan_mp_t q, botan_privkey_t rsa_key);
752 BOTAN_DLL int botan_privkey_rsa_get_d(botan_mp_t d, botan_privkey_t rsa_key);
753 BOTAN_DLL int botan_privkey_rsa_get_n(botan_mp_t n, botan_privkey_t rsa_key);
754 BOTAN_DLL int botan_privkey_rsa_get_e(botan_mp_t e, botan_privkey_t rsa_key);
755
756 BOTAN_DLL int botan_pubkey_load_rsa(botan_pubkey_t* key,
757 botan_mp_t n,
758 botan_mp_t e);
759
760 BOTAN_DLL int botan_pubkey_rsa_get_e(botan_mp_t e, botan_pubkey_t rsa_key);
761 BOTAN_DLL int botan_pubkey_rsa_get_n(botan_mp_t n, botan_pubkey_t rsa_key);
762
763 /*
764 * Algorithm specific key operations: DSA
765 */
766 BOTAN_DLL int botan_privkey_load_dsa(botan_privkey_t* key,
767 botan_mp_t p,
768 botan_mp_t q,
769 botan_mp_t g,
770 botan_mp_t x);
771
772 BOTAN_DLL int botan_pubkey_load_dsa(botan_pubkey_t* key,
773 botan_mp_t p,
774 botan_mp_t q,
775 botan_mp_t g,
776 botan_mp_t y);
777
778 BOTAN_DLL int botan_privkey_dsa_get_x(botan_mp_t n, botan_privkey_t key);
779
780 BOTAN_DLL int botan_pubkey_dsa_get_p(botan_mp_t p, botan_pubkey_t key);
781 BOTAN_DLL int botan_pubkey_dsa_get_q(botan_mp_t q, botan_pubkey_t key);
782 BOTAN_DLL int botan_pubkey_dsa_get_g(botan_mp_t d, botan_pubkey_t key);
783 BOTAN_DLL int botan_pubkey_dsa_get_y(botan_mp_t y, botan_pubkey_t key);
784
785 /*
786 * Public Key Encryption
787 */
788 typedef struct botan_pk_op_encrypt_struct* botan_pk_op_encrypt_t;
789
790 BOTAN_DLL int botan_pk_op_encrypt_create(botan_pk_op_encrypt_t* op,
791 botan_pubkey_t key,
792 const char* padding,
793 uint32_t flags);
794
795 BOTAN_DLL int botan_pk_op_encrypt_destroy(botan_pk_op_encrypt_t op);
796
797 BOTAN_DLL int botan_pk_op_encrypt(botan_pk_op_encrypt_t op,
798 botan_rng_t rng,
799 uint8_t out[], size_t* out_len,
800 const uint8_t plaintext[], size_t plaintext_len);
801
802 /*
803 * Public Key Decryption
804 */
805 typedef struct botan_pk_op_decrypt_struct* botan_pk_op_decrypt_t;
806
807 BOTAN_DLL int botan_pk_op_decrypt_create(botan_pk_op_decrypt_t* op,
808 botan_privkey_t key,
809 const char* padding,
810 uint32_t flags);
811 BOTAN_DLL int botan_pk_op_decrypt_destroy(botan_pk_op_decrypt_t op);
812
813 BOTAN_DLL int botan_pk_op_decrypt(botan_pk_op_decrypt_t op,
814 uint8_t out[], size_t* out_len,
815 uint8_t ciphertext[], size_t ciphertext_len);
816
817 /*
818 * Signature Generation
819 */
820 typedef struct botan_pk_op_sign_struct* botan_pk_op_sign_t;
821
822 BOTAN_DLL int botan_pk_op_sign_create(botan_pk_op_sign_t* op,
823 botan_privkey_t key,
824 const char* hash_and_padding,
825 uint32_t flags);
826 BOTAN_DLL int botan_pk_op_sign_destroy(botan_pk_op_sign_t op);
827
828 BOTAN_DLL int botan_pk_op_sign_update(botan_pk_op_sign_t op, const uint8_t in[], size_t in_len);
829 BOTAN_DLL int botan_pk_op_sign_finish(botan_pk_op_sign_t op, botan_rng_t rng,
830 uint8_t sig[], size_t* sig_len);
831
832 /*
833 * Signature Verification
834 */
835 typedef struct botan_pk_op_verify_struct* botan_pk_op_verify_t;
836
837 BOTAN_DLL int botan_pk_op_verify_create(botan_pk_op_verify_t* op,
838 botan_pubkey_t key,
839 const char* hash_and_padding,
840 uint32_t flags);
841 BOTAN_DLL int botan_pk_op_verify_destroy(botan_pk_op_verify_t op);
842
843 BOTAN_DLL int botan_pk_op_verify_update(botan_pk_op_verify_t op, const uint8_t in[], size_t in_len);
844 BOTAN_DLL int botan_pk_op_verify_finish(botan_pk_op_verify_t op, const uint8_t sig[], size_t sig_len);
845
846 /*
847 * Key Agreement
848 */
849 typedef struct botan_pk_op_ka_struct* botan_pk_op_ka_t;
850
851 BOTAN_DLL int botan_pk_op_key_agreement_create(botan_pk_op_ka_t* op,
852 botan_privkey_t key,
853 const char* kdf,
854 uint32_t flags);
855 BOTAN_DLL int botan_pk_op_key_agreement_destroy(botan_pk_op_ka_t op);
856
857 BOTAN_DLL int botan_pk_op_key_agreement_export_public(botan_privkey_t key,
858 uint8_t out[], size_t* out_len);
859
860 BOTAN_DLL int botan_pk_op_key_agreement(botan_pk_op_ka_t op,
861 uint8_t out[], size_t* out_len,
862 const uint8_t other_key[], size_t other_key_len,
863 const uint8_t salt[], size_t salt_len);
864
865
866 /*
867 *
868 * @param mce_key must be a McEliece key
869 * ct_len should be pt_len + n/8 + a few?
870 */
871 BOTAN_DLL int botan_mceies_encrypt(botan_pubkey_t mce_key,
872 botan_rng_t rng,
873 const char* aead,
874 const uint8_t pt[], size_t pt_len,
875 const uint8_t ad[], size_t ad_len,
876 uint8_t ct[], size_t* ct_len);
877
878 BOTAN_DLL int botan_mceies_decrypt(botan_privkey_t mce_key,
879 const char* aead,
880 const uint8_t ct[], size_t ct_len,
881 const uint8_t ad[], size_t ad_len,
882 uint8_t pt[], size_t* pt_len);
883
884
885
886 typedef struct botan_x509_cert_struct* botan_x509_cert_t;
887 BOTAN_DLL int botan_x509_cert_load(botan_x509_cert_t* cert_obj, const uint8_t cert[], size_t cert_len);
888 BOTAN_DLL int botan_x509_cert_load_file(botan_x509_cert_t* cert_obj, const char* filename);
889 BOTAN_DLL int botan_x509_cert_destroy(botan_x509_cert_t cert);
890
891 BOTAN_DLL int botan_x509_cert_gen_selfsigned(botan_x509_cert_t* cert,
892 botan_privkey_t key,
893 botan_rng_t rng,
894 const char* common_name,
895 const char* org_name);
896
897 // TODO: return botan_time_struct instead
898 BOTAN_DLL int botan_x509_cert_get_time_starts(botan_x509_cert_t cert, char out[], size_t* out_len);
899 BOTAN_DLL int botan_x509_cert_get_time_expires(botan_x509_cert_t cert, char out[], size_t* out_len);
900
901 BOTAN_DLL int botan_x509_cert_get_fingerprint(botan_x509_cert_t cert, const char* hash, uint8_t out[], size_t* out_len);
902
903 BOTAN_DLL int botan_x509_cert_get_serial_number(botan_x509_cert_t cert, uint8_t out[], size_t* out_len);
904 BOTAN_DLL int botan_x509_cert_get_authority_key_id(botan_x509_cert_t cert, uint8_t out[], size_t* out_len);
905 BOTAN_DLL int botan_x509_cert_get_subject_key_id(botan_x509_cert_t cert, uint8_t out[], size_t* out_len);
906
907 BOTAN_DLL int botan_x509_cert_path_verify(botan_x509_cert_t cert,
908 const char* ca_dir);
909
910 BOTAN_DLL int botan_x509_cert_get_public_key_bits(botan_x509_cert_t cert,
911 uint8_t out[], size_t* out_len);
912
913 BOTAN_DLL int botan_x509_cert_get_public_key(botan_x509_cert_t cert, botan_pubkey_t* key);
914
915 BOTAN_DLL int botan_x509_cert_get_issuer_dn(botan_x509_cert_t cert,
916 const char* key, size_t index,
917 uint8_t out[], size_t* out_len);
918
919 BOTAN_DLL int botan_x509_cert_get_subject_dn(botan_x509_cert_t cert,
920 const char* key, size_t index,
921 uint8_t out[], size_t* out_len);
922
923 BOTAN_DLL int botan_x509_cert_to_string(botan_x509_cert_t cert, char out[], size_t* out_len);
924
925 // Must match values of Key_Constraints in key_constraints.h
926 enum botan_x509_cert_key_constraints {
927 NO_CONSTRAINTS = 0,
928 DIGITAL_SIGNATURE = 32768,
929 NON_REPUDIATION = 16384,
930 KEY_ENCIPHERMENT = 8192,
931 DATA_ENCIPHERMENT = 4096,
932 KEY_AGREEMENT = 2048,
933 KEY_CERT_SIGN = 1024,
934 CRL_SIGN = 512,
935 ENCIPHER_ONLY = 256,
936 DECIPHER_ONLY = 128
937 };
938
939 BOTAN_DLL int botan_x509_cert_allowed_usage(botan_x509_cert_t cert, unsigned int key_usage);
940
941 /*
942 * TLS (WIP)
943 */
944 #if defined(BOTAN_HAS_TLS) && 0
945
946 typedef struct botan_tls_session_struct* botan_tls_session_t;
947
948 BOTAN_DLL int botan_tls_session_decrypt(botan_tls_session_t* session,
949 const uint8_t key[], size_t key_len,
950 const uint8_t blob[], size_t blob_len);
951
952 BOTAN_DLL int botan_tls_session_get_version(botan_tls_session_t session, uint16_t* tls_version);
953 BOTAN_DLL int botan_tls_session_get_ciphersuite(botan_tls_session_t session, uint16_t* ciphersuite);
954 BOTAN_DLL int botan_tls_session_encrypt(botan_tls_session_t session, botan_rng_t rng, uint8_t key[], size_t* key_len);
955
956 BOTAN_DLL int botan_tls_session_get_peer_certs(botan_tls_session_t session, botan_x509_cert_t certs[], size_t* cert_len);
957
958 // TODO: peer certs, validation, ...
959
960 typedef struct botan_tls_channel_struct* botan_tls_channel_t;
961
962 typedef void (*botan_tls_channel_output_fn)(void* application_data, const uint8_t* data, size_t data_len);
963
964 typedef void (*botan_tls_channel_data_cb)(void* application_data, const uint8_t* data, size_t data_len);
965
966 typedef void (*botan_tls_channel_alert_cb)(void* application_data, uint16_t alert_code);
967
968 typedef void (*botan_tls_channel_session_established)(void* application_data,
969 botan_tls_channel_t channel,
970 botan_tls_session_t session);
971
972 BOTAN_DLL int botan_tls_channel_init_client(botan_tls_channel_t* channel,
973 botan_tls_channel_output_fn output_fn,
974 botan_tls_channel_data_cb data_cb,
975 botan_tls_channel_alert_cb alert_cb,
976 botan_tls_channel_session_established session_cb,
977 const char* server_name);
978
979 BOTAN_DLL int botan_tls_channel_init_server(botan_tls_channel_t* channel,
980 botan_tls_channel_output_fn output_fn,
981 botan_tls_channel_data_cb data_cb,
982 botan_tls_channel_alert_cb alert_cb,
983 botan_tls_channel_session_established session_cb);
984
985 BOTAN_DLL int botan_tls_channel_received_data(botan_tls_channel_t chan,
986 const uint8_t input[], size_t len);
987
988 /**
989 * Returns 0 for client, 1 for server, negative for error
990 */
991 BOTAN_DLL int botan_tls_channel_type(botan_tls_channel_t chan);
992
993 BOTAN_DLL int botan_tls_channel_send(botan_tls_channel_t chan,
994 const uint8_t input[], size_t len);
995
996 BOTAN_DLL int botan_tls_channel_close(botan_tls_channel_t chan);
997
998 BOTAN_DLL int botan_tls_channel_destroy(botan_tls_channel_t chan);
999
1000 #endif
1001 #ifdef __cplusplus
1002 }
1003 #endif
1004
1005 #endif
botan_bcrypt_is_valid
BOTAN_DLL int botan_bcrypt_is_valid(const char *pass, const char *hash)
Definition: ffi.cpp:1090
botan_pubkey_rsa_get_e
BOTAN_DLL int botan_pubkey_rsa_get_e(botan_mp_t e, botan_pubkey_t rsa_key)
Definition: ffi.cpp:1597
botan_hash_name
BOTAN_DLL int botan_hash_name(botan_hash_t hash, char *name, size_t name_len)
botan_mac_destroy
BOTAN_DLL int botan_mac_destroy(botan_mac_t mac)
Definition: ffi.cpp:753
botan_pk_op_encrypt_create
BOTAN_DLL int botan_pk_op_encrypt_create(botan_pk_op_encrypt_t *op, botan_pubkey_t key, const char *padding, uint32_t flags)
Definition: ffi.cpp:1812
botan_mceies_decrypt
BOTAN_DLL int botan_mceies_decrypt(botan_privkey_t mce_key, const char *aead, const uint8_t ct[], size_t ct_len, const uint8_t ad[], size_t ad_len, uint8_t pt[], size_t *pt_len)
Definition: ffi.cpp:2208
botan_pk_op_key_agreement_create
BOTAN_DLL int botan_pk_op_key_agreement_create(botan_pk_op_ka_t *op, botan_privkey_t key, const char *kdf, uint32_t flags)
Definition: ffi.cpp:1992
botan_rng_init
BOTAN_DLL int botan_rng_init(botan_rng_t *rng, const char *rng_type)
Definition: ffi.cpp:289
botan_privkey_rsa_get_e
BOTAN_DLL int botan_privkey_rsa_get_e(botan_mp_t e, botan_privkey_t rsa_key)
Definition: ffi.cpp:1587
botan_mp_rshift
BOTAN_DLL int botan_mp_rshift(botan_mp_t out, const botan_mp_t in, size_t shift)
Definition: ffi.cpp:528
KEY_AGREEMENT
Definition: ffi.h:932
botan_x509_cert_get_time_starts
BOTAN_DLL int botan_x509_cert_get_time_starts(botan_x509_cert_t cert, char out[], size_t *out_len)
Definition: ffi.cpp:2112
botan_pubkey_dsa_get_p
BOTAN_DLL int botan_pubkey_dsa_get_p(botan_mp_t p, botan_pubkey_t key)
Definition: ffi.cpp:1612
botan_pk_op_sign_update
BOTAN_DLL int botan_pk_op_sign_update(botan_pk_op_sign_t op, const uint8_t in[], size_t in_len)
Definition: ffi.cpp:1933
botan_x509_cert_get_time_expires
BOTAN_DLL int botan_x509_cert_get_time_expires(botan_x509_cert_t cert, char out[], size_t *out_len)
Definition: ffi.cpp:2117
botan_rng_get
BOTAN_DLL int botan_rng_get(botan_rng_t rng, uint8_t *out, size_t out_len)
Definition: ffi.cpp:331
botan_pubkey_dsa_get_g
BOTAN_DLL int botan_pubkey_dsa_get_g(botan_mp_t d, botan_pubkey_t key)
Definition: ffi.cpp:1620
botan_ffi_api_version
BOTAN_DLL uint32_t botan_ffi_api_version()
Definition: ffi.cpp:242
botan_pk_op_key_agreement
BOTAN_DLL 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: ffi.cpp:2034
botan_mp_to_bin
BOTAN_DLL int botan_mp_to_bin(const botan_mp_t mp, uint8_t vec[])
Definition: ffi.cpp:441
botan_privkey_rsa_get_p
BOTAN_DLL int botan_privkey_rsa_get_p(botan_mp_t p, botan_privkey_t rsa_key)
Definition: ffi.cpp:1572
botan_pk_op_key_agreement_export_public
BOTAN_DLL int botan_pk_op_key_agreement_export_public(botan_privkey_t key, uint8_t out[], size_t *out_len)
Definition: ffi.cpp:2024
botan_mp_flip_sign
BOTAN_DLL int botan_mp_flip_sign(botan_mp_t mp)
Definition: ffi.cpp:405
CRL_SIGN
Definition: ffi.h:934
botan_hash_clear
BOTAN_DLL int botan_hash_clear(botan_hash_t hash)
Definition: ffi.cpp:712
botan_x509_cert_get_subject_dn
BOTAN_DLL 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: ffi.cpp:2186
botan_pubkey_algo_name
BOTAN_DLL int botan_pubkey_algo_name(botan_pubkey_t key, char out[], size_t *out_len)
Definition: ffi.cpp:1660
botan_pubkey_get_field
BOTAN_DLL int botan_pubkey_get_field(botan_mp_t output, botan_pubkey_t key, const char *field_name)
Definition: ffi.cpp:1544
botan_mp_equal
BOTAN_DLL int botan_mp_equal(const botan_mp_t x, const botan_mp_t y)
Definition: ffi.cpp:486
botan_same_mem
BOTAN_DLL int botan_same_mem(const uint8_t *x, const uint8_t *y, size_t len)
Definition: ffi.cpp:268
botan_pubkey_estimated_strength
BOTAN_DLL int botan_pubkey_estimated_strength(botan_pubkey_t key, size_t *estimate)
Definition: ffi.cpp:1798
botan_mp_add
BOTAN_DLL int botan_mp_add(botan_mp_t result, const botan_mp_t x, const botan_mp_t y)
Definition: ffi.cpp:460
botan_mp_num_bytes
BOTAN_DLL int botan_mp_num_bytes(const botan_mp_t n, size_t *bytes)
Definition: ffi.cpp:593
botan_bcrypt_generate
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)
Definition: ffi.cpp:1053
botan_block_cipher_set_key
BOTAN_DLL int botan_block_cipher_set_key(botan_block_cipher_t bc, const uint8_t key[], size_t len)
Definition: ffi.cpp:642
KEY_CERT_SIGN
Definition: ffi.h:933
botan_mac_set_key
BOTAN_DLL int botan_mac_set_key(botan_mac_t mac, const uint8_t *key, size_t key_len)
Definition: ffi.cpp:759
botan_pk_op_encrypt_t
struct botan_pk_op_encrypt_struct * botan_pk_op_encrypt_t
Definition: ffi.h:788
botan_x509_cert_path_verify
BOTAN_DLL int botan_x509_cert_path_verify(botan_x509_cert_t cert, const char *ca_dir)
botan_version_patch
BOTAN_DLL uint32_t botan_version_patch()
Definition: ffi.cpp:265
NON_REPUDIATION
Definition: ffi.h:929
botan_pubkey_rsa_get_n
BOTAN_DLL int botan_pubkey_rsa_get_n(botan_mp_t n, botan_pubkey_t rsa_key)
Definition: ffi.cpp:1602
botan_mp_clear
BOTAN_DLL int botan_mp_clear(botan_mp_t mp)
Definition: ffi.cpp:347
botan_x509_cert_get_authority_key_id
BOTAN_DLL int botan_x509_cert_get_authority_key_id(botan_x509_cert_t cert, uint8_t out[], size_t *out_len)
Definition: ffi.cpp:2132
botan_mp_from_bin
BOTAN_DLL int botan_mp_from_bin(const botan_mp_t mp, const uint8_t vec[], size_t vec_len)
Definition: ffi.cpp:410
botan_mp_is_negative
BOTAN_DLL int botan_mp_is_negative(const botan_mp_t mp)
Definition: ffi.cpp:395
botan_mp_get_bit
BOTAN_DLL int botan_mp_get_bit(const botan_mp_t n, size_t bit)
Definition: ffi.cpp:573
botan_version_minor
BOTAN_DLL uint32_t botan_version_minor()
Definition: ffi.cpp:264
botan_mac_output_length
BOTAN_DLL int botan_mac_output_length(botan_mac_t mac, size_t *output_length)
Definition: ffi.cpp:764
botan_x509_cert_gen_selfsigned
BOTAN_DLL int botan_x509_cert_gen_selfsigned(botan_x509_cert_t *cert, botan_privkey_t key, botan_rng_t rng, const char *common_name, const char *org_name)
botan_hash_final
BOTAN_DLL int botan_hash_final(botan_hash_t hash, uint8_t out[])
Definition: ffi.cpp:722
botan_pk_op_sign_t
struct botan_pk_op_sign_struct * botan_pk_op_sign_t
Definition: ffi.h:820
Botan::PKCS11::flags
Flags flags(Flag flags)
Definition: p11.h:858
botan_cipher_update
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)
Definition: ffi.cpp:853
botan_cipher_set_associated_data
BOTAN_DLL int botan_cipher_set_associated_data(botan_cipher_t cipher, const uint8_t *ad, size_t ad_len)
Definition: ffi.cpp:958
botan_x509_cert_load_file
BOTAN_DLL int botan_x509_cert_load_file(botan_x509_cert_t *cert_obj, const char *filename)
Definition: ffi.cpp:2045
botan_mac_final
BOTAN_DLL int botan_mac_final(botan_mac_t mac, uint8_t out[])
Definition: ffi.cpp:779
botan_pubkey_dsa_get_y
BOTAN_DLL int botan_pubkey_dsa_get_y(botan_mp_t y, botan_pubkey_t key)
Definition: ffi.cpp:1624
botan_mp_set_from_str
BOTAN_DLL int botan_mp_set_from_str(botan_mp_t dest, const char *str)
Definition: ffi.cpp:367
botan_cipher_set_key
BOTAN_DLL int botan_cipher_set_key(botan_cipher_t cipher, const uint8_t *key, size_t key_len)
Definition: ffi.cpp:829
botan_pk_op_decrypt_create
BOTAN_DLL int botan_pk_op_decrypt_create(botan_pk_op_decrypt_t *op, botan_privkey_t key, const char *padding, uint32_t flags)
Definition: ffi.cpp:1857
botan_mp_gcd
BOTAN_DLL int botan_mp_gcd(botan_mp_t out, const botan_mp_t x, const botan_mp_t y)
Definition: ffi.cpp:561
botan_privkey_export_encrypted_pbkdf_iter
BOTAN_DLL int botan_privkey_export_encrypted_pbkdf_iter(botan_privkey_t key, uint8_t out[], size_t *out_len, botan_rng_t rng, const char *passphrase, size_t pbkdf_iterations, const char *cipher_algo, const char *pbkdf_algo, uint32_t flags)
Definition: ffi.cpp:1757
botan_hash_init
BOTAN_DLL int botan_hash_init(botan_hash_t *hash, const char *hash_name, uint32_t flags)
Definition: ffi.cpp:673
botan_mp_is_even
BOTAN_DLL int botan_mp_is_even(const botan_mp_t mp)
Definition: ffi.cpp:501
botan_x509_cert_get_issuer_dn
BOTAN_DLL 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: ffi.cpp:2179
botan_privkey_get_field
BOTAN_DLL int botan_privkey_get_field(botan_mp_t output, botan_privkey_t key, const char *field_name)
Definition: ffi.cpp:1558
botan_mp_is_prime
BOTAN_DLL int botan_mp_is_prime(const botan_mp_t n, botan_rng_t rng, size_t test_prob)
Definition: ffi.cpp:567
botan_x509_cert_destroy
BOTAN_DLL int botan_x509_cert_destroy(botan_x509_cert_t cert)
Definition: ffi.cpp:2106
botan_mac_t
struct botan_mac_struct * botan_mac_t
Definition: ffi.h:277
botan_mp_to_str
BOTAN_DLL int botan_mp_to_str(const botan_mp_t mp, uint8_t base, char *out, size_t *out_len)
Definition: ffi.cpp:424
botan_x509_cert_load
BOTAN_DLL int botan_x509_cert_load(botan_x509_cert_t *cert_obj, const uint8_t cert[], size_t cert_len)
Definition: ffi.cpp:2076
botan_x509_cert_key_constraints
botan_x509_cert_key_constraints
Definition: ffi.h:926
botan_pubkey_fingerprint
BOTAN_DLL int botan_pubkey_fingerprint(botan_pubkey_t key, const char *hash, uint8_t out[], size_t *out_len)
Definition: ffi.cpp:1803
botan_version_string
BOTAN_DLL const char * botan_version_string()
Definition: ffi.cpp:258
DECIPHER_ONLY
Definition: ffi.h:936
NO_CONSTRAINTS
Definition: ffi.h:927
botan_pk_op_sign_finish
BOTAN_DLL int botan_pk_op_sign_finish(botan_pk_op_sign_t op, botan_rng_t rng, uint8_t sig[], size_t *sig_len)
Definition: ffi.cpp:1938
botan_block_cipher_decrypt_blocks
BOTAN_DLL int botan_block_cipher_decrypt_blocks(botan_block_cipher_t bc, const uint8_t in[], uint8_t out[], size_t blocks)
Definition: ffi.cpp:665
DIGITAL_SIGNATURE
Definition: ffi.h:928
botan_pk_op_key_agreement_destroy
BOTAN_DLL int botan_pk_op_key_agreement_destroy(botan_pk_op_ka_t op)
Definition: ffi.cpp:2018
botan_pk_op_verify_destroy
BOTAN_DLL int botan_pk_op_verify_destroy(botan_pk_op_verify_t op)
Definition: ffi.cpp:1969
botan_cipher_clear
BOTAN_DLL int botan_cipher_clear(botan_cipher_t hash)
Definition: ffi.cpp:814
botan_hash_output_length
BOTAN_DLL int botan_hash_output_length(botan_hash_t hash, size_t *output_length)
Definition: ffi.cpp:707
botan_privkey_export_encrypted_pbkdf_msec
BOTAN_DLL int botan_privkey_export_encrypted_pbkdf_msec(botan_privkey_t key, uint8_t out[], size_t *out_len, botan_rng_t rng, const char *passphrase, uint32_t pbkdf_msec_runtime, size_t *pbkdf_iterations_out, const char *cipher_algo, const char *pbkdf_algo, uint32_t flags)
Definition: ffi.cpp:1714
botan_cipher_valid_nonce_length
BOTAN_DLL int botan_cipher_valid_nonce_length(botan_cipher_t cipher, size_t nl)
Definition: ffi.cpp:972
botan_pk_op_decrypt_t
struct botan_pk_op_decrypt_struct * botan_pk_op_decrypt_t
Definition: ffi.h:805
botan_mp_t
struct botan_mp_struct * botan_mp_t
Definition: ffi.h:506
botan_pk_op_verify_finish
BOTAN_DLL int botan_pk_op_verify_finish(botan_pk_op_verify_t op, const uint8_t sig[], size_t sig_len)
Definition: ffi.cpp:1980
botan_pk_op_verify_create
BOTAN_DLL int botan_pk_op_verify_create(botan_pk_op_verify_t *op, botan_pubkey_t key, const char *hash_and_padding, uint32_t flags)
Definition: ffi.cpp:1945
botan_rng_destroy
BOTAN_DLL int botan_rng_destroy(botan_rng_t rng)
Definition: ffi.cpp:325
botan_x509_cert_t
struct botan_x509_cert_struct * botan_x509_cert_t
Definition: ffi.h:886
botan_privkey_create_rsa
BOTAN_DLL int botan_privkey_create_rsa(botan_privkey_t *key, botan_rng_t rng, size_t n_bits)
Definition: ffi.cpp:1154
botan_x509_cert_get_serial_number
BOTAN_DLL int botan_x509_cert_get_serial_number(botan_x509_cert_t cert, uint8_t out[], size_t *out_len)
Definition: ffi.cpp:2122
botan_pubkey_export
BOTAN_DLL int botan_pubkey_export(botan_pubkey_t key, uint8_t out[], size_t *out_len, uint32_t flags)
Definition: ffi.cpp:1680
botan_pubkey_check_key
BOTAN_DLL int botan_pubkey_check_key(botan_pubkey_t key, botan_rng_t rng, uint32_t flags)
Definition: ffi.cpp:1665
botan_pk_op_sign_destroy
BOTAN_DLL int botan_pk_op_sign_destroy(botan_pk_op_sign_t op)
Definition: ffi.cpp:1927
botan_pk_op_decrypt
BOTAN_DLL 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)
Definition: ffi.cpp:1889
botan_hash_t
struct botan_hash_struct * botan_hash_t
Definition: ffi.h:213
botan_privkey_dsa_get_x
BOTAN_DLL int botan_privkey_dsa_get_x(botan_mp_t n, botan_privkey_t key)
Definition: ffi.cpp:1607
botan_mp_rand_range
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)
Definition: ffi.cpp:552
botan_mp_destroy
BOTAN_DLL int botan_mp_destroy(botan_mp_t mp)
Definition: ffi.cpp:454
botan_mp_powmod
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)
Definition: ffi.cpp:517
botan_mp_mod_inverse
BOTAN_DLL int botan_mp_mod_inverse(botan_mp_t out, const botan_mp_t in, const botan_mp_t modulus)
Definition: ffi.cpp:533
botan_mp_clear_bit
BOTAN_DLL int botan_mp_clear_bit(botan_mp_t n, size_t bit)
Definition: ffi.cpp:583
botan_pk_op_encrypt
BOTAN_DLL int botan_pk_op_encrypt(botan_pk_op_encrypt_t op, botan_rng_t rng, uint8_t out[], size_t *out_len, const uint8_t plaintext[], size_t plaintext_len)
Definition: ffi.cpp:1844
botan_cipher_destroy
BOTAN_DLL int botan_cipher_destroy(botan_cipher_t cipher)
Definition: ffi.cpp:808
botan_cipher_init
BOTAN_DLL int botan_cipher_init(botan_cipher_t *cipher, const char *name, uint32_t flags)
Definition: ffi.cpp:784
botan_pk_op_sign_create
BOTAN_DLL int botan_pk_op_sign_create(botan_pk_op_sign_t *op, botan_privkey_t key, const char *hash_and_padding, uint32_t flags)
Definition: ffi.cpp:1901
botan_cipher_start
BOTAN_DLL int botan_cipher_start(botan_cipher_t cipher, const uint8_t *nonce, size_t nonce_len)
Definition: ffi.cpp:835
botan_privkey_load_rsa
BOTAN_DLL int botan_privkey_load_rsa(botan_privkey_t *key, botan_mp_t p, botan_mp_t q, botan_mp_t d)
Definition: ffi.cpp:1326
botan_pk_op_verify_t
struct botan_pk_op_verify_struct * botan_pk_op_verify_t
Definition: ffi.h:835
botan_privkey_rsa_get_n
BOTAN_DLL int botan_privkey_rsa_get_n(botan_mp_t n, botan_privkey_t rsa_key)
Definition: ffi.cpp:1582
botan_ffi_supports_api
BOTAN_DLL int botan_ffi_supports_api(uint32_t api_version)
Definition: ffi.cpp:247
botan_privkey_export_pubkey
BOTAN_DLL int botan_privkey_export_pubkey(botan_pubkey_t *out, botan_privkey_t in)
Definition: ffi.cpp:1642
botan_privkey_create_ecdh
BOTAN_DLL int botan_privkey_create_ecdh(botan_privkey_t *key, botan_rng_t rng, const char *params)
Definition: ffi.cpp:1235
botan_privkey_t
struct botan_privkey_struct * botan_privkey_t
Definition: ffi.h:632
botan_cipher_get_default_nonce_length
BOTAN_DLL int botan_cipher_get_default_nonce_length(botan_cipher_t cipher, size_t *nl)
Definition: ffi.cpp:977
botan_hash_update
BOTAN_DLL int botan_hash_update(botan_hash_t hash, const uint8_t *in, size_t in_len)
Definition: ffi.cpp:717
botan_mp_set_from_radix_str
BOTAN_DLL int botan_mp_set_from_radix_str(botan_mp_t dest, const char *str, size_t radix)
Definition: ffi.cpp:372
botan_mp_set_from_int
BOTAN_DLL int botan_mp_set_from_int(botan_mp_t mp, int initial_value)
Definition: ffi.cpp:352
botan_mp_swap
BOTAN_DLL int botan_mp_swap(botan_mp_t x, botan_mp_t y)
Definition: ffi.cpp:511
botan_mp_mul
BOTAN_DLL int botan_mp_mul(botan_mp_t result, const botan_mp_t x, const botan_mp_t y)
Definition: ffi.cpp:470
botan_mp_cmp
BOTAN_DLL int botan_mp_cmp(int *result, const botan_mp_t x, const botan_mp_t y)
Definition: ffi.cpp:506
botan_version_datestamp
BOTAN_DLL uint32_t botan_version_datestamp()
Definition: ffi.cpp:266
botan_mp_rand_bits
BOTAN_DLL int botan_mp_rand_bits(botan_mp_t rand_out, botan_rng_t rng, size_t bits)
Definition: ffi.cpp:546
botan_x509_cert_get_fingerprint
BOTAN_DLL int botan_x509_cert_get_fingerprint(botan_x509_cert_t cert, const char *hash, uint8_t out[], size_t *out_len)
Definition: ffi.cpp:2127
botan_pk_op_decrypt_destroy
BOTAN_DLL int botan_pk_op_decrypt_destroy(botan_pk_op_decrypt_t op)
Definition: ffi.cpp:1883
botan_privkey_check_key
BOTAN_DLL int botan_privkey_check_key(botan_privkey_t key, botan_rng_t rng, uint32_t flags)
Definition: ffi.cpp:1673
botan_pbkdf
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)
Definition: ffi.cpp:992
botan_block_cipher_init
BOTAN_DLL int botan_block_cipher_init(botan_block_cipher_t *bc, const char *cipher_name)
Definition: ffi.cpp:598
botan_cipher_get_tag_length
BOTAN_DLL int botan_cipher_get_tag_length(botan_cipher_t cipher, size_t *tag_size)
Definition: ffi.cpp:987
botan_pbkdf_timed
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)
Definition: ffi.cpp:1010
botan_x509_cert_get_public_key_bits
BOTAN_DLL int botan_x509_cert_get_public_key_bits(botan_x509_cert_t cert, uint8_t out[], size_t *out_len)
Definition: ffi.cpp:2142
botan_block_cipher_t
struct botan_block_cipher_struct * botan_block_cipher_t
Definition: ffi.h:461
botan_mp_num_bits
BOTAN_DLL int botan_mp_num_bits(const botan_mp_t n, size_t *bits)
Definition: ffi.cpp:588
botan_mceies_encrypt
BOTAN_DLL int botan_mceies_encrypt(botan_pubkey_t mce_key, botan_rng_t rng, const char *aead, const uint8_t pt[], size_t pt_len, const uint8_t ad[], size_t ad_len, uint8_t ct[], size_t *ct_len)
Definition: ffi.cpp:2235
botan_block_cipher_destroy
BOTAN_DLL int botan_block_cipher_destroy(botan_block_cipher_t bc)
Definition: ffi.cpp:628
botan_pk_op_verify_update
BOTAN_DLL int botan_pk_op_verify_update(botan_pk_op_verify_t op, const uint8_t in[], size_t in_len)
Definition: ffi.cpp:1975
botan_mp_mod_mul
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)
Definition: ffi.cpp:538
botan_mp_to_hex
BOTAN_DLL int botan_mp_to_hex(const botan_mp_t mp, char *out)
Definition: ffi.cpp:415
botan_mp_set_bit
BOTAN_DLL int botan_mp_set_bit(botan_mp_t n, size_t bit)
Definition: ffi.cpp:578
botan_kdf
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)
Definition: ffi.cpp:1033
botan_mp_is_zero
BOTAN_DLL int botan_mp_is_zero(const botan_mp_t mp)
Definition: ffi.cpp:491
botan_privkey_create_ecdsa
BOTAN_DLL int botan_privkey_create_ecdsa(botan_privkey_t *key, botan_rng_t rng, const char *params)
Definition: ffi.cpp:1183
botan_pubkey_load
BOTAN_DLL int botan_pubkey_load(botan_pubkey_t *key, const uint8_t bits[], size_t len)
Definition: ffi.cpp:1302
botan_version_major
BOTAN_DLL uint32_t botan_version_major()
Definition: ffi.cpp:263
botan_x509_cert_to_string
BOTAN_DLL int botan_x509_cert_to_string(botan_x509_cert_t cert, char out[], size_t *out_len)
Definition: ffi.cpp:2193
botan_x509_cert_get_public_key
BOTAN_DLL int botan_x509_cert_get_public_key(botan_x509_cert_t cert, botan_pubkey_t *key)
Definition: ffi.cpp:2154
BOTAN_DEPRECATED
#define BOTAN_DEPRECATED(msg)
Definition: compiler.h:79
botan_mp_is_odd
BOTAN_DLL int botan_mp_is_odd(const botan_mp_t mp)
Definition: ffi.cpp:496
botan_mp_is_positive
BOTAN_DLL int botan_mp_is_positive(const botan_mp_t mp)
Definition: ffi.cpp:400
botan_pubkey_load_rsa
BOTAN_DLL int botan_pubkey_load_rsa(botan_pubkey_t *key, botan_mp_t n, botan_mp_t e)
Definition: ffi.cpp:1349
botan_privkey_export
BOTAN_DLL int botan_privkey_export(botan_privkey_t key, uint8_t out[], size_t *out_len, uint32_t flags)
Definition: ffi.cpp:1692
botan_pubkey_dsa_get_q
BOTAN_DLL int botan_pubkey_dsa_get_q(botan_mp_t q, botan_pubkey_t key)
Definition: ffi.cpp:1616
botan_hex_encode
BOTAN_DLL int botan_hex_encode(const uint8_t *x, size_t len, char *out, uint32_t flags)
Definition: ffi.cpp:273
botan_pk_op_ka_t
struct botan_pk_op_ka_struct * botan_pk_op_ka_t
Definition: ffi.h:849
botan_pubkey_destroy
BOTAN_DLL int botan_pubkey_destroy(botan_pubkey_t key)
Definition: ffi.cpp:1636
botan_privkey_load_dsa
BOTAN_DLL 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: ffi.cpp:1371
botan_rng_reseed
BOTAN_DLL int botan_rng_reseed(botan_rng_t rng, size_t bits)
Definition: ffi.cpp:336
botan_privkey_create
BOTAN_DLL int botan_privkey_create(botan_privkey_t *key, const char *algo_name, const char *algo_params, botan_rng_t rng)
Definition: ffi.cpp:1113
botan_x509_cert_get_subject_key_id
BOTAN_DLL int botan_x509_cert_get_subject_key_id(botan_x509_cert_t cert, uint8_t out[], size_t *out_len)
Definition: ffi.cpp:2137
botan_mac_update
BOTAN_DLL int botan_mac_update(botan_mac_t mac, const uint8_t *buf, size_t len)
Definition: ffi.cpp:774
botan_privkey_rsa_get_d
BOTAN_DLL int botan_privkey_rsa_get_d(botan_mp_t d, botan_privkey_t rsa_key)
Definition: ffi.cpp:1592
botan_pubkey_t
struct botan_pubkey_struct * botan_pubkey_t
Definition: ffi.h:709
botan_privkey_destroy
BOTAN_DLL int botan_privkey_destroy(botan_privkey_t key)
Definition: ffi.cpp:1630
botan_hash_destroy
BOTAN_DLL int botan_hash_destroy(botan_hash_t hash)
Definition: ffi.cpp:701
DATA_ENCIPHERMENT
Definition: ffi.h:931
botan_mp_init
BOTAN_DLL int botan_mp_init(botan_mp_t *mp)
Definition: ffi.cpp:341
botan_cipher_t
struct botan_cipher_struct * botan_cipher_t
Definition: ffi.h:343
ENCIPHER_ONLY
Definition: ffi.h:935
botan_mac_init
BOTAN_DLL int botan_mac_init(botan_mac_t *mac, const char *mac_name, uint32_t flags)
Definition: ffi.cpp:727
botan_mp_set_from_mp
BOTAN_DLL int botan_mp_set_from_mp(botan_mp_t dest, const botan_mp_t source)
Definition: ffi.cpp:390
botan_mp_sub
BOTAN_DLL int botan_mp_sub(botan_mp_t result, const botan_mp_t x, const botan_mp_t y)
Definition: ffi.cpp:465
botan_privkey_create_mceliece
BOTAN_DLL int botan_privkey_create_mceliece(botan_privkey_t *key, botan_rng_t rng, size_t n, size_t t)
Definition: ffi.cpp:1210
botan_mp_lshift
BOTAN_DLL int botan_mp_lshift(botan_mp_t out, const botan_mp_t in, size_t shift)
Definition: ffi.cpp:523
botan_mp_div
BOTAN_DLL int botan_mp_div(botan_mp_t quotient, botan_mp_t remainder, const botan_mp_t x, const botan_mp_t y)
Definition: ffi.cpp:475
botan_cipher_get_update_granularity
BOTAN_DLL int botan_cipher_get_update_granularity(botan_cipher_t cipher, size_t *ug)
Definition: ffi.cpp:982
botan_cipher_query_keylen
BOTAN_DLL int botan_cipher_query_keylen(botan_cipher_t, size_t *out_minimum_keylength, size_t *out_maximum_keylength)
Definition: ffi.cpp:819
hash
MechanismType hash
Definition: p11_mechanism.cpp:63
botan_rng_t
struct botan_rng_struct * botan_rng_t
Definition: ffi.h:169
botan_mp_to_uint32
BOTAN_DLL int botan_mp_to_uint32(const botan_mp_t mp, uint32_t *val)
Definition: ffi.cpp:446
botan_privkey_load
BOTAN_DLL int botan_privkey_load(botan_privkey_t *key, botan_rng_t rng, const uint8_t bits[], size_t len, const char *password)
Definition: ffi.cpp:1270
botan_x509_cert_allowed_usage
BOTAN_DLL int botan_x509_cert_allowed_usage(botan_x509_cert_t cert, unsigned int key_usage)
Definition: ffi.cpp:2198
botan_privkey_export_encrypted
BOTAN_DLL int botan_privkey_export_encrypted(botan_privkey_t key, uint8_t out[], size_t *out_len, botan_rng_t rng, const char *passphrase, const char *encryption_algo, uint32_t flags)
Definition: ffi.cpp:1704
botan_block_cipher_clear
BOTAN_DLL int botan_block_cipher_clear(botan_block_cipher_t bc)
Definition: ffi.cpp:634
botan_privkey_rsa_get_q
BOTAN_DLL int botan_privkey_rsa_get_q(botan_mp_t q, botan_privkey_t rsa_key)
Definition: ffi.cpp:1577
KEY_ENCIPHERMENT
Definition: ffi.h:930
botan_mac_clear
BOTAN_DLL int botan_mac_clear(botan_mac_t mac)
Definition: ffi.cpp:769
botan_block_cipher_block_size
BOTAN_DLL int botan_block_cipher_block_size(botan_block_cipher_t bc)
Definition: ffi.cpp:652
botan_block_cipher_encrypt_blocks
BOTAN_DLL int botan_block_cipher_encrypt_blocks(botan_block_cipher_t bc, const uint8_t in[], uint8_t out[], size_t blocks)
Definition: ffi.cpp:657
botan_pk_op_encrypt_destroy
BOTAN_DLL int botan_pk_op_encrypt_destroy(botan_pk_op_encrypt_t op)
Definition: ffi.cpp:1838
botan_pubkey_load_dsa
BOTAN_DLL 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: ffi.cpp:1398