aboutsummaryrefslogtreecommitdiffstats
path: root/src/credentials
diff options
context:
space:
mode:
authorlloyd <[email protected]>2012-01-27 15:47:33 +0000
committerlloyd <[email protected]>2012-01-27 15:47:33 +0000
commitb96fde715dddbb3fe1eb6a9077bb92182dfa1635 (patch)
treec0ff39002fbe7bff1a72a296140827388ccef468 /src/credentials
parent681a587b4766f660c758539110b6b8adb73a62a6 (diff)
Split up the psk function as the server also wants to be able to look
up a PSK from an identity.
Diffstat (limited to 'src/credentials')
-rw-r--r--src/credentials/credentials_manager.cpp16
-rw-r--r--src/credentials/credentials_manager.h26
2 files changed, 27 insertions, 15 deletions
diff --git a/src/credentials/credentials_manager.cpp b/src/credentials/credentials_manager.cpp
index fee849e47..7ca6ac657 100644
--- a/src/credentials/credentials_manager.cpp
+++ b/src/credentials/credentials_manager.cpp
@@ -15,12 +15,18 @@ std::string Credentials_Manager::psk_identity_hint(const std::string&,
return "";
}
-std::pair<std::string, SymmetricKey>
-Credentials_Manager::psk(const std::string&,
- const std::string&,
- const std::string& identity_hint)
+std::string Credentials_Manager::psk_identity(const std::string&,
+ const std::string&,
+ const std::string&)
+ {
+ return "";
+ }
+
+SymmetricKey Credentials_Manager::psk(const std::string&,
+ const std::string&,
+ const std::string& identity)
{
- throw Internal_Error("No PSK set for " + identity_hint);
+ throw Internal_Error("No PSK set for identity " + identity);
}
std::string Credentials_Manager::srp_identifier(const std::string&,
diff --git a/src/credentials/credentials_manager.h b/src/credentials/credentials_manager.h
index 3c7eec3e7..7dc049722 100644
--- a/src/credentials/credentials_manager.h
+++ b/src/credentials/credentials_manager.h
@@ -34,12 +34,18 @@ class BOTAN_DLL Credentials_Manager
/**
* @param identity_hint was passed by the server (but may be empty)
- * @return pair of PSK identity and the PSK itself.
+ * @return the PSK identity we want to use
*/
- virtual std::pair<std::string, SymmetricKey>
- psk(const std::string& type,
- const std::string& context,
- const std::string& identity_hint);
+ virtual std::string psk_identity(const std::string& type,
+ const std::string& context,
+ const std::string& identity_hint);
+
+ /**
+ * @return the PSK used for identity
+ */
+ virtual SymmetricKey psk(const std::string& type,
+ const std::string& context,
+ const std::string& identity);
/**
* @return identifier for client-side SRP auth, if available
@@ -56,16 +62,16 @@ class BOTAN_DLL Credentials_Manager
* @return password for client-side SRP auth, if available
for this identifier/type/context.
*/
- virtual std::string srp_password(const std::string& identifier,
- const std::string& type,
- const std::string& context);
+ virtual std::string srp_password(const std::string& type,
+ const std::string& context,
+ const std::string& identifier);
/**
* Retrieve SRP verifier parameters
*/
- virtual bool srp_verifier(const std::string& identifier,
- const std::string& type,
+ virtual bool srp_verifier(const std::string& type,
const std::string& context,
+ const std::string& identifier,
BigInt& group_prime,
BigInt& group_generator,
BigInt& verifier,