aboutsummaryrefslogtreecommitdiffstats
path: root/src/credentials
diff options
context:
space:
mode:
authorlloyd <[email protected]>2012-01-27 15:39:11 +0000
committerlloyd <[email protected]>2012-01-27 15:39:11 +0000
commit681a587b4766f660c758539110b6b8adb73a62a6 (patch)
tree5196ab3071396e4727d98f71406baf8155b8c842 /src/credentials
parent2d31f3fc1b1c88739e5babbd6a9e8cb3b80263de (diff)
Credentials hooks for PSK
Diffstat (limited to 'src/credentials')
-rw-r--r--src/credentials/credentials_manager.cpp14
-rw-r--r--src/credentials/credentials_manager.h15
2 files changed, 27 insertions, 2 deletions
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<std::string, SymmetricKey>
+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 <botan/x509cert.h>
-#include <botan/secmem.h>
+#include <botan/symkey.h>
#include <string>
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<std::string, SymmetricKey>
+ 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