/* * (C) 2008 Jack Lloyd * * Distributed under the terms of the Botan license */ #include #include #include using namespace Botan; #include #include #include #include int main() { try { LibraryInitializer init; Unix_Socket sock("www.randombit.net", 443); std::auto_ptr 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()); u32bit total_got = 0; 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); total_got += got; } printf("Retrieved %d bytes total\n", total_got); } catch(std::exception& e) { printf("%s\n", e.what()); return 1; } return 0; }