You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+24-26Lines changed: 24 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,24 +9,26 @@ adds support for data protection and querying for encrypted properties for your
9
9
10
10
## What problem does this library solve?
11
11
12
-
When you need to store sensitive data in your database, you may want to encrypt it to protect it from unauthorized access. However, when you
13
-
encrypt data, it becomes unreadable by EF-core, which is not really convenient if you want to encrypt, for example, email addresses, or SSNs
14
-
AND then query them.
15
-
This library (optionally) hashes the sensitive data and stores their sha256 hashes in a shadow property alongside the encrypted data. This
16
-
allows you to query the encrypted data without decrypting it first. using `QueryableExt.WherePdEquals`
12
+
When you need to store sensitive data in your database, you may want to encrypt it to protect it from unauthorized access, however, when you
13
+
encrypt data, it becomes impossible to query it by EF-core, which is not really convenient if you want to encrypt, for example, email addresses, or SSNs
14
+
AND then filter entities by them.
15
+
This library (optionally) hashes the sensitive data and stores their sha256 hashes in a shadow property alongside the encrypted data.
16
+
This allows you to query the encrypted data without decrypting it first. using `QueryableExt.WherePdEquals`
17
17
18
18
## Disclaimer
19
19
20
-
This project is maintained by <ahref="https://github.com/ddjerqq">ddjerqq</a> and is not affiliated with Microsoft.
20
+
This project is maintained by [one (tenx) developer](https://github.com/ddjerqq) and is not affiliated with Microsoft.
21
21
22
-
I made this library initially to solve my own problems with EFCore when I needed to encrypt personal IDs but also query them. I wanted a
23
-
simple yet boilerplate-free solution. Thus, I made this library.
22
+
I made this library to solve my own problems with EFCore. I needed to store a bunch of protected personal data encrypted, among these properties were personal IDs, Emails, SocialSecurityNumbers and so on.
23
+
As you know, you cannot query encrypted data with EFCore, and I wanted a simple yet boilerplate-free solution. Thus, I made this library.
24
+
25
+
**What this library allows you to do, is to encrypt your properties and query them without decrypting them first. It does so by hashing the encrypted data and storing the hash in a shadow property alongside the encrypted data.**
24
26
25
27
I **do not** take responsibility for any damage done in production environments and lose of your encryption key or corruption of your data.
26
28
27
29
Keeping your encryption keys secure is your responsibility. If you lose your encryption key, **you will lose your data.**
28
30
29
-
## Supported property types
31
+
## Currently supported property types
30
32
31
33
- string
32
34
- byte[]
@@ -54,23 +56,23 @@ public class Your(DbContextOptions<Your> options, IDataProtectionProvider dataPr
> The `QueryableExt.WherePdEquals` method is only available for properties that are marked as Queryable using the `[Encrypt(isQueryable: true)]` attribute or the
151
145
> `IsEncrypted(isQueryable: true)` method.
152
146
147
+
> [!TIP]
148
+
> The `WherePdEquals` extension method generates an expression like this one under the hood:<br/>
0 commit comments