Skip to content

Java: Update payloads to new QE protocol #610

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

Merged
merged 1 commit into from
Apr 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,18 @@ public interface mongocrypt_random_fn extends Callback {
public static native void
mongocrypt_setopt_bypass_query_analysis (mongocrypt_t crypt);

/**
* Enable/disable the use of FLE2v2 payload types for write.
*
* @param crypt The @ref mongocrypt_t object.
* @param enable Whether to enable use of FLE2v2 payloads.
*
* @return A boolean indicating success. If false, an error status is set. Retrieve it with @ref mongocrypt_status
* @since 1.8
*/
public static native boolean
mongocrypt_setopt_fle2v2(mongocrypt_t crypt, boolean enable);

/**
* Set the contention factor used for explicit encryption.
* The contention factor is only used for indexed Queryable Encryption.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
import static com.mongodb.crypt.capi.CAPI.mongocrypt_setopt_crypto_hook_sign_rsaes_pkcs1_v1_5;
import static com.mongodb.crypt.capi.CAPI.mongocrypt_setopt_crypto_hooks;
import static com.mongodb.crypt.capi.CAPI.mongocrypt_setopt_encrypted_field_config_map;
import static com.mongodb.crypt.capi.CAPI.mongocrypt_setopt_fle2v2;
import static com.mongodb.crypt.capi.CAPI.mongocrypt_setopt_kms_provider_aws;
import static com.mongodb.crypt.capi.CAPI.mongocrypt_setopt_kms_provider_local;
import static com.mongodb.crypt.capi.CAPI.mongocrypt_setopt_kms_providers;
Expand Down Expand Up @@ -138,6 +139,8 @@ class MongoCryptImpl implements MongoCrypt {
configure(() -> mongocrypt_setopt_crypto_hook_sign_rsaes_pkcs1_v1_5(wrapped, signingRSAESPKCSCallback, null));
configure(() -> mongocrypt_setopt_aes_256_ctr(wrapped, aesCTR256EncryptCallback, aesCTR256DecryptCallback, null));

configure(() -> mongocrypt_setopt_fle2v2(wrapped, true));

if (options.getLocalKmsProviderOptions() != null) {
try (BinaryHolder localMasterKeyBinaryHolder = toBinary(options.getLocalKmsProviderOptions().getLocalMasterKey())) {
configure(() -> mongocrypt_setopt_kms_provider_local(wrapped, localMasterKeyBinaryHolder.getBinary()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.bson.BsonDocument;
import org.bson.BsonString;
import org.bson.RawBsonDocument;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

import java.io.BufferedReader;
Expand Down Expand Up @@ -197,6 +198,8 @@ public void testExplicitEncryptionDecryption() {
mongoCrypt.close();
}


@Disabled // Pending MONGOCRYPT-567
@Test
public void testExplicitExpressionEncryption() {
MongoCrypt mongoCrypt = createMongoCrypt();
Expand Down