diff options
author | lloyd <[email protected]> | 2012-03-22 20:40:33 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2012-03-22 20:40:33 +0000 |
commit | 0a07acbfc915971a3da7e8f7e27819be8cbff923 (patch) | |
tree | 40f7c6114383bd6da5d793211b0839b24bfa392b /doc/examples | |
parent | 34940b08d7328a0baa51256781f5bb802a966217 (diff) |
Call Credentials_Manager::psk for the session ticket key.
Diffstat (limited to 'doc/examples')
-rw-r--r-- | doc/examples/credentials.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/doc/examples/credentials.h b/doc/examples/credentials.h index 82a72406d..0999b251d 100644 --- a/doc/examples/credentials.h +++ b/doc/examples/credentials.h @@ -25,8 +25,8 @@ class Credentials_Manager_Simple : public Botan::Credentials_Manager public: Credentials_Manager_Simple(Botan::RandomNumberGenerator& rng) : rng(rng) {} - std::string psk_identity_hint(const std::string& type, - const std::string& context) + std::string psk_identity_hint(const std::string&, + const std::string&) { return ""; } @@ -37,11 +37,19 @@ class Credentials_Manager_Simple : public Botan::Credentials_Manager return "Client_identity"; } - Botan::SymmetricKey psk(const std::string&, const std::string&, + Botan::SymmetricKey psk(const std::string& type, const std::string& context, const std::string& identity) { + if(type == "tls-server" && context == "session-ticket") + { + if(session_ticket_key.length() == 0) + session_ticket_key = Botan::SymmetricKey(rng, 32); + return session_ticket_key; + } + if(identity == "Client_identity") return Botan::SymmetricKey("b5a72e1387552e6dc10766dc0eda12961f5b21e17f98ef4c41e6572e53bd7527"); + throw Botan::Internal_Error("No PSK set for " + identity); } @@ -162,6 +170,8 @@ class Credentials_Manager_Simple : public Botan::Credentials_Manager private: Botan::RandomNumberGenerator& rng; + + Botan::SymmetricKey session_ticket_key; std::map<Botan::X509_Certificate, Botan::Private_Key*> certs_and_keys; }; |