0

Using .Net C# I'm trying to encrypt sub document while inserting & decrypt same while reading. I tried with CSFL but no use.

Could any one suggest the solution

1 Answers1

0

It's exactly what CSFLE is designed for, in particular I mean auto encryption. Look at this doc. You should specify your subSocument in schemaMap, in the provided example, encryptedField is a field that will be automatically encrypted during writing and decrypted during reading.

dododo
  • 3,872
  • 1
  • 14
  • 37
  • ````MongoDB.Driver.Encryption.MongoEncryptionException: 'Encryption related exception: Exception starting mongocryptd process. Is mongocryptd on the system path?.' ```` Facing above exception - dododo – Varanasi Phaneendra Apr 06 '22 at 12:28
  • you should read the doc above, this error says that mongocryptd which is required process for auto encryption (and only available in enterprise server though) is not launched. – dododo Apr 06 '22 at 13:19
  • You can find how to do it in my answer here https://stackoverflow.com/questions/70154963/unable-understand-how-to-install-libmongocrypt/70159362#70159362 – dododo Apr 06 '22 at 13:20
  • it can be also launched automatically if the path to mongocryptd is added into your PATH env variable – dododo Apr 06 '22 at 13:21