diff options
author | lloyd <[email protected]> | 2008-09-17 15:40:26 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-09-17 15:40:26 +0000 |
commit | e5df0c50acc213f8fc3db2d0b24fdd581dadbd65 (patch) | |
tree | 463bfab34778346f0fb300a0b05b43386c4b7f2d | |
parent | 7a58e651dabfbda16e40f673f1cc82861ad6b879 (diff) |
Add the program I wrote to write a set of many RSA keys (used for benchmarking
and profiling, mostly).
-rw-r--r-- | doc/examples/rsa_manykey.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/doc/examples/rsa_manykey.cpp b/doc/examples/rsa_manykey.cpp new file mode 100644 index 000000000..f39fbcbce --- /dev/null +++ b/doc/examples/rsa_manykey.cpp @@ -0,0 +1,35 @@ +/* +Generate a whole sequence of keys (for benchmarking) +*/ + +#include <iostream> +#include <fstream> +#include <string> +#include <cstdlib> +#include <memory> + +#include <botan/botan.h> +#include <botan/rsa.h> +#include <botan/parsing.h> +using namespace Botan; + +int main(int argc, char* argv[]) + { + std::auto_ptr<RandomNumberGenerator> rng( + RandomNumberGenerator::make_rng()); + + for(u32bit j = 512; j <= 8192; j += 256) + { + std::cout << j << "..."; + + RSA_PrivateKey key(*rng, j); + + std::ofstream priv(("rsa/" + to_string(j) + ".pem").c_str()); + priv << PKCS8::PEM_encode(key); + priv.close(); + + std::cout << " done" << std::endl; + } + + return 0; + } |