20 #include "mongo/base/status.h"
25 const unsigned int hashSize = 20;
27 const std::string serverKeyConst =
"Server Key";
28 const std::string clientKeyConst =
"Client Key";
30 const std::string iterationCountFieldName =
"iterationCount";
31 const std::string saltFieldName =
"salt";
32 const std::string storedKeyFieldName =
"storedKey";
33 const std::string serverKeyFieldName =
"serverKey";
38 void generateSaltedPassword(
const StringData& hashedPassword,
39 const unsigned char* salt,
41 const int iterationCount,
42 unsigned char saltedPassword[hashSize]);
48 void generateSecrets(
const std::string& hashedPassword,
49 const unsigned char salt[],
51 size_t iterationCount,
52 unsigned char storedKey[hashSize],
53 unsigned char serverKey[hashSize]);
59 BSONObj generateCredentials(
const std::string& hashedPassword,
int iterationCount);
64 std::string generateClientProof(
const unsigned char saltedPassword[hashSize],
65 const std::string& authMessage);
71 bool validatePassword(
const std::string& hashedPassword,
73 const std::string& salt,
74 const std::string& storedKey);
79 bool verifyServerSignature(
const unsigned char saltedPassword[hashSize],
80 const std::string& authMessage,
81 const std::string& serverSignature);
Utility functions for parsing numbers from strings.
Definition: compare_numbers.h:20