Working on a POC to test Client side field level encryption.
Following the instruction given here in this link.
And the sample code am using is from here.
Now my question is around SHARED_LIB_PATH , What needs to be given here ?
My Mongo is running in a remote machine. So on MongoDB URI am providing that as connection string.
On SHARED_LIB_PATH , Am giving the path of mongocryptd binary located in my remote machine where my mongo process is running.
yourCredentials.put(“SHARED_LIB_PATH”, “/var/lib/mongodb-mms-automation/mongodb-linux-x86_64-6.0.14-ent/bin/mongocryptd”);
Am facing errors as
java.lang.UnsatisfiedLinkError: Error looking up function ‘mongocrypt_ctx_setopt_masterkey_aws’: The specified procedure could not be found.
at com.sun.jna.Function.<init>(Function.java:252)
at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:600)
at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:576)
at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:562)
at com.sun.jna.Native.register(Native.java:1904)
at com.sun.jna.Native.register(Native.java:1775)
at com.mongodb.crypt.capi.CAPI.<clinit>(CAPI.java:1128)
at com.mongodb.crypt.capi.MongoCryptImpl.<init>(MongoCryptImpl.java:112)
at com.mongodb.crypt.capi.MongoCrypts.create(MongoCrypts.java:36)
at com.mongodb.client.internal.Crypts.createCrypt(Crypts.java:50)
at com.mongodb.client.internal.MongoClientImpl.<init>(MongoClientImpl.java:87)
at com.mongodb.client.internal.MongoClientImpl.<init>(MongoClientImpl.java:72)
at com.mongodb.client.MongoClients.create(MongoClients.java:108)
at com.mongodb.client.MongoClients.create(MongoClients.java:50)
at com.mongodb.csfle.InsertEncryptedDocument.main(InsertEncryptedDocument.java:127)
Since i dont want cryptSharedLib - I mentioned that as fales in extraOptions. Used for creating MongoClientSettings
extraOptions.put(“cryptSharedLibRequired”,false);
// start-client
MongoClientSettings clientSettings = MongoClientSettings.builder()
.applyConnectionString(new ConnectionString(connectionString))
.autoEncryptionSettings(AutoEncryptionSettings.builder()
.keyVaultNamespace(keyVaultNamespace)
.kmsProviders(kmsProviders)
.schemaMap(schemaMap)
.extraOptions(extraOptions)
.build())
.build();
MongoClient mongoClientSecure = MongoClients.create(clientSettings);
// end-client
This is how mu code likes like and failing here.
Please help me to sort out things here.
Thanks,
Naveen.