diff options
Diffstat (limited to 'botan/doc/examples/rsa_manykey.cpp')
-rw-r--r-- | botan/doc/examples/rsa_manykey.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/botan/doc/examples/rsa_manykey.cpp b/botan/doc/examples/rsa_manykey.cpp new file mode 100644 index 0000000..4122bc8 --- /dev/null +++ b/botan/doc/examples/rsa_manykey.cpp @@ -0,0 +1,36 @@ +/* +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() + { + Botan::LibraryInitializer init; + + AutoSeeded_RNG 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; + } |