From 8bbec86f8984b52b5d0cce8cd1309563d2b294cc Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Sun, 26 Feb 2017 15:48:35 -0500 Subject: Add ability to specify iterations when encrypting a private key GH #896 --- src/lib/ffi/ffi.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/lib/ffi/ffi.h') diff --git a/src/lib/ffi/ffi.h b/src/lib/ffi/ffi.h index 264c3d24d..98792d4bd 100644 --- a/src/lib/ffi/ffi.h +++ b/src/lib/ffi/ffi.h @@ -506,6 +506,7 @@ BOTAN_DLL int botan_privkey_export(botan_privkey_t key, /* * Set encryption_algo to NULL or "" to have the library choose a default (recommended) */ +BOTAN_DEPRECATED("Use botan_privkey_export_encrypted_pbkdf_{msec,iter}") BOTAN_DLL int botan_privkey_export_encrypted(botan_privkey_t key, uint8_t out[], size_t* out_len, botan_rng_t rng, @@ -513,6 +514,32 @@ BOTAN_DLL int botan_privkey_export_encrypted(botan_privkey_t key, const char* encryption_algo, uint32_t flags); +/* +* Export a private key, running PBKDF for specified amount of time +* @param key the private key to export +*/ +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); + +/* +* Export a private key using the specified number of iterations. +*/ +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); + typedef struct botan_pubkey_struct* botan_pubkey_t; BOTAN_DLL int botan_pubkey_load(botan_pubkey_t* key, const uint8_t bits[], size_t len); -- cgit v1.2.3