diff options
author | Randolph Tan <randolph@10gen.com> | 2017-02-16 13:39:22 -0500 |
---|---|---|
committer | Spencer Jackson <spencer.jackson@mongodb.com> | 2017-07-11 16:20:07 -0400 |
commit | b686a69d6ed4653c6973dc62b50eb7b40df87fd4 (patch) | |
tree | 3779afe3bbcea4a8ab7e7d1ca902737b09748619 /src/mongo/crypto/mechanism_scram.h | |
parent | 16e83332ed20e4054324a1a7714506e74eed5180 (diff) | |
download | mongo-b686a69d6ed4653c6973dc62b50eb7b40df87fd4.tar.gz |
SERVER-28052 Make SHA1Hash a full fledged class
(cherry picked from commit 71ce59a2648185c8e1ccd5b3a1af6ff05dbac7d7)
(cherry picked from commit 2e686c169d07ed06530aa650ced310ee7b1adfc6)
Diffstat (limited to 'src/mongo/crypto/mechanism_scram.h')
-rw-r--r-- | src/mongo/crypto/mechanism_scram.h | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/mongo/crypto/mechanism_scram.h b/src/mongo/crypto/mechanism_scram.h index 1d3b86f2fdd..fb070e8162c 100644 --- a/src/mongo/crypto/mechanism_scram.h +++ b/src/mongo/crypto/mechanism_scram.h @@ -32,13 +32,11 @@ #include "mongo/base/secure_allocator.h" #include "mongo/base/status.h" -#include "mongo/crypto/crypto.h" +#include "mongo/crypto/sha1_block.h" #include "mongo/db/jsobj.h" namespace mongo { namespace scram { -// Convert a SHA1Hash into a base64 encoded string. -std::string hashToBase64(const SecureHandle<SHA1Hash>& hash); const std::string serverKeyConst = "Server Key"; const std::string clientKeyConst = "Client Key"; @@ -74,16 +72,16 @@ inline bool operator==(const SCRAMPresecrets& lhs, const SCRAMPresecrets& rhs) { /* * Computes the SaltedPassword from password, salt and iterationCount. */ -SHA1Hash generateSaltedPassword(const SCRAMPresecrets& presecrets); +SHA1Block generateSaltedPassword(const SCRAMPresecrets& presecrets); /* * Stores all of the keys, generated from a password, needed for a client or server to perform a * SCRAM handshake. This structure will secureZeroMemory itself on destruction. */ struct SCRAMSecrets { - SecureHandle<SHA1Hash> clientKey; - SecureHandle<SHA1Hash> storedKey; - SecureHandle<SHA1Hash> serverKey; + SecureHandle<SHA1Block> clientKey; + SecureHandle<SHA1Block> storedKey; + SecureHandle<SHA1Block> serverKey; }; /* @@ -95,7 +93,7 @@ SCRAMSecrets generateSecrets(const SCRAMPresecrets& presecrets); /* * Computes the ClientKey and StoredKey from SaltedPassword (client side). */ -SCRAMSecrets generateSecrets(const SHA1Hash& saltedPassword); +SCRAMSecrets generateSecrets(const SHA1Block& saltedPassword); /* * Generates the user salt and the SCRAM secrets storedKey and serverKey as |