summaryrefslogtreecommitdiff
path: root/src/mongo/crypto/fle_crypto.h
diff options
context:
space:
mode:
authorsergey.galtsev <sergey.galtsev@mongodb.com>2022-03-31 15:22:40 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-03-31 17:38:01 +0000
commit24e8f255b1f8b48594e6354912768682a04b8b1b (patch)
treef401c7facd48d2569fa17e557e36140bd9ce2757 /src/mongo/crypto/fle_crypto.h
parent2d78530f2b590d205232bd3d65cb8f66500aa86f (diff)
downloadmongo-24e8f255b1f8b48594e6354912768682a04b8b1b.tar.gz
SERVER-63791 support unindexed fle2 encrypted fields
Diffstat (limited to 'src/mongo/crypto/fle_crypto.h')
-rw-r--r--src/mongo/crypto/fle_crypto.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/mongo/crypto/fle_crypto.h b/src/mongo/crypto/fle_crypto.h
index 649429ce790..3a93676826d 100644
--- a/src/mongo/crypto/fle_crypto.h
+++ b/src/mongo/crypto/fle_crypto.h
@@ -896,6 +896,28 @@ struct FLE2IndexedEqualityEncryptedValue {
std::vector<uint8_t> clientEncryptedValue;
};
+/**
+ * Class to read/write FLE2 Unindexed Encrypted Values
+ *
+ * Fields are encrypted with the following:
+ *
+ * struct {
+ * uint8_t fle_blob_subtype = 6;
+ * uint8_t key_uuid[16];
+ * uint8 original_bson_type;
+ * ciphertext[ciphertext_length];
+ * } blob;
+ *
+ */
+struct FLE2UnindexedEncryptedValue {
+ static std::vector<uint8_t> serialize(const FLEUserKeyAndId& userKey,
+ const BSONElement& element);
+ static std::pair<BSONType, std::vector<uint8_t>> deserialize(FLEKeyVault* keyVault,
+ ConstDataRange blob);
+
+ static constexpr size_t assocDataSize = sizeof(uint8_t) + sizeof(UUID) + sizeof(uint8_t);
+};
+
struct EDCServerPayloadInfo {
ESCDerivedFromDataTokenAndContentionFactorToken getESCToken() const;