summaryrefslogtreecommitdiff
path: root/src/mongo/crypto
diff options
context:
space:
mode:
authorAndreas Nilsson <andreas.nilsson@10gen.com>2014-10-07 16:59:05 -0400
committerAndreas Nilsson <andreas.nilsson@10gen.com>2014-10-10 09:55:13 -0400
commiteb3435c25eabc90e2c4ff7c331c94c4c222d0b7e (patch)
tree63b73d91f489eacd599035e417cff62998ef8a0e /src/mongo/crypto
parentb179fa1eab1bc79be8562349ca6f43283f16ecc7 (diff)
downloadmongo-eb3435c25eabc90e2c4ff7c331c94c4c222d0b7e.tar.gz
SERVER-15236 Using SCRAM-SHA-1 for keyfile authentication
Diffstat (limited to 'src/mongo/crypto')
-rw-r--r--src/mongo/crypto/mechanism_scram.cpp8
-rw-r--r--src/mongo/crypto/mechanism_scram.h6
2 files changed, 10 insertions, 4 deletions
diff --git a/src/mongo/crypto/mechanism_scram.cpp b/src/mongo/crypto/mechanism_scram.cpp
index 95629fcae86..1b6eaf88ea9 100644
--- a/src/mongo/crypto/mechanism_scram.cpp
+++ b/src/mongo/crypto/mechanism_scram.cpp
@@ -171,10 +171,10 @@ namespace scram {
std::string encodedServerKey =
base64::encode(reinterpret_cast<char*>(serverKey), hashSize);
- return BSON("iterationCount" << iterationCount <<
- "salt" << encodedUserSalt <<
- "storedKey" << encodedStoredKey <<
- "serverKey" << encodedServerKey);
+ return BSON(iterationCountFieldName << iterationCount <<
+ saltFieldName << encodedUserSalt <<
+ storedKeyFieldName << encodedStoredKey <<
+ serverKeyFieldName << encodedServerKey);
}
std::string generateClientProof(const unsigned char saltedPassword[hashSize],
diff --git a/src/mongo/crypto/mechanism_scram.h b/src/mongo/crypto/mechanism_scram.h
index 6f5b37b8d6b..fc6da4aea9c 100644
--- a/src/mongo/crypto/mechanism_scram.h
+++ b/src/mongo/crypto/mechanism_scram.h
@@ -36,9 +36,15 @@
namespace mongo {
namespace scram {
const unsigned int hashSize = 20;
+
const std::string serverKeyConst = "Server Key";
const std::string clientKeyConst = "Client Key";
+ const std::string iterationCountFieldName = "iterationCount";
+ const std::string saltFieldName = "salt";
+ const std::string storedKeyFieldName = "storedKey";
+ const std::string serverKeyFieldName = "serverKey";
+
/*
* Computes the SaltedPassword from password, salt and iterationCount.
*/