diff options
Diffstat (limited to 'doc/examples')
39 files changed, 67 insertions, 10 deletions
diff --git a/doc/examples/asn1.cpp b/doc/examples/asn1.cpp index 933c5e492..95757ec19 100644 --- a/doc/examples/asn1.cpp +++ b/doc/examples/asn1.cpp @@ -56,6 +56,8 @@ int main(int argc, char* argv[]) printf("Usage: %s <file>\n", argv[0]); return 1; } + + Botan::LibraryInitializer init; try { DataSource_Stream in(argv[1]); diff --git a/doc/examples/base.cpp b/doc/examples/base.cpp index b81daa410..eca0ccf24 100644 --- a/doc/examples/base.cpp +++ b/doc/examples/base.cpp @@ -14,6 +14,8 @@ using namespace Botan; int main(int argc, char* argv[]) { + Botan::LibraryInitializer init; + try { /* Put it inside the try block so exceptions at startup/shutdown will diff --git a/doc/examples/base64.cpp b/doc/examples/base64.cpp index 9697e1376..d35aaf593 100644 --- a/doc/examples/base64.cpp +++ b/doc/examples/base64.cpp @@ -27,6 +27,8 @@ int main(int argc, char* argv[]) return 1; } + Botan::LibraryInitializer init; + int column = 78; bool wrap = false; bool encoding = true; diff --git a/doc/examples/bzip.cpp b/doc/examples/bzip.cpp index 1abe4d309..02252fb94 100644 --- a/doc/examples/bzip.cpp +++ b/doc/examples/bzip.cpp @@ -27,6 +27,7 @@ int main(int argc, char* argv[]) return 1; } + Botan::LibraryInitializer init; std::vector<std::string> files; bool decompress = false, small = false; diff --git a/doc/examples/ca.cpp b/doc/examples/ca.cpp index e4fb9eb02..41dd409d5 100644 --- a/doc/examples/ca.cpp +++ b/doc/examples/ca.cpp @@ -30,6 +30,8 @@ int main(int argc, char* argv[]) return 1; } + Botan::LibraryInitializer init; + try { const std::string arg_passphrase = argv[1]; diff --git a/doc/examples/checksum.cpp b/doc/examples/checksum.cpp index 3dc6e9757..232be057c 100644 --- a/doc/examples/checksum.cpp +++ b/doc/examples/checksum.cpp @@ -13,7 +13,7 @@ int main(int argc, char* argv[]) return 1; } - LibraryInitializer init; + Botan::LibraryInitializer init; Pipe pipe(new Fork( new Chain(new Hash_Filter("CRC24"), new Hex_Encoder), diff --git a/doc/examples/cms_dec.cpp b/doc/examples/cms_dec.cpp index f35d63fa6..3fa285395 100644 --- a/doc/examples/cms_dec.cpp +++ b/doc/examples/cms_dec.cpp @@ -14,7 +14,7 @@ int main(int argc, char* argv[]) return 1; } - LibraryInitializer init; + Botan::LibraryInitializer init; try { AutoSeeded_RNG rng; diff --git a/doc/examples/cms_enc.cpp b/doc/examples/cms_enc.cpp index 48b3c5ddd..de16bbaae 100644 --- a/doc/examples/cms_enc.cpp +++ b/doc/examples/cms_enc.cpp @@ -8,7 +8,7 @@ using namespace Botan; int main() { - LibraryInitializer init; + Botan::LibraryInitializer init; try { diff --git a/doc/examples/decrypt.cpp b/doc/examples/decrypt.cpp index 7018e5f49..68d5f890b 100644 --- a/doc/examples/decrypt.cpp +++ b/doc/examples/decrypt.cpp @@ -35,6 +35,8 @@ int main(int argc, char* argv[]) return 1; } + Botan::LibraryInitializer init; + std::string filename, passphrase; for(int j = 1; argv[j] != 0; j++) diff --git a/doc/examples/dh.cpp b/doc/examples/dh.cpp index af0c19fec..7855aeae5 100644 --- a/doc/examples/dh.cpp +++ b/doc/examples/dh.cpp @@ -15,6 +15,8 @@ using namespace Botan; int main() { + Botan::LibraryInitializer init; + try { AutoSeeded_RNG rng; diff --git a/doc/examples/dsa_kgen.cpp b/doc/examples/dsa_kgen.cpp index fe70f93fb..4669cf705 100644 --- a/doc/examples/dsa_kgen.cpp +++ b/doc/examples/dsa_kgen.cpp @@ -34,6 +34,8 @@ int main(int argc, char* argv[]) return 1; } + Botan::LibraryInitializer init; + std::ofstream priv("dsapriv.pem"); std::ofstream pub("dsapub.pem"); if(!priv || !pub) diff --git a/doc/examples/dsa_sign.cpp b/doc/examples/dsa_sign.cpp index 16b8acd5a..caf050313 100644 --- a/doc/examples/dsa_sign.cpp +++ b/doc/examples/dsa_sign.cpp @@ -29,6 +29,8 @@ int main(int argc, char* argv[]) return 1; } + Botan::LibraryInitializer init; + try { std::string passphrase(argv[3]); diff --git a/doc/examples/dsa_ver.cpp b/doc/examples/dsa_ver.cpp index 90af8d68f..3b7ea0255 100644 --- a/doc/examples/dsa_ver.cpp +++ b/doc/examples/dsa_ver.cpp @@ -39,6 +39,8 @@ int main(int argc, char* argv[]) return 1; } + Botan::LibraryInitializer init; + std::ifstream message(argv[2]); if(!message) { diff --git a/doc/examples/eax_test.cpp b/doc/examples/eax_test.cpp index 07564c097..283e33501 100644 --- a/doc/examples/eax_test.cpp +++ b/doc/examples/eax_test.cpp @@ -228,7 +228,7 @@ int main() { std::ifstream in("eax_tv.txt"); - LibraryInitializer init; + Botan::LibraryInitializer init; if(!in) { diff --git a/doc/examples/ecdsa.cpp b/doc/examples/ecdsa.cpp index ce199936d..065203a94 100644 --- a/doc/examples/ecdsa.cpp +++ b/doc/examples/ecdsa.cpp @@ -10,6 +10,8 @@ using namespace Botan; int main() { + Botan::LibraryInitializer init; + try { AutoSeeded_RNG rng; diff --git a/doc/examples/encrypt.cpp b/doc/examples/encrypt.cpp index 8f61306be..348ee8d39 100644 --- a/doc/examples/encrypt.cpp +++ b/doc/examples/encrypt.cpp @@ -44,6 +44,8 @@ int main(int argc, char* argv[]) return 1; } + Botan::LibraryInitializer init; + std::string algo = "TripleDES"; std::string filename, passphrase; diff --git a/doc/examples/encrypt2.cpp b/doc/examples/encrypt2.cpp index 3d91a9bc5..4af0cf019 100644 --- a/doc/examples/encrypt2.cpp +++ b/doc/examples/encrypt2.cpp @@ -9,7 +9,7 @@ using namespace Botan; int main() { - LibraryInitializer init; + Botan::LibraryInitializer init; AutoSeeded_RNG rng; diff --git a/doc/examples/factor.cpp b/doc/examples/factor.cpp index 70dde1050..ff3c23c5d 100644 --- a/doc/examples/factor.cpp +++ b/doc/examples/factor.cpp @@ -119,6 +119,8 @@ int main(int argc, char* argv[]) return 1; } + Botan::LibraryInitializer init; + try { BigInt n(argv[1]); diff --git a/doc/examples/hash.cpp b/doc/examples/hash.cpp index 7c9500160..a97cd6082 100644 --- a/doc/examples/hash.cpp +++ b/doc/examples/hash.cpp @@ -22,6 +22,8 @@ int main(int argc, char* argv[]) return 1; } + Botan::LibraryInitializer init; + std::string hash = argv[1]; /* a couple of special cases, kind of a crock */ if(hash == "sha1") hash = "SHA-1"; diff --git a/doc/examples/hash_fd.cpp b/doc/examples/hash_fd.cpp index 1deed6988..82ca2c3b4 100644 --- a/doc/examples/hash_fd.cpp +++ b/doc/examples/hash_fd.cpp @@ -33,6 +33,8 @@ int main(int argc, char* argv[]) return 1; } + Botan::LibraryInitializer init; + try { Botan::Pipe pipe(new Botan::Hash_Filter(argv[1]), diff --git a/doc/examples/hasher.cpp b/doc/examples/hasher.cpp index 55a2ecd4b..5ba982fc0 100644 --- a/doc/examples/hasher.cpp +++ b/doc/examples/hasher.cpp @@ -20,6 +20,8 @@ int main(int argc, char* argv[]) return 1; } + Botan::LibraryInitializer init; + const int COUNT = 3; std::string name[COUNT] = { "MD5", "SHA-1", "RIPEMD-160" }; diff --git a/doc/examples/hasher2.cpp b/doc/examples/hasher2.cpp index e71ebf63e..12d3c853d 100644 --- a/doc/examples/hasher2.cpp +++ b/doc/examples/hasher2.cpp @@ -23,6 +23,8 @@ int main(int argc, char* argv[]) return 1; } + Botan::LibraryInitializer init; + const int COUNT = 3; std::string name[COUNT] = { "MD5", "SHA-1", "RIPEMD-160" }; diff --git a/doc/examples/make_prime.cpp b/doc/examples/make_prime.cpp index 4135bd197..eaff1867f 100644 --- a/doc/examples/make_prime.cpp +++ b/doc/examples/make_prime.cpp @@ -1,5 +1,6 @@ #include <botan/numthry.h> #include <botan/auto_rng.h> +#include <botan/botan.h> using namespace Botan; @@ -10,6 +11,7 @@ using namespace Botan; int main() { + Botan::LibraryInitializer init; AutoSeeded_RNG rng; std::set<BigInt> primes; diff --git a/doc/examples/passhash.cpp b/doc/examples/passhash.cpp index 3cba3738f..7f5bbc2bb 100644 --- a/doc/examples/passhash.cpp +++ b/doc/examples/passhash.cpp @@ -20,6 +20,8 @@ int main(int argc, char* argv[]) return 1; } + Botan::LibraryInitializer init; + try { diff --git a/doc/examples/pkcs10.cpp b/doc/examples/pkcs10.cpp index 18390da7c..d719baf72 100644 --- a/doc/examples/pkcs10.cpp +++ b/doc/examples/pkcs10.cpp @@ -27,6 +27,8 @@ int main(int argc, char* argv[]) return 1; } + Botan::LibraryInitializer init; + try { AutoSeeded_RNG rng; diff --git a/doc/examples/pqg_gen.cpp b/doc/examples/pqg_gen.cpp index 7e173c11b..e4b959883 100644 --- a/doc/examples/pqg_gen.cpp +++ b/doc/examples/pqg_gen.cpp @@ -19,7 +19,7 @@ bool check(RandomNumberGenerator& rng, int main() { try { - LibraryInitializer init("use_engines"); + Botan::LibraryInitializer init("use_engines"); AutoSeeded_RNG rng; diff --git a/doc/examples/ressol.cpp b/doc/examples/ressol.cpp index 47a6550b6..43bb68d37 100644 --- a/doc/examples/ressol.cpp +++ b/doc/examples/ressol.cpp @@ -1,5 +1,6 @@ #include <botan/numthry.h> #include <botan/auto_rng.h> +#include <botan/botan.h> using namespace Botan; @@ -48,6 +49,7 @@ void test_ressol(const BigInt& p, RandomNumberGenerator& rng) int main() { + Botan::LibraryInitializer init; AutoSeeded_RNG rng; #if 0 diff --git a/doc/examples/rng_test.cpp b/doc/examples/rng_test.cpp index 9ecb04e78..8d4253a6e 100644 --- a/doc/examples/rng_test.cpp +++ b/doc/examples/rng_test.cpp @@ -105,6 +105,8 @@ void x931_tests(std::vector<std::pair<std::string, std::string> > vecs, int main() { + Botan::LibraryInitializer init; + x931_tests(read_file("ANSI931_AES128VST.txt.vst"), "AES-128"); x931_tests(read_file("ANSI931_AES192VST.txt.vst"), "AES-192"); x931_tests(read_file("ANSI931_AES256VST.txt.vst"), "AES-256"); diff --git a/doc/examples/row_encryptor.cpp b/doc/examples/row_encryptor.cpp index 0960480c1..1dac82f89 100644 --- a/doc/examples/row_encryptor.cpp +++ b/doc/examples/row_encryptor.cpp @@ -95,7 +95,7 @@ std::string Row_Encryptor::decrypt(const std::string& input, int main() { - LibraryInitializer init; + Botan::LibraryInitializer init; AutoSeeded_RNG rng; diff --git a/doc/examples/rsa_dec.cpp b/doc/examples/rsa_dec.cpp index 7459f41b6..25ce33f47 100644 --- a/doc/examples/rsa_dec.cpp +++ b/doc/examples/rsa_dec.cpp @@ -32,6 +32,8 @@ int main(int argc, char* argv[]) return 1; } + Botan::LibraryInitializer init; + try { AutoSeeded_RNG rng; diff --git a/doc/examples/rsa_enc.cpp b/doc/examples/rsa_enc.cpp index 4f37af6d6..f9b8c5561 100644 --- a/doc/examples/rsa_enc.cpp +++ b/doc/examples/rsa_enc.cpp @@ -54,6 +54,8 @@ int main(int argc, char* argv[]) return 1; } + Botan::LibraryInitializer init; + std::string output_name(argv[2]); output_name += ".enc"; std::ofstream ciphertext(output_name.c_str()); diff --git a/doc/examples/rsa_kgen.cpp b/doc/examples/rsa_kgen.cpp index ed8e786fe..b7e90ef8a 100644 --- a/doc/examples/rsa_kgen.cpp +++ b/doc/examples/rsa_kgen.cpp @@ -35,6 +35,8 @@ int main(int argc, char* argv[]) return 1; } + Botan::LibraryInitializer init; + std::ofstream pub("rsapub.pem"); std::ofstream priv("rsapriv.pem"); if(!priv || !pub) diff --git a/doc/examples/rsa_manykey.cpp b/doc/examples/rsa_manykey.cpp index 9d27634de..4122bc8ef 100644 --- a/doc/examples/rsa_manykey.cpp +++ b/doc/examples/rsa_manykey.cpp @@ -15,6 +15,8 @@ using namespace Botan; int main() { + Botan::LibraryInitializer init; + AutoSeeded_RNG rng; for(u32bit j = 512; j <= 8192; j += 256) diff --git a/doc/examples/self_sig.cpp b/doc/examples/self_sig.cpp index a4b0c928c..0bf17e3bc 100644 --- a/doc/examples/self_sig.cpp +++ b/doc/examples/self_sig.cpp @@ -29,6 +29,8 @@ int main(int argc, char* argv[]) return 1; } + Botan::LibraryInitializer init; + std::string CA_flag = argv[2]; bool do_CA = false; diff --git a/doc/examples/sig_gen.cpp b/doc/examples/sig_gen.cpp index ca7058549..6dd749097 100644 --- a/doc/examples/sig_gen.cpp +++ b/doc/examples/sig_gen.cpp @@ -15,7 +15,7 @@ bool check(std::map<std::string, std::string>); int main() { try { - LibraryInitializer init; + Botan::LibraryInitializer init; std::ifstream in("SigGen.rsp"); if(!in) diff --git a/doc/examples/stack.cpp b/doc/examples/stack.cpp index 389b12e7e..1522b05f5 100644 --- a/doc/examples/stack.cpp +++ b/doc/examples/stack.cpp @@ -20,6 +20,8 @@ int main(int argc, char* argv[]) return 1; } + Botan::LibraryInitializer init; + // this is a pretty vacuous example, but it's useful as a test Botan::Pipe pipe; diff --git a/doc/examples/test_es.cpp b/doc/examples/test_es.cpp index 5d0c1ae5a..951d51ac7 100644 --- a/doc/examples/test_es.cpp +++ b/doc/examples/test_es.cpp @@ -74,7 +74,7 @@ void test_entropy_source(EntropySource* es) int main() { - LibraryInitializer init; + Botan::LibraryInitializer init; #if defined(BOTAN_HAS_ENTROPY_SRC_DEVICE) test_entropy_source( diff --git a/doc/examples/x509info.cpp b/doc/examples/x509info.cpp index 4bcf17a20..0e34f2fab 100644 --- a/doc/examples/x509info.cpp +++ b/doc/examples/x509info.cpp @@ -56,6 +56,8 @@ int main(int argc, char* argv[]) return 1; } + Botan::LibraryInitializer init; + try { X509_Certificate cert(argv[1]); diff --git a/doc/examples/xor_ciph.cpp b/doc/examples/xor_ciph.cpp index 670276802..6a914b150 100644 --- a/doc/examples/xor_ciph.cpp +++ b/doc/examples/xor_ciph.cpp @@ -59,7 +59,7 @@ void XOR_Cipher::key_schedule(const byte key[], u32bit length) int main() { - LibraryInitializer init; + Botan::LibraryInitializer init; global_state().algorithm_factory().add_stream_cipher(new XOR_Cipher, "app"); |