diff options
author | lloyd <[email protected]> | 2010-02-24 13:23:12 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-02-24 13:23:12 +0000 |
commit | 27d84b179913a82849c3994e8724dbec379dab52 (patch) | |
tree | 83634362c2d0ee146ef9a2104722dc3f5491088d /doc | |
parent | 7424a5b5102b569e3c052cb195c98b5d1b60ce30 (diff) | |
parent | f849aab38b36c68217e98d1bfc8d8ef8f0e3c027 (diff) |
propagate from branch 'net.randombit.botan' (head 2b67727dd9d1e7fe34f3cb7b7f6715ba42a04918)
to branch 'net.randombit.botan.c++0x' (head 1e2e1596f2b4928c2b7bfba624ea5e4ac69dfdad)
Diffstat (limited to 'doc')
-rw-r--r-- | doc/examples/tls_client.cpp | 51 | ||||
-rw-r--r-- | doc/examples/tls_server.cpp | 81 | ||||
-rw-r--r-- | doc/log.txt | 3 |
3 files changed, 135 insertions, 0 deletions
diff --git a/doc/examples/tls_client.cpp b/doc/examples/tls_client.cpp new file mode 100644 index 000000000..9e6b510f2 --- /dev/null +++ b/doc/examples/tls_client.cpp @@ -0,0 +1,51 @@ +/* +* (C) 2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#include <botan/init.h> +#include <botan/tls_client.h> +#include <botan/unx_sock.h> + +using namespace Botan; + +#include <stdio.h> +#include <string> +#include <iostream> +#include <memory> + +int main() + { + try + { + LibraryInitializer init; + + Unix_Socket sock("www.randombit.net", 443); + + std::auto_ptr<Botan::RandomNumberGenerator> rng( + Botan::RandomNumberGenerator::make_rng()); + + TLS_Client tls(*rng, sock); + + std::string http_command = "GET /bitbashing\r\n"; + tls.write((const byte*)http_command.c_str(), http_command.length()); + + while(true) + { + if(tls.is_closed()) + break; + + byte buf[16+1] = { 0 }; + u32bit got = tls.read(buf, sizeof(buf)-1); + printf("%s", buf); + fflush(0); + } + } + catch(std::exception& e) + { + printf("%s\n", e.what()); + return 1; + } + return 0; + } diff --git a/doc/examples/tls_server.cpp b/doc/examples/tls_server.cpp new file mode 100644 index 000000000..39453dbfd --- /dev/null +++ b/doc/examples/tls_server.cpp @@ -0,0 +1,81 @@ +/* +* (C) 2008 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#include <botan/init.h> +#include <botan/tls_server.h> +#include <botan/unx_sock.h> + +#include <botan/rsa.h> +#include <botan/dsa.h> +#include <botan/x509self.h> + +using namespace Botan; + +#include <stdio.h> +#include <string> +#include <iostream> +#include <memory> + +int main(int argc, char* argv[]) + { + + int port = 4433; + + if(argc == 2) + port = to_u32bit(argv[1]); + + try + { + LibraryInitializer init; + + std::auto_ptr<RandomNumberGenerator> rng( + RandomNumberGenerator::make_rng()); + + RSA_PrivateKey key(*rng, 512); + //DSA_PrivateKey key(get_dl_group("DSA-1024")); + + X509_Cert_Options options( + "www.randombit.net/US/Syn Ack Labs/Mathematical Munitions Dept"); + + X509_Certificate cert = + X509::create_self_signed_cert(options, key, "SHA-1", *rng); + + Unix_Server_Socket listener(port); + + printf("Now listening on port %d...\n", port); + + while(true) + { + try { + Socket* sock = listener.accept(); + + printf("Got new connection\n"); + + TLS_Server tls(*rng, *sock, cert, key); + + printf("Writing some text\n"); + + char msg[] = "Foo\nBar\nBaz\nQuux\n"; + tls.write((const byte*)msg, strlen(msg)); + + printf("Now trying a read...\n"); + + char buf[10] = { 0 }; + u32bit got = tls.read((byte*)buf, 9); + printf("%d: '%s'\n", got, buf); + + tls.close(); + } + catch(std::exception& e) { printf("%s\n", e.what()); } + } + } + catch(std::exception& e) + { + printf("%s\n", e.what()); + return 1; + } + return 0; + } diff --git a/doc/log.txt b/doc/log.txt index 847bf8596..09564a01f 100644 --- a/doc/log.txt +++ b/doc/log.txt @@ -1,5 +1,7 @@ * 1.9.4-dev, ????-??-?? + - Add the Ajisai SSL/TLS implementation + - Add GOST 34.10-2001 public key signature scheme - Add SIMD implementation of Noekeon - Add SSE2 implementation of IDEA - Perform XTS encryption and decryption in parallel where possible @@ -9,6 +11,7 @@ - Add support for password hashing for authentication (passhash9.h) - Add support for Win32 high resolution system timers - Changed S2K interface: derive_key now takes salt, iteration count + - Remove dependency on TR1 for ECC and CVC code - Fix crash in GMP_Engine if library is shutdown and reinitialized - Fix an invalid memory read in MD4 - Remove Timer class entirely |