From a5d4863b3f93600549bed618dd00c1362b80542b Mon Sep 17 00:00:00 2001 From: Agoston Horvath Date: Mon, 19 Nov 2018 16:40:15 +0100 Subject: [PATCH] Update README.md --- README.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f9f0773..06c4f6a 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Add dependency: com.bol spring-data-mongodb-encrypt - 2.0.0 + 2.1.0 ``` @@ -233,6 +233,20 @@ If you want to use this library to encrypt arbitrary fields directly via mongo-d } ``` +## Ignore decryption failures + +Sometimes (see #17) it is useful to bypass the otherwise rigid decryption framework and allow for a best-effort reading of mongodb documents. Using the `EncryptionEventListener.withSilentDecryptionFailure(true)` allows to bypass these failures and leave the failing fields empty. Example: + +```java + @Bean + public CachedEncryptionEventListener encryptionEventListener(CryptVault cryptVault) { + return new CachedEncryptionEventListener(cryptVault) + .withSilentDecryptionFailure(true); + } +``` + +It is also possible to autowire EncryptionEventListener and change this setting on-the-fly. + ## Encrypting the whole document While it was not the use case for this library, it is very well possible to do whole document encryption with it.