summaryrefslogtreecommitdiff
path: root/src/mongo/crypto/sha1_block.h
diff options
context:
space:
mode:
authorsamantharitter <samantha.ritter@10gen.com>2017-06-27 12:09:40 -0400
committerJason Carey <jcarey@argv.me>2017-07-13 17:40:53 -0400
commite1cae24805e3e7282958ee67a01555dd6ce40039 (patch)
treeebce77d9a502a193784483b2201b65e1a5010d98 /src/mongo/crypto/sha1_block.h
parent9a49ee3a03e02597086e577f06a71a0723bc0582 (diff)
downloadmongo-e1cae24805e3e7282958ee67a01555dd6ce40039.tar.gz
SERVER-29610 Allow LogicalSessionIds to contain signed user information
Diffstat (limited to 'src/mongo/crypto/sha1_block.h')
-rw-r--r--src/mongo/crypto/sha1_block.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mongo/crypto/sha1_block.h b/src/mongo/crypto/sha1_block.h
index 3cead63d6f9..7beaba8074d 100644
--- a/src/mongo/crypto/sha1_block.h
+++ b/src/mongo/crypto/sha1_block.h
@@ -31,7 +31,9 @@
#include <array>
#include <cstddef>
#include <string>
+#include <vector>
+#include "mongo/base/data_range.h"
#include "mongo/base/status_with.h"
namespace mongo {
@@ -85,6 +87,10 @@ public:
uint8_t* data() const&& = delete;
+ ConstDataRange toCDR() const {
+ return ConstDataRange(reinterpret_cast<const char*>(_hash.data()), kHashLength);
+ }
+
size_t size() const {
return _hash.size();
}
@@ -95,6 +101,11 @@ public:
static StatusWith<SHA1Block> fromBinData(const BSONBinData& binData);
/**
+ * Make a new SHA1Block from a vector of bytes representing bindata. For IDL.
+ */
+ static SHA1Block fromBinData(std::vector<unsigned char> bytes);
+
+ /**
* Append this to a builder using the given name as a BSON BinData type value.
*/
void appendAsBinData(BSONObjBuilder& builder, StringData fieldName) const;