diff options
author | Jack Mulrow <jack.mulrow@mongodb.com> | 2017-03-28 10:32:30 -0400 |
---|---|---|
committer | Jack Mulrow <jack.mulrow@mongodb.com> | 2017-03-30 14:15:39 -0400 |
commit | 325486685538d00adbd61f868c239b3ecc6938c6 (patch) | |
tree | a6f0e7679ebba871e5644ee3c2703ef05f974b9d /src/mongo/db/time_proof_service.cpp | |
parent | ba1fa56004826b42bd8fa7d5b5a0c78fc1b57af9 (diff) | |
download | mongo-325486685538d00adbd61f868c239b3ecc6938c6.tar.gz |
SERVER-28432 Move key management out from TimeProofService
Diffstat (limited to 'src/mongo/db/time_proof_service.cpp')
-rw-r--r-- | src/mongo/db/time_proof_service.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/mongo/db/time_proof_service.cpp b/src/mongo/db/time_proof_service.cpp index 1d0d6c0b46b..38b63a3af63 100644 --- a/src/mongo/db/time_proof_service.cpp +++ b/src/mongo/db/time_proof_service.cpp @@ -48,14 +48,17 @@ TimeProofService::Key TimeProofService::generateRandomKey() { SHA1Block::kHashLength)); } -TimeProofService::TimeProof TimeProofService::getProof(const LogicalTime& time) const { +TimeProofService::TimeProof TimeProofService::getProof(const LogicalTime& time, + const Key& key) const { auto unsignedTimeArray = time.toUnsignedArray(); return SHA1Block::computeHmac( - _key.data(), _key.size(), unsignedTimeArray.data(), unsignedTimeArray.size()); + key.data(), key.size(), unsignedTimeArray.data(), unsignedTimeArray.size()); } -Status TimeProofService::checkProof(const LogicalTime& time, const TimeProof& proof) const { - auto myProof = getProof(time); +Status TimeProofService::checkProof(const LogicalTime& time, + const TimeProof& proof, + const Key& key) const { + auto myProof = getProof(time, key); if (myProof != proof) { return Status(ErrorCodes::TimeProofMismatch, "Proof does not match the logical time"); } |