admin管理员组文章数量:1290104
I have followed the [documentation][1] and I cannot get FLE to work in my SpringBoot Java application..
Whenever I attempt to use an @Encrypted
annotation, it responds with the following Exception:
Request processing failed: java.lang.IllegalArgumentException: cryptoManager needed to encrypt/decrypt but it is null. Override needed for cryptoManager() method of .springframework.data.couchbase.core.convert.AbstractCouchbaseConverter
Code is shown below:
@Configuration
@EnableCouchbaseRepositories("my.repo.under.here")
public class EncryptionConfig extends AbstractCouchbaseConfiguration {
// Usual Setup
@Override public String getConnectionString() { return "localhost"; }
@Override public String getUserName() { return "Administrator"; }
@Override public String getPassword() { return "admin123"; }
@Override public String getBucketName() { return "my_bucket"; }
/* provide a cryptoManager */
@Override
protected CryptoManager cryptoManager() {
try {
// Load the Java KeyStore
KeyStore keyStore = KeyStore.getInstance("JCEKS");
FileInputStream keyStoreStream = new FileInputStream("/Users/asd1983/my-keystore.jceks");
keyStore.load(keyStoreStream, "test123".toCharArray());
// Initialize the Keyring with the KeyStore
Keyring keyring = new KeyStoreKeyring(keyStore, alias -> "keypassword");
// AES-256 authenticated with HMAC SHA-512. Requires a 64-byte key.
AeadAes256CbcHmacSha512Provider provider = AeadAes256CbcHmacSha512Provider.builder().keyring(keyring).build();
CryptoManager cryptoManager = DefaultCryptoManager.builder().decrypter(provider.decrypter())
.defaultEncrypter(provider.encrypterForKey("my-key")).build();
return cryptoManager;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
@Document
public class Data {
@Id
private String id;
@Encrypted
private String password;
}
package my.repo.under.here;
@Repository
public interface DataRepository extends CouchbaseRepository<Data, String> { }
[1]: .html
I have followed the [documentation][1] and I cannot get FLE to work in my SpringBoot Java application..
Whenever I attempt to use an @Encrypted
annotation, it responds with the following Exception:
Request processing failed: java.lang.IllegalArgumentException: cryptoManager needed to encrypt/decrypt but it is null. Override needed for cryptoManager() method of .springframework.data.couchbase.core.convert.AbstractCouchbaseConverter
Code is shown below:
@Configuration
@EnableCouchbaseRepositories("my.repo.under.here")
public class EncryptionConfig extends AbstractCouchbaseConfiguration {
// Usual Setup
@Override public String getConnectionString() { return "localhost"; }
@Override public String getUserName() { return "Administrator"; }
@Override public String getPassword() { return "admin123"; }
@Override public String getBucketName() { return "my_bucket"; }
/* provide a cryptoManager */
@Override
protected CryptoManager cryptoManager() {
try {
// Load the Java KeyStore
KeyStore keyStore = KeyStore.getInstance("JCEKS");
FileInputStream keyStoreStream = new FileInputStream("/Users/asd1983/my-keystore.jceks");
keyStore.load(keyStoreStream, "test123".toCharArray());
// Initialize the Keyring with the KeyStore
Keyring keyring = new KeyStoreKeyring(keyStore, alias -> "keypassword");
// AES-256 authenticated with HMAC SHA-512. Requires a 64-byte key.
AeadAes256CbcHmacSha512Provider provider = AeadAes256CbcHmacSha512Provider.builder().keyring(keyring).build();
CryptoManager cryptoManager = DefaultCryptoManager.builder().decrypter(provider.decrypter())
.defaultEncrypter(provider.encrypterForKey("my-key")).build();
return cryptoManager;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
@Document
public class Data {
@Id
private String id;
@Encrypted
private String password;
}
package my.repo.under.here;
@Repository
public interface DataRepository extends CouchbaseRepository<Data, String> { }
[1]: https://docs.spring.io/spring-data/couchbase/reference/couchbase/fieldlevelencryption.html
Share
Improve this question
asked Feb 20 at 22:16
Colin SchofieldColin Schofield
1671 silver badge14 bronze badges
1 Answer
Reset to default -1Yeah it turned out to just be a slight configuration issues and it is working well now
本文标签: javaField Level Encryption in Couchbase DBStack Overflow
版权声明:本文标题:java - Field Level Encryption in Couchbase DB - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741404760a2376876.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论