[CSHARP-240] Encrypt Attribute Created: 07/Jun/11  Updated: 15/Apr/19  Resolved: 04/May/12

Status: Closed
Project: C# Driver
Component/s: None
Affects Version/s: 1.0
Fix Version/s: 1.5

Type: New Feature Priority: Minor - P4
Reporter: Thomas Tucker Assignee: Craig Wilson
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

The MongoDB driver needs a BsonEncryptAttribute
This could be applied to properties that are passwords, social security numbers or other personal information.
It could take parameters for type of encryption and secret key.
Then the driver could automatically encrypt and decrypt the data upon serialization and deserialization.
Maybe a BsonHashAttribute would be better for password fields.



 Comments   
Comment by Charchit P [ 15/Apr/19 ]

The link for the working code provided above(https://github.com/craiggwilson/mongo-csharp-driver/commit/63eae0ac9468e5d0c68c35eaa8dd9f409eba3f08) is not working. Do you have a updated link for working example of BsonEncryptAttribute ?

Comment by Craig Wilson [ 29/Apr/12 ]

This can be enabled with a custom IBsonSerializer implementation. In addition, the 1.5 version of the driver will enable custom attribute creation to bootstrap the assignment of the custom serializer. You can view the working code here: https://github.com/craiggwilson/mongo-csharp-driver/commit/63eae0ac9468e5d0c68c35eaa8dd9f409eba3f08.

Comment by Thomas Tucker [ 07/Jul/11 ]

It would be valuable in all drivers.
I dont see how it could be implemented in the core database as the database should not know its data is encrypted or how.
As long as you know the parameters/algorithms applied to the attribute you could decrypt the data with any language/driver. You would just have to do it manually.

Comment by michael [ 02/Jul/11 ]

Is this really a feature specific to the C# Driver? Or does this belong close to Mongo core?

E.g. if you write a BsonEncryptAttribute with your C# driver, how would someone with a different driver recover the value?

Generated at Wed Feb 07 21:36:14 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.