From 681a587b4766f660c758539110b6b8adb73a62a6 Mon Sep 17 00:00:00 2001 From: lloyd Date: Fri, 27 Jan 2012 15:39:11 +0000 Subject: Credentials hooks for PSK --- src/credentials/credentials_manager.cpp | 14 ++++++++++++++ src/credentials/credentials_manager.h | 15 +++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) (limited to 'src/credentials') diff --git a/src/credentials/credentials_manager.cpp b/src/credentials/credentials_manager.cpp index 2e46a314e..fee849e47 100644 --- a/src/credentials/credentials_manager.cpp +++ b/src/credentials/credentials_manager.cpp @@ -9,6 +9,20 @@ namespace Botan { +std::string Credentials_Manager::psk_identity_hint(const std::string&, + const std::string&) + { + return ""; + } + +std::pair +Credentials_Manager::psk(const std::string&, + const std::string&, + const std::string& identity_hint) + { + throw Internal_Error("No PSK set for " + identity_hint); + } + std::string Credentials_Manager::srp_identifier(const std::string&, const std::string&) { diff --git a/src/credentials/credentials_manager.h b/src/credentials/credentials_manager.h index 19721715d..3c7eec3e7 100644 --- a/src/credentials/credentials_manager.h +++ b/src/credentials/credentials_manager.h @@ -9,7 +9,7 @@ #define BOTAN_CREDENTIALS_MANAGER_H__ #include -#include +#include #include namespace Botan { @@ -23,13 +23,24 @@ class BigInt; * of the transaction occuring. Currently used values are "tls-client" * and "tls-server". Context represents a hostname, email address, * username, or other identifier. - */ class BOTAN_DLL Credentials_Manager { public: virtual ~Credentials_Manager() {} + virtual std::string psk_identity_hint(const std::string& type, + const std::string& context); + + /** + * @param identity_hint was passed by the server (but may be empty) + * @return pair of PSK identity and the PSK itself. + */ + virtual std::pair + psk(const std::string& type, + const std::string& context, + const std::string& identity_hint); + /** * @return identifier for client-side SRP auth, if available for this type/context. Should return empty string -- cgit v1.2.3