summaryrefslogtreecommitdiff
path: root/src/DownloadEngine.h
diff options
context:
space:
mode:
authorNils Maier <maierman@web.de>2014-04-19 19:10:06 +0200
committerNils Maier <maierman@web.de>2014-04-19 19:10:06 +0200
commit82dad90ff3fe1438ce5d578dcf50bc82e5c96e9b (patch)
treed3c0e83c55f04b84bddddca37d7c15b3daaea5f2 /src/DownloadEngine.h
parent98ba096951247b7e2119afe6ba4e4ddd7d4a4485 (diff)
Validate token using PBKDF2-HMAC-SHA1.
This change should make token validation more resilient to: - timing attacks (constant time array compare) - brute-force/dictionary attacks (PBKDF2) Closes #220
Diffstat (limited to 'src/DownloadEngine.h')
-rw-r--r--src/DownloadEngine.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/DownloadEngine.h b/src/DownloadEngine.h
index eb827b97..eadb2f46 100644
--- a/src/DownloadEngine.h
+++ b/src/DownloadEngine.h
@@ -74,6 +74,13 @@ class WebSocketSessionMan;
} // namespace rpc
#endif // ENABLE_WEBSOCKET
+namespace util {
+ namespace security {
+ class HMAC;
+ class HMACResult;
+ } // namespace security
+} // namespace util
+
class DownloadEngine {
private:
void waitData();
@@ -173,6 +180,13 @@ private:
// deleted.
std::deque<std::unique_ptr<Command>> routineCommands_;
std::deque<std::unique_ptr<Command>> commands_;
+
+ std::unique_ptr<util::security::HMAC> tokenHMAC_;
+ std::unique_ptr<util::security::HMACResult> tokenExpected_;
+ size_t tokenIterations_;
+
+ double tokenAverageDuration_;
+
public:
DownloadEngine(std::unique_ptr<EventPoll> eventPoll);
@@ -360,6 +374,8 @@ public:
return webSocketSessionMan_;
}
#endif // ENABLE_WEBSOCKET
+
+ bool validateToken(const std::string& token);
};
} // namespace aria2