Skip to content

Field Level Encryption [DATACOUCH-455] #763

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
spring-projects-issues opened this issue Jun 4, 2019 · 2 comments · Fixed by #1546, #1550 or #1554
Closed

Field Level Encryption [DATACOUCH-455] #763

spring-projects-issues opened this issue Jun 4, 2019 · 2 comments · Fixed by #1546, #1550 or #1554
Assignees
Labels
in: mapping Mapping and conversion infrastructure type: enhancement A general enhancement

Comments

@spring-projects-issues
Copy link

Domenico Ursoleo opened DATACOUCH-455 and commented

Couchbase has a Field Level Encryption feature that encrypt field of a Document simply putting the @EncryptField annotation on a field of the document model and addind a CryptoManager to the environment,

With this configuration:

@Configuration
@EnableCouchbaseRepositories(basePackages = { "com.example.demo.db" })
public class MyCouchbaseConfig extends AbstractCouchbaseConfiguration {
 
@Override 
protected CouchbaseEnvironment getEnvironment() { 
try {
 JceksKeyStoreProvider kp = new JceksKeyStoreProvider("secret");
 kp.publicKeyName("mypublickey");
 kp.storeKey("mypublickey",
           "!mysecretkey#9^5usdk39d&dlf)03sL".getBytes(Charset.forName("UTF-8")));
 kp.signingKeyName("HMACsecret");
 kp.storeKey("HMACsecret", "myauthpassword".getBytes(Charset.forName("UTF-8")));
 AES256CryptoProvider aes256CryptoProvider = new AES256CryptoProvider(kp);
 CryptoManager cryptoManager = new CryptoManager();
 cryptoManager.registerProvider("MyAESProvider", aes256CryptoProvider);
 return 
    DefaultCouchbaseEnvironment.builder().cryptoManager(cryptoManager).build();
 } catch (Exception ex) { return null; } }
}

 Given the model

 

@Document
public class User {
@Id
@GeneratedValue(strategy = GenerationStrategy.UNIQUE)
private String id;

@Field("user")
private String userName;

@EncryptedField(provider = "MyAESProvider") 
@Field("pwd") 
private String password;

// Setters & getters
}

Persisting it via a simple CrudRepository should encrypt the password like calling the native couchbase java client:

EntityDocument<User> document = EntityDocument.create(user);          bucket.repository().upsert(document);
 

 

 


Affects: 3.1.8 (Lovelace SR8)

1 votes, 2 watchers

@spring-projects-issues spring-projects-issues added type: enhancement A general enhancement in: mapping Mapping and conversion infrastructure labels Dec 31, 2020
@mikereiche mikereiche added this to the 5.0 M6 (2022.0.0) milestone Aug 1, 2022
@mikereiche
Copy link
Collaborator

com.couchbase.client couchbase-encryption ${version}

mikereiche added a commit that referenced this issue Aug 26, 2022
Note that an @Encrypted property object that contains an @Encrypted property is
not supported and will result in an exception.

Closes #763.
mikereiche added a commit that referenced this issue Aug 26, 2022
Note that an @Encrypted property object that contains an @Encrypted property is
not supported and will result in an exception.

Closes #763.
mikereiche added a commit that referenced this issue Aug 26, 2022
Note that an @Encrypted property object that contains an @Encrypted property is
not supported and will result in an exception.

Closes #763.
mikereiche added a commit that referenced this issue Aug 26, 2022
Note that an @Encrypted property object that contains an @Encrypted property is
not supported and will result in an exception.

Closes #763.
mikereiche added a commit that referenced this issue Aug 26, 2022
Note that an @Encrypted property object that contains an @Encrypted property is
not supported and will result in an exception.

Closes #763.
mikereiche added a commit that referenced this issue Aug 26, 2022
Note that an @Encrypted property object that contains an @Encrypted property is
not supported and will result in an exception.

Closes #763.
mikereiche added a commit that referenced this issue Aug 29, 2022
Note that an @Encrypted property object that contains an @Encrypted property is
not supported and will result in an exception.

Closes #763.
mikereiche added a commit that referenced this issue Aug 30, 2022
mikereiche added a commit that referenced this issue Aug 30, 2022
@mikereiche mikereiche mentioned this issue Aug 30, 2022
5 tasks
mikereiche added a commit that referenced this issue Sep 1, 2022
mikereiche added a commit that referenced this issue Sep 9, 2022
mikereiche added a commit that referenced this issue Sep 12, 2022
mikereiche added a commit that referenced this issue Sep 13, 2022
mikereiche added a commit that referenced this issue Oct 7, 2022
mikereiche added a commit that referenced this issue Oct 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment