diff options
author | lloyd <[email protected]> | 2011-12-28 16:08:42 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2011-12-28 16:08:42 +0000 |
commit | 5ee3046bc9b8517bb6de5eda34f03ee907f9ff16 (patch) | |
tree | 1ce7355bd7198ea195eb26078fe14891d975c4f8 /doc/examples/tls_server.cpp | |
parent | 19b985eae73839fdd7547f48b999377c4d1ff47e (diff) |
Working though hacking client verify (server side only). Only supports
TLS 1.0/1.1, SSLv3 uses a different hash format. Only RSA certs tested
so far.
Diffstat (limited to 'doc/examples/tls_server.cpp')
-rw-r--r-- | doc/examples/tls_server.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/doc/examples/tls_server.cpp b/doc/examples/tls_server.cpp index 0f9b16871..a0e18b296 100644 --- a/doc/examples/tls_server.cpp +++ b/doc/examples/tls_server.cpp @@ -86,13 +86,13 @@ class Blocking_TLS_Server void reader_fn(const byte buf[], size_t buf_len, u16bit alert_code) { - if(buf_len == 0 && alert_code != NO_ALERT_TYPE) + if(buf_len == 0 && alert_code != NULL_ALERT) { printf("Alert: %d, quitting\n", alert_code); exit = true; } - printf("Got %d bytes: ", buf_len); + printf("Got %d bytes: ", (int)buf_len); for(size_t i = 0; i != buf_len; ++i) { if(isprint(buf[i])) @@ -114,6 +114,8 @@ class Blocking_TLS_Server class Server_TLS_Policy : public TLS_Policy { public: + bool require_client_auth() const { return true; } + bool check_cert(const std::vector<X509_Certificate>& certs) const { for(size_t i = 0; i != certs.size(); ++i) @@ -202,7 +204,7 @@ int main(int argc, char* argv[]) } } } - catch(std::exception& e) { printf("%s\n", e.what()); } + catch(std::exception& e) { printf("Connection problem: %s\n", e.what()); } } } catch(std::exception& e) |