Encryption at REST - Problem with encryption of nested objects in the entities

Currently working on encrypting the data at REST in couchbase in order to comply with the GDPR guidelines.
For this after analysing the options we decided to go with using the field level encryption of the Java Entities by using the Java and the Encryption SDK provided.
Following are the details of versions used :-

CouchBase Version – 6.0

CouchBase Java SDK Version – 2.7.11

Couchbase Encryption API version – 2.0.1

This API gives exception when we try to encrypt entities which have other objects as fields. It only works in case of entities where the fields are of the primitive type or string.

The exception that is thrown is “Unsupported Field Type…” when we try to encrypt entities which have fields with objects whereas it works perfectly fine for normal entities which only have primitive fields.

On analysing & debugging the API I find that the CouchbaseAsyncRepository uses a default converter of type DefaultEntityConverter(). This is hardcoded in the constructor.

Also, the DefaultEntityConverter checks if the given field is of type String, Boolean, Integer, Long, Double and proceeds with the encryption call. Otherwise it just throws a exception.

Due to this it is difficult to use the SDK for encryption of fields which contain objects. I tried using the repository().insert() code also. Still getting the same error.

Is there any solution for this ?
Is there any other best practise to be followed while implementing this solution ?

Any insight on this would be very helpful.

Exception stack trace.

  1. Screenshot of the constructor in AsyncCouchbaseRepository
  1. Screenshot of the DefaultEntityConverter checking logic.