libmongocrypt-helper 1.12.0.0.1001 → 1.13.2.0.1001

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (491) hide show
  1. checksums.yaml +4 -4
  2. data/ext/libmongocrypt/libmongocrypt/CHANGELOG.md +19 -0
  3. data/ext/libmongocrypt/libmongocrypt/CMakeLists.txt +10 -0
  4. data/ext/libmongocrypt/libmongocrypt/CODEOWNERS +1 -4
  5. data/ext/libmongocrypt/libmongocrypt/CONTRIBUTING.md +14 -0
  6. data/ext/libmongocrypt/libmongocrypt/Earthfile +49 -50
  7. data/ext/libmongocrypt/libmongocrypt/README.md +8 -17
  8. data/ext/libmongocrypt/libmongocrypt/bindings/python/CHANGELOG.rst +6 -0
  9. data/ext/libmongocrypt/libmongocrypt/bindings/python/README.rst +1 -1
  10. data/ext/libmongocrypt/libmongocrypt/bindings/python/libmongocrypt-version.txt +1 -1
  11. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/binding.py +39 -1
  12. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/mongocrypt.py +32 -0
  13. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/version.py +1 -1
  14. data/ext/libmongocrypt/libmongocrypt/bindings/python/release.sh +1 -1
  15. data/ext/libmongocrypt/libmongocrypt/bindings/python/sbom.json +8 -8
  16. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/compact/success/encrypted-field-config-map.json +0 -1
  17. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/encrypted-field-config-map.json +0 -2
  18. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/test_mongocrypt.py +11 -11
  19. data/ext/libmongocrypt/libmongocrypt/cmake/FetchMongoC.cmake +4 -2
  20. data/ext/libmongocrypt/libmongocrypt/cmake/ImportBSON.cmake +3 -5
  21. data/ext/libmongocrypt/libmongocrypt/doc/releasing.md +14 -27
  22. data/ext/libmongocrypt/libmongocrypt/etc/cyclonedx.sbom.json +9 -9
  23. data/ext/libmongocrypt/libmongocrypt/etc/format.sh +0 -2
  24. data/ext/libmongocrypt/libmongocrypt/etc/libbson-remove-GCC-diagnostic-in-functions.patch +158 -0
  25. data/ext/libmongocrypt/libmongocrypt/etc/libbson-remove-GCC-diagnostic-pragma.patch +3 -3
  26. data/ext/libmongocrypt/libmongocrypt/etc/purls.txt +1 -1
  27. data/ext/libmongocrypt/libmongocrypt/integrating.md +42 -11
  28. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_crypto_windows.c +2 -2
  29. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_message.c +1 -1
  30. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_message_private.h +2 -2
  31. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_request.c +3 -3
  32. data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kmip_reader_writer.c +5 -5
  33. data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_assert.h +25 -8
  34. data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_azure_online.c +2 -2
  35. data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_gcp_online.c +3 -3
  36. data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kms_request.c +12 -10
  37. data/ext/libmongocrypt/libmongocrypt/src/mc-efc-private.h +5 -0
  38. data/ext/libmongocrypt/libmongocrypt/src/mc-efc.c +35 -1
  39. data/ext/libmongocrypt/libmongocrypt/src/mc-fle-blob-subtype-private.h +4 -1
  40. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-encryption-placeholder-private.h +79 -0
  41. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-encryption-placeholder.c +226 -2
  42. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload-v2.c +0 -1
  43. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload.c +0 -1
  44. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload-private-v2.h +34 -0
  45. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload-v2.c +165 -1
  46. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload.c +0 -1
  47. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-iev-private-v2.h +105 -7
  48. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-iev-v2.c +381 -70
  49. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-tag-and-encrypted-metadata-block-private.h +7 -2
  50. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-tag-and-encrypted-metadata-block.c +17 -0
  51. data/ext/libmongocrypt/libmongocrypt/src/mc-schema-broker-private.h +126 -0
  52. data/ext/libmongocrypt/libmongocrypt/src/mc-schema-broker.c +1075 -0
  53. data/ext/libmongocrypt/libmongocrypt/src/mc-str-encode-string-sets-private.h +95 -0
  54. data/ext/libmongocrypt/libmongocrypt/src/mc-str-encode-string-sets.c +304 -0
  55. data/ext/libmongocrypt/libmongocrypt/src/mc-text-search-str-encode-private.h +45 -0
  56. data/ext/libmongocrypt/libmongocrypt/src/mc-text-search-str-encode.c +248 -0
  57. data/ext/libmongocrypt/libmongocrypt/src/mc-tokens-private.h +112 -2
  58. data/ext/libmongocrypt/libmongocrypt/src/mc-tokens.c +166 -2
  59. data/ext/libmongocrypt/libmongocrypt/src/mlib/windows-lean.h +2 -0
  60. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-buffer-private.h +11 -0
  61. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-buffer.c +36 -3
  62. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-decrypt.c +8 -4
  63. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-encrypt.c +430 -857
  64. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-private.h +5 -19
  65. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-kms-ctx.c +1 -1
  66. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-marking.c +516 -523
  67. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-opts-private.h +0 -4
  68. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-private.h +7 -12
  69. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-traverse-util.c +1 -1
  70. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-util.c +3 -1
  71. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt.c +6 -9
  72. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt.h +17 -0
  73. data/ext/libmongocrypt/libmongocrypt/src/os_posix/os_dll.c +3 -1
  74. data/ext/libmongocrypt/libmongocrypt/src/unicode/case-fold-map.c +1434 -0
  75. data/ext/libmongocrypt/libmongocrypt/src/unicode/diacritic-fold-map.c +2884 -0
  76. data/ext/libmongocrypt/libmongocrypt/src/unicode/fold.c +139 -0
  77. data/ext/libmongocrypt/libmongocrypt/src/unicode/fold.h +58 -0
  78. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/unencrypted/payload.json +2 -2
  79. data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/missing-key-id/collinfo.json +1 -0
  80. data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/no-fields/collinfo.json +1 -0
  81. data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/success/collinfo.json +1 -0
  82. data/ext/libmongocrypt/libmongocrypt/test/data/compact/anchor-pad/collinfo.json +1 -1
  83. data/ext/libmongocrypt/libmongocrypt/test/data/compact/anchor-pad/encrypted-payload-range-v2.json +20 -21
  84. data/ext/libmongocrypt/libmongocrypt/test/data/compact/missing-key-id/collinfo.json +2 -2
  85. data/ext/libmongocrypt/libmongocrypt/test/data/compact/no-fields/collinfo.json +1 -1
  86. data/ext/libmongocrypt/libmongocrypt/test/data/compact/no-range/collinfo.json +1 -1
  87. data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/collinfo.json +1 -1
  88. data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/encrypted-field-config-map.json +0 -1
  89. data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/encrypted-payload-range-v2.json +20 -21
  90. data/ext/libmongocrypt/libmongocrypt/test/data/dollardb/omitted/cmd-to-mongocryptd.json +1 -2
  91. data/ext/libmongocrypt/libmongocrypt/test/data/dollardb/omitted/collinfo.json +2 -2
  92. data/ext/libmongocrypt/libmongocrypt/test/data/dollardb/omitted/encrypted-payload.json +2 -3
  93. data/ext/libmongocrypt/libmongocrypt/test/data/dollardb/omitted/mongocryptd-reply.json +1 -2
  94. data/ext/libmongocrypt/libmongocrypt/test/data/dollardb/preserved/cmd-to-mongocryptd.json +1 -2
  95. data/ext/libmongocrypt/libmongocrypt/test/data/dollardb/preserved/collinfo.json +2 -2
  96. data/ext/libmongocrypt/libmongocrypt/test/data/dollardb/preserved/encrypted-payload.json +2 -3
  97. data/ext/libmongocrypt/libmongocrypt/test/data/dollardb/preserved/mongocryptd-reply.json +1 -2
  98. data/ext/libmongocrypt/libmongocrypt/test/data/dollardb/preserved_empty/cmd-to-mongocryptd.json +1 -2
  99. data/ext/libmongocrypt/libmongocrypt/test/data/dollardb/preserved_empty/collinfo.json +2 -2
  100. data/ext/libmongocrypt/libmongocrypt/test/data/dollardb/preserved_empty/mongocryptd-reply.json +1 -2
  101. data/ext/libmongocrypt/libmongocrypt/test/data/dollardb/preserved_fle1/collinfo.json +2 -1
  102. data/ext/libmongocrypt/libmongocrypt/test/data/efc/efc-extraField.json +0 -1
  103. data/ext/libmongocrypt/libmongocrypt/test/data/efc/efc-missingKeyId.json +0 -1
  104. data/ext/libmongocrypt/libmongocrypt/test/data/efc/efc-oneField-badVersionSet.json +23 -0
  105. data/ext/libmongocrypt/libmongocrypt/test/data/efc/efc-oneField-goodVersionSet.json +23 -0
  106. data/ext/libmongocrypt/libmongocrypt/test/data/efc/efc-oneField.json +0 -1
  107. data/ext/libmongocrypt/libmongocrypt/test/data/efc/efc-textSearchFields-badVersionSet.json +48 -0
  108. data/ext/libmongocrypt/libmongocrypt/test/data/efc/efc-textSearchFields-goodVersionSet.json +48 -0
  109. data/ext/libmongocrypt/libmongocrypt/test/data/efc/efc-textSearchFields.json +47 -0
  110. data/ext/libmongocrypt/libmongocrypt/test/data/efc/efc-twoFields.json +0 -1
  111. data/ext/libmongocrypt/libmongocrypt/test/data/encrypted-field-config-map.json +1 -3
  112. data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE1DeterministicEncryptedValue.json +8 -0
  113. data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE1EncryptionPlaceholder.json +8 -0
  114. data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE1RandomEncryptedValue.json +8 -0
  115. data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2EncryptionPlaceholder.json +8 -0
  116. data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2EqualityIndexedValueV2.json +8 -0
  117. data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2FindEqualityPayloadV2.json +8 -0
  118. data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2IndexedEqualityEncryptedValue.json +8 -0
  119. data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2IndexedEqualityEncryptedValueV2.json +8 -0
  120. data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2IndexedRangeEncryptedValue.json +8 -0
  121. data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2IndexedRangeEncryptedValueV2.json +8 -0
  122. data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2InsertUpdatePayload-with-edges-V2.json +8 -0
  123. data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2InsertUpdatePayload-with-edges.json +8 -0
  124. data/ext/libmongocrypt/libmongocrypt/test/data/{fle2-explicit/insert-indexed.json → explicit-decrypt/FLE2InsertUpdatePayload.json} +1 -1
  125. data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2InsertUpdatePayloadV2.json +8 -0
  126. data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2RangeIndexedValueV2.json +8 -0
  127. data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2UnindexedEncryptedValue.json +8 -0
  128. data/ext/libmongocrypt/libmongocrypt/test/data/explicit-decrypt/FLE2UnindexedEncryptedValueV2.json +8 -0
  129. data/ext/libmongocrypt/libmongocrypt/test/data/find-with-encryptionInformation.json +0 -1
  130. data/ext/libmongocrypt/libmongocrypt/test/data/fle1-explain/with-csfle/collinfo.json +2 -1
  131. data/ext/libmongocrypt/libmongocrypt/test/data/fle1-explain/with-mongocryptd/collinfo.json +2 -1
  132. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-bad-str-encode-version/bad-collinfo.json +26 -0
  133. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-bad-str-encode-version/bad-create-cmd-mongocryptd-reply.json +51 -0
  134. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-bad-str-encode-version/bad-create-cmd-to-mongocryptd.json +45 -0
  135. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-bad-str-encode-version/bad-create-cmd.json +18 -0
  136. data/ext/libmongocrypt/libmongocrypt/test/data/{fle2-find-range/int32/encrypted-field-map.json → fle2-bad-str-encode-version/bad-encrypted-field-config-map.json} +7 -12
  137. data/ext/libmongocrypt/libmongocrypt/test/data/{fle2-insert → fle2-bad-str-encode-version}/encrypted-payload.json +4 -4
  138. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-create/cmd-to-mongocryptd.json +1 -2
  139. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-create/encrypted-field-config-map.json +1 -2
  140. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-create-encrypted-collection/cmd-to-mongocryptd.json +44 -0
  141. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-create-encrypted-collection/cmd.json +17 -0
  142. data/ext/libmongocrypt/libmongocrypt/test/data/{fle2-find-equality/encrypted-field-map.json → fle2-create-encrypted-collection/encrypted-field-config-map.json} +9 -8
  143. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-create-encrypted-collection/encrypted-payload.json +17 -0
  144. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-create-encrypted-collection/mongocryptd-reply.json +50 -0
  145. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-create-encrypted-collection-encrypted-fields-unset-str-encode-version/cmd-to-mongocryptd.json +45 -0
  146. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-create-encrypted-collection-encrypted-fields-unset-str-encode-version/mongocryptd-reply.json +51 -0
  147. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-create-encrypted-collection-with-str-encode-version/cmd-to-mongocryptd.json +46 -0
  148. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-create-encrypted-collection-with-str-encode-version/cmd.json +18 -0
  149. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-create-encrypted-collection-with-str-encode-version/encrypted-field-config-map.json +25 -0
  150. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-create-encrypted-collection-with-str-encode-version/encrypted-payload.json +18 -0
  151. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-create-encrypted-collection-with-str-encode-version/mongocryptd-reply.json +52 -0
  152. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-delete/empty/collinfo.json +1 -1
  153. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-delete/empty/encrypted-field-config-map.json +0 -1
  154. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-delete/empty/encrypted-payload-v2.json +57 -59
  155. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-delete/empty/mongocryptd-reply.json +63 -64
  156. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-delete/success/collinfo.json +1 -1
  157. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-delete/success/encrypted-field-config-map.json +0 -1
  158. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-delete/success/encrypted-payload-v2.json +64 -66
  159. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-delete/success/mongocryptd-reply.json +69 -70
  160. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explain/with-csfle/collinfo.json +1 -1
  161. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explain/with-csfle/encrypted-payload.json +1 -2
  162. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explain/with-mongocryptd/cmd-to-mongocryptd.json +1 -2
  163. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explain/with-mongocryptd/collinfo.json +2 -2
  164. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explain/with-mongocryptd/encrypted-payload.json +2 -3
  165. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explain/with-mongocryptd/mongocryptd-reply.json +1 -2
  166. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-explicit/cmd-to-mongocryptd.json +0 -1
  167. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-explicit/cmd-to-mongod.json +0 -1
  168. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-explicit/reply-from-mongocryptd.json +0 -1
  169. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32/encrypted-field-map.json +0 -1
  170. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-text-search/cmd.json +9 -0
  171. data/ext/libmongocrypt/libmongocrypt/test/data/{fle2-find-range/date → fle2-insert-text-search}/encrypted-field-map.json +10 -9
  172. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-text-search/encrypted-payload.json +47 -0
  173. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-text-search/mongocryptd-reply.json +55 -0
  174. data/ext/libmongocrypt/libmongocrypt/test/data/{fle2-find-range/double → fle2-insert-text-search-with-str-encode-version}/encrypted-field-map.json +12 -10
  175. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-text-search-with-str-encode-version/encrypted-payload.json +47 -0
  176. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-text-search-with-str-encode-version/mongocryptd-reply.json +55 -0
  177. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-v2-with-str-encode-version/cmd.json +9 -0
  178. data/ext/libmongocrypt/libmongocrypt/test/data/{fle2-insert → fle2-insert-v2-with-str-encode-version}/encrypted-field-map.json +2 -2
  179. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-v2-with-str-encode-version/encrypted-payload.json +40 -0
  180. data/ext/libmongocrypt/libmongocrypt/test/data/{fle2-insert → fle2-insert-v2-with-str-encode-version}/mongocryptd-reply.json +2 -2
  181. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-text-search-create-encrypted-collection/cmd-to-mongocryptd.json +55 -0
  182. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-text-search-create-encrypted-collection/cmd.json +22 -0
  183. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-text-search-create-encrypted-collection/encrypted-field-config-map.json +29 -0
  184. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-text-search-create-encrypted-collection/encrypted-payload.json +23 -0
  185. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-text-search-create-encrypted-collection/mongocryptd-reply.json +61 -0
  186. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-text-search-create-encrypted-collection-with-str-encode-version/cmd-to-mongocryptd.json +56 -0
  187. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-text-search-create-encrypted-collection-with-str-encode-version/cmd.json +23 -0
  188. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-text-search-create-encrypted-collection-with-str-encode-version/encrypted-field-config-map.json +30 -0
  189. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-text-search-create-encrypted-collection-with-str-encode-version/encrypted-payload.json +23 -0
  190. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-text-search-create-encrypted-collection-with-str-encode-version/mongocryptd-reply.json +62 -0
  191. data/ext/libmongocrypt/libmongocrypt/test/data/iev-v2/FLECrudTest-insertOneText.json +20 -0
  192. data/ext/libmongocrypt/libmongocrypt/test/data/iev-v2/FLECrudTest-insertOneTextLarge.json +930 -0
  193. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle/cmd-to-mongocryptd.json +60 -0
  194. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle/cmd.json +14 -0
  195. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle/collInfo-c1.json +39 -0
  196. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle/collInfo-c2.json +39 -0
  197. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle-facet/cmd.json +20 -0
  198. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle-mismatch/cmd.json +14 -0
  199. data/ext/libmongocrypt/libmongocrypt/{bindings/java/mongocrypt/src/test/resources/collection-info.json → test/data/lookup/csfle-mismatch/collInfo-c1.json} +13 -11
  200. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle-mismatch/collInfo-c3.json +39 -0
  201. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle-nested/cmd.json +24 -0
  202. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle-only-schemaMap/cmd-to-mongocryptd.json +60 -0
  203. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle-only-schemaMap/cmd.json +14 -0
  204. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle-only-schemaMap/schemaMap.json +40 -0
  205. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle-schemaMap/cmd-to-mongocryptd.json +60 -0
  206. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle-schemaMap/cmd.json +14 -0
  207. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle-schemaMap/collInfo-c1.json +39 -0
  208. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle-schemaMap/schemaMap.json +21 -0
  209. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle-self/cmd-to-mongocryptd.json +34 -0
  210. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle-self/cmd.json +14 -0
  211. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle-self/collInfo-c1.json +39 -0
  212. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle-sibling/cmd-to-mongocryptd.json +49 -0
  213. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle-sibling/cmd.json +14 -0
  214. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle-sibling/collInfo-c1.json +39 -0
  215. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle-sibling/collInfo-c2.json +29 -0
  216. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle-sibling/reply-from-mongocryptd.json +18 -0
  217. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle-unionWith/cmd.json +21 -0
  218. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle-view/cmd.json +14 -0
  219. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle-view/collInfo-c1.json +39 -0
  220. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/csfle-view/collInfo-v1.json +11 -0
  221. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/csfle/csfle/cmd-to-mongocryptd.json +65 -0
  222. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/csfle/csfle/cmd-to-mongod.json +26 -0
  223. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/csfle/csfle/cmd.json +19 -0
  224. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/csfle/csfle/collInfo-c1.json +39 -0
  225. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/csfle/csfle/collInfo-c2.json +39 -0
  226. data/ext/libmongocrypt/libmongocrypt/{bindings/java/mongocrypt/src/test/resources/keys/ABCDEFAB123498761234123456789012-local-document.json → test/data/lookup/mixed/csfle/csfle/key-doc.json} +4 -4
  227. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/csfle/csfle/reply-from-mongocryptd.json +33 -0
  228. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/csfle/no-schema/cmd-to-mongocryptd.json +47 -0
  229. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/csfle/no-schema/cmd-to-mongod.json +26 -0
  230. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/csfle/no-schema/cmd.json +19 -0
  231. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/csfle/no-schema/collInfo-c1.json +39 -0
  232. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/csfle/no-schema/collInfo-c2.json +17 -0
  233. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/csfle/no-schema/key-doc.json +30 -0
  234. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/csfle/no-schema/reply-from-mongocryptd.json +33 -0
  235. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/csfle/qe/cmd-to-mongocryptd.json +70 -0
  236. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/csfle/qe/cmd.json +19 -0
  237. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/csfle/qe/collInfo-c1.json +39 -0
  238. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/csfle/qe/collInfo-c2.json +42 -0
  239. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/no-schema/csfle/cmd-to-mongocryptd.json +47 -0
  240. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/no-schema/csfle/cmd-to-mongod.json +26 -0
  241. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/no-schema/csfle/cmd.json +19 -0
  242. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/no-schema/csfle/collInfo-c1.json +17 -0
  243. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/no-schema/csfle/collInfo-c2.json +39 -0
  244. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/no-schema/csfle/key-doc.json +30 -0
  245. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/no-schema/csfle/reply-from-mongocryptd.json +33 -0
  246. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/no-schema/no-schema/cmd-to-mongocryptd.json +29 -0
  247. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/no-schema/no-schema/cmd-to-mongod.json +19 -0
  248. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/no-schema/no-schema/cmd.json +19 -0
  249. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/no-schema/no-schema/collInfo-c1.json +17 -0
  250. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/no-schema/no-schema/collInfo-c2.json +17 -0
  251. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/no-schema/no-schema/reply-from-mongocryptd.json +26 -0
  252. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/no-schema/qe/cmd-to-mongocryptd.json +53 -0
  253. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/no-schema/qe/cmd-to-mongod.json +58 -0
  254. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/no-schema/qe/cmd.json +19 -0
  255. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/no-schema/qe/collInfo-c1.json +17 -0
  256. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/no-schema/qe/collInfo-c2.json +42 -0
  257. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/no-schema/qe/key-doc.json +30 -0
  258. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/no-schema/qe/reply-from-mongocryptd.json +65 -0
  259. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/qe/csfle/cmd-to-mongocryptd.json +70 -0
  260. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/qe/csfle/cmd.json +19 -0
  261. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/qe/csfle/collInfo-c1.json +42 -0
  262. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/qe/csfle/collInfo-c2.json +39 -0
  263. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/qe/no-schema/cmd-to-mongocryptd.json +53 -0
  264. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/qe/no-schema/cmd-to-mongod.json +56 -0
  265. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/qe/no-schema/cmd.json +19 -0
  266. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/qe/no-schema/collInfo-c1.json +42 -0
  267. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/qe/no-schema/collInfo-c2.json +17 -0
  268. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/qe/no-schema/key-doc.json +30 -0
  269. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/qe/no-schema/reply-from-mongocryptd.json +63 -0
  270. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/qe/qe/cmd-to-mongocryptd.json +66 -0
  271. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/qe/qe/cmd-to-mongod.json +71 -0
  272. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/qe/qe/cmd.json +19 -0
  273. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/qe/qe/collInfo-c1.json +42 -0
  274. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/qe/qe/collInfo-c2.json +42 -0
  275. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/qe/qe/key-doc.json +30 -0
  276. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/mixed/qe/qe/reply-from-mongocryptd.json +78 -0
  277. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe/cmd-to-mongocryptd.json +61 -0
  278. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe/cmd-to-mongod.json +14 -0
  279. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe/cmd.json +14 -0
  280. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe/collInfo-c1.json +42 -0
  281. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe/collInfo-c2.json +42 -0
  282. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe/reply-from-mongocryptd.json +68 -0
  283. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe-encryptedFieldsMap/cmd-to-mongocryptd.json +66 -0
  284. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe-encryptedFieldsMap/cmd-to-mongod.json +71 -0
  285. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe-encryptedFieldsMap/cmd.json +19 -0
  286. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe-encryptedFieldsMap/collInfo-c1.json +42 -0
  287. data/ext/libmongocrypt/libmongocrypt/test/data/{fle2-insert-unindexed/encrypted-field-map.json → lookup/qe-encryptedFieldsMap/encryptedFieldsMap.json} +6 -7
  288. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe-encryptedFieldsMap/key-doc.json +30 -0
  289. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe-encryptedFieldsMap/reply-from-mongocryptd.json +78 -0
  290. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe-self/cmd-to-mongocryptd.json +46 -0
  291. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe-self/cmd-to-mongod.json +53 -0
  292. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe-self/cmd.json +19 -0
  293. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe-self/collInfo-c1.json +42 -0
  294. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe-self/key-doc.json +30 -0
  295. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe-self/reply-from-mongocryptd.json +58 -0
  296. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe-with-payload/cmd-to-mongocryptd.json +66 -0
  297. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe-with-payload/cmd-to-mongod.json +75 -0
  298. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe-with-payload/cmd.json +19 -0
  299. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe-with-payload/collInfo-c1.json +42 -0
  300. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe-with-payload/collInfo-c2.json +42 -0
  301. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe-with-payload/key-doc.json +30 -0
  302. data/ext/libmongocrypt/libmongocrypt/test/data/lookup/qe-with-payload/reply-from-mongocryptd.json +78 -0
  303. data/ext/libmongocrypt/libmongocrypt/test/data/{fle2-create/mongocryptd-ismaster.json → mongocryptd-ismaster-17.json} +1 -1
  304. data/ext/libmongocrypt/libmongocrypt/test/data/mongocryptd-ismaster-26.json +12 -0
  305. data/ext/libmongocrypt/libmongocrypt/test/data/schema-broker/collinfo-encryptedFields.json +42 -0
  306. data/ext/libmongocrypt/libmongocrypt/test/data/schema-broker/collinfo-encryptedFields2.json +42 -0
  307. data/ext/libmongocrypt/libmongocrypt/test/data/schema-broker/collinfo-jsonSchema.json +43 -0
  308. data/ext/libmongocrypt/libmongocrypt/test/data/schema-broker/collinfo-noSchema.json +21 -0
  309. data/ext/libmongocrypt/libmongocrypt/test/data/schema-broker/create-with-jsonSchema.json +24 -0
  310. data/ext/libmongocrypt/libmongocrypt/test/data/schema-broker/encryptedFields.json +20 -0
  311. data/ext/libmongocrypt/libmongocrypt/test/data/schema-broker/encryptedFields2.json +20 -0
  312. data/ext/libmongocrypt/libmongocrypt/test/data/schema-broker/encryptedFieldsMap.json +42 -0
  313. data/ext/libmongocrypt/libmongocrypt/test/data/schema-broker/jsonSchema.json +19 -0
  314. data/ext/libmongocrypt/libmongocrypt/test/data/schema-broker/jsonSchema2.json +19 -0
  315. data/ext/libmongocrypt/libmongocrypt/test/data/schema-broker/schemaMap.json +40 -0
  316. data/ext/libmongocrypt/libmongocrypt/test/data/tokens/mc.json +28 -2
  317. data/ext/libmongocrypt/libmongocrypt/test/data/tokens/server.json +28 -2
  318. data/ext/libmongocrypt/libmongocrypt/test/test-mc-efc.c +70 -0
  319. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-encryption-placeholder.c +468 -0
  320. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-find-equality-payload-v2.c +20 -1
  321. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-iev-v2.c +286 -24
  322. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-iev.c +1 -1
  323. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-iup-v2.c +23 -1
  324. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-iup.c +24 -1
  325. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-uev.c +2 -2
  326. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-rfds.c +2 -2
  327. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-tag-and-encrypted-metadata-block.c +36 -1
  328. data/ext/libmongocrypt/libmongocrypt/test/test-mc-range-edge-generation.c +6 -7
  329. data/ext/libmongocrypt/libmongocrypt/test/test-mc-range-encoding.c +32 -33
  330. data/ext/libmongocrypt/libmongocrypt/test/test-mc-range-mincover.c +58 -66
  331. data/ext/libmongocrypt/libmongocrypt/test/test-mc-rangeopts.c +2 -2
  332. data/ext/libmongocrypt/libmongocrypt/test/test-mc-schema-broker.c +1124 -0
  333. data/ext/libmongocrypt/libmongocrypt/test/test-mc-text-search-str-encode.c +1207 -0
  334. data/ext/libmongocrypt/libmongocrypt/test/test-mc-tokens.c +144 -37
  335. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-assert-match-bson.c +13 -14
  336. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-assert.h +21 -4
  337. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-buffer.c +25 -0
  338. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-cache.c +3 -2
  339. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto-hooks.c +1 -1
  340. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto.c +37 -7
  341. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-csfle-lib.c +21 -0
  342. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-decrypt.c +226 -146
  343. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-encrypt.c +1330 -1200
  344. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-kek.c +1 -1
  345. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-key-cache.c +6 -6
  346. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-kms-responses.c +2 -2
  347. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-marking.c +744 -106
  348. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt.c +119 -33
  349. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt.h +27 -4
  350. data/ext/libmongocrypt/libmongocrypt/test/test-unicode-fold.c +97 -0
  351. data/lib/libmongocrypt_helper/version.rb +2 -2
  352. metadata +207 -157
  353. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/README.md +0 -36
  354. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/benchmarks/build.gradle.kts +0 -28
  355. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/benchmarks/src/main/java/com/mongodb/crypt/benchmark/BenchmarkRunner.java +0 -217
  356. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/benchmarks/src/main/resources/keyDocument.json +0 -24
  357. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/build.gradle.kts +0 -354
  358. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/gradle/wrapper/gradle-wrapper.jar +0 -0
  359. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/gradle/wrapper/gradle-wrapper.properties +0 -5
  360. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/gradlew +0 -234
  361. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/gradlew.bat +0 -89
  362. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/settings.gradle.kts +0 -1
  363. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/BinaryHolder.java +0 -45
  364. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/CAPI.java +0 -1165
  365. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/CAPIHelper.java +0 -96
  366. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/CipherCallback.java +0 -92
  367. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/DisposableMemory.java +0 -31
  368. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/JULLogger.java +0 -130
  369. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/Logger.java +0 -144
  370. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/Loggers.java +0 -50
  371. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MacCallback.java +0 -60
  372. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MessageDigestCallback.java +0 -55
  373. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoAwsKmsProviderOptions.java +0 -104
  374. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoCrypt.java +0 -100
  375. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoCryptContext.java +0 -137
  376. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoCryptContextImpl.java +0 -164
  377. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoCryptException.java +0 -67
  378. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoCryptImpl.java +0 -423
  379. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoCryptOptions.java +0 -284
  380. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoCrypts.java +0 -38
  381. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoDataKeyOptions.java +0 -125
  382. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoExplicitEncryptOptions.java +0 -227
  383. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoKeyDecryptor.java +0 -76
  384. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoKeyDecryptorImpl.java +0 -105
  385. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoLocalKmsProviderOptions.java +0 -83
  386. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoRewrapManyDataKeyOptions.java +0 -104
  387. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/SLF4JLogger.java +0 -110
  388. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/SecureRandomCallback.java +0 -51
  389. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/SigningRSAESPKCSCallback.java +0 -76
  390. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/package-info.java +0 -18
  391. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/resources/META-INF/native-image/jni-config.json +0 -180
  392. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/resources/META-INF/native-image/reflect-config.json +0 -134
  393. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/java/com/mongodb/crypt/capi/MongoCryptTest.java +0 -389
  394. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/command-reply.json +0 -13
  395. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/command.json +0 -6
  396. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/encrypted-command-reply.json +0 -16
  397. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/encrypted-command.json +0 -11
  398. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/encrypted-value.json +0 -6
  399. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/fle2-find-range-explicit-v2/int32/encrypted-payload.json +0 -26
  400. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/fle2-find-range-explicit-v2/int32/key-filter.json +0 -19
  401. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/fle2-find-range-explicit-v2/int32/rangeopts.json +0 -14
  402. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/fle2-find-range-explicit-v2/int32/value-to-encrypt.json +0 -20
  403. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/json-schema.json +0 -15
  404. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/key-document.json +0 -36
  405. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/key-filter-keyAltName.json +0 -14
  406. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/key-filter.json +0 -19
  407. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/kms-reply.txt +0 -6
  408. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/list-collections-filter.json +0 -3
  409. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/mongocryptd-command.json +0 -22
  410. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/mongocryptd-reply.json +0 -18
  411. data/ext/libmongocrypt/libmongocrypt/etc/silk-create-asset-group.sh +0 -70
  412. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/jsonSchema/cmd.json +0 -20
  413. data/ext/libmongocrypt/libmongocrypt/test/data/collection-info-no-schema.json +0 -19
  414. data/ext/libmongocrypt/libmongocrypt/test/data/compact/no-range/encrypted-field-config-map.json +0 -47
  415. data/ext/libmongocrypt/libmongocrypt/test/data/fle1-collMod/insert/cmd.json +0 -8
  416. data/ext/libmongocrypt/libmongocrypt/test/data/fle1-collMod/insert/collinfo.json +0 -9
  417. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-create/ismaster-to-mongocryptd.json +0 -3
  418. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-delete/empty/encrypted-payload.json +0 -91
  419. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-delete/success/encrypted-payload.json +0 -98
  420. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explicit/find-indexed-contentionFactor1.json +0 -8
  421. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explicit/insert-indexed-contentionFactor1.json +0 -8
  422. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explicit/insert-indexed-same-user-and-index-key.json +0 -8
  423. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-equality/cmd.json +0 -6
  424. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-equality/encrypted-payload.json +0 -41
  425. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-equality/mongocryptd-reply.json +0 -19
  426. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date/cmd.json +0 -10
  427. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date/encrypted-payload.json +0 -42
  428. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/date/mongocryptd-reply.json +0 -50
  429. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128/cmd.json +0 -6
  430. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128/encrypted-field-map.json +0 -28
  431. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128/encrypted-payload.json +0 -42
  432. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128/mongocryptd-reply.json +0 -50
  433. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision/cmd.json +0 -6
  434. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision/encrypted-field-map.json +0 -31
  435. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision/encrypted-payload.json +0 -51
  436. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/decimal128-precision/mongocryptd-reply.json +0 -59
  437. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double/cmd.json +0 -8
  438. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double/encrypted-payload.json +0 -42
  439. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double/mongocryptd-reply.json +0 -50
  440. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-precision/cmd.json +0 -8
  441. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-precision/encrypted-field-map.json +0 -31
  442. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-precision/encrypted-payload.json +0 -45
  443. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/double-precision/mongocryptd-reply.json +0 -53
  444. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int32/cmd.json +0 -8
  445. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int32/encrypted-payload.json +0 -42
  446. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int32/mongocryptd-reply.json +0 -50
  447. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64/cmd.json +0 -8
  448. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64/encrypted-field-map.json +0 -28
  449. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64/encrypted-payload.json +0 -42
  450. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range/int64/mongocryptd-reply.json +0 -50
  451. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/double/encrypted-payload.json +0 -26
  452. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/double-precision/encrypted-payload.json +0 -26
  453. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32/encrypted-payload.json +0 -26
  454. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32-nominmax/encrypted-payload-v2.json +0 -26
  455. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-find-range-explicit/int32-openinterval/encrypted-payload.json +0 -16
  456. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date/cmd.json +0 -13
  457. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date/encrypted-field-map.json +0 -28
  458. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date/encrypted-payload.json +0 -45
  459. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/date/mongocryptd-reply.json +0 -53
  460. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128/cmd.json +0 -9
  461. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128/encrypted-field-map.json +0 -28
  462. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128/encrypted-payload.json +0 -45
  463. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128/mongocryptd-reply.json +0 -53
  464. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision/cmd.json +0 -9
  465. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision/encrypted-field-map.json +0 -31
  466. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision/encrypted-payload.json +0 -54
  467. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/decimal128-precision/mongocryptd-reply.json +0 -62
  468. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double/cmd.json +0 -11
  469. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double/encrypted-field-map.json +0 -28
  470. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double/encrypted-payload.json +0 -45
  471. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double/mongocryptd-reply.json +0 -53
  472. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision/cmd.json +0 -11
  473. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision/encrypted-field-map.json +0 -31
  474. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision/encrypted-payload.json +0 -48
  475. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/double-precision/mongocryptd-reply.json +0 -56
  476. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32/encrypted-payload.json +0 -45
  477. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int32/mongocryptd-reply.json +0 -53
  478. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64/cmd.json +0 -11
  479. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64/encrypted-field-map.json +0 -28
  480. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64/encrypted-payload.json +0 -45
  481. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range/int64/mongocryptd-reply.json +0 -53
  482. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/double/encrypted-payload.json +0 -8
  483. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/double-precision/encrypted-payload.json +0 -8
  484. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/int32-nominmax/encrypted-payload-v2.json +0 -8
  485. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-range-explicit/sparsity-2/encrypted-payload.json +0 -8
  486. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-unindexed/cmd.json +0 -9
  487. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-unindexed/encrypted-payload.json +0 -14
  488. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-insert-unindexed/mongocryptd-reply.json +0 -46
  489. data/ext/libmongocrypt/libmongocrypt/test/data/schema.json +0 -19
  490. /data/ext/libmongocrypt/libmongocrypt/test/data/{fle2-explicit/find-indexed.json → explicit-decrypt/FLE2FindEqualityPayload.json} +0 -0
  491. /data/ext/libmongocrypt/libmongocrypt/test/data/{fle2-insert → fle2-insert-text-search-with-str-encode-version}/cmd.json +0 -0
@@ -1,1165 +0,0 @@
1
- /*
2
- * Copyright 2019-present MongoDB, Inc.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- *
16
- */
17
-
18
- package com.mongodb.crypt.capi;
19
-
20
- import com.sun.jna.Callback;
21
- import com.sun.jna.Memory;
22
- import com.sun.jna.Native;
23
- import com.sun.jna.Pointer;
24
- import com.sun.jna.PointerType;
25
- import com.sun.jna.ptr.PointerByReference;
26
-
27
- //CHECKSTYLE:OFF
28
-
29
- /**
30
- * For internal use only. Not part of the public API.
31
- */
32
- @SuppressWarnings("WeakerAccess")
33
- public class CAPI {
34
-
35
- public static class cstring extends PointerType {
36
- public cstring() {
37
- super();
38
- }
39
-
40
- public cstring(String string) {
41
- Pointer m = new Memory(string.length() + 1);
42
- m.setString(0, string);
43
- setPointer(m);
44
- }
45
-
46
- public String toString() {
47
- return getPointer().getString(0);
48
- }
49
- }
50
-
51
-
52
- /**
53
- * Indicates success or contains error information.
54
- * <p>
55
- * Functions like @ref mongocrypt_ctx_encrypt_init follow a pattern to expose a
56
- * status. A boolean is returned. True indicates success, and false indicates
57
- * failure. On failure a status on the handle is set, and is accessible with a
58
- * corresponding status function. E.g. @ref mongocrypt_ctx_status.
59
- */
60
- public static class mongocrypt_status_t extends PointerType {
61
- }
62
-
63
- /**
64
- * Contains all options passed on initialization of a @ref mongocrypt_ctx_t.
65
- */
66
- public static class mongocrypt_opts_t extends PointerType {
67
- }
68
-
69
- /**
70
- * A non-owning view of a byte buffer.
71
- * <p>
72
- * Functions returning a mongocrypt_binary_t* expect it to be destroyed with
73
- * mongocrypt_binary_destroy.
74
- */
75
- public static class mongocrypt_binary_t extends PointerType {
76
- // The `mongocrypt_binary_t` struct layout is part of libmongocrypt's ABI:
77
- // typedef struct _mongocrypt_binary_t {
78
- // void *data;
79
- // uint32_t len;
80
- // } mongocrypt_binary_t;
81
- // To improve performance, fields are read directly using `getPointer` and `getInt`.
82
- // This results in observed performance improvements over using of `mongocrypt_binary_data` and `mongocrypt_binary_len`. Refer: MONGOCRYPT-589.
83
- public mongocrypt_binary_t() {
84
- super();
85
- }
86
- public Pointer data() {
87
- return this.getPointer().getPointer(0);
88
- }
89
- public int len() {
90
- int len = this.getPointer().getInt(Native.POINTER_SIZE);
91
- // mongocrypt_binary_t represents length as an unsigned `uint32_t`.
92
- // Representing `uint32_t` values greater than INT32_MAX is represented as a negative `int`.
93
- // Throw an exception. mongocrypt_binary_t is not expected to use lengths greater than INT32_MAX.
94
- if (len < 0) {
95
- throw new AssertionError(
96
- String.format("Expected mongocrypt_binary_t length to be non-negative, got: %d", len));
97
- }
98
- return len;
99
-
100
- }
101
- }
102
-
103
- /**
104
- * The top-level handle to libmongocrypt.
105
- * <p>
106
- * Create a mongocrypt_t handle to perform operations within libmongocrypt:
107
- * encryption, decryption, registering log callbacks, etc.
108
- * <p>
109
- * Functions on a mongocrypt_t are thread safe, though functions on derived
110
- * handle (e.g. mongocrypt_encryptor_t) are not and must be owned by a single
111
- * thread. See each handle's documentation for thread-safety considerations.
112
- * <p>
113
- * Multiple mongocrypt_t handles may be created.
114
- */
115
- public static class mongocrypt_t extends PointerType {
116
- }
117
-
118
- /**
119
- * Manages the state machine for encryption or decryption.
120
- */
121
- public static class mongocrypt_ctx_t extends PointerType {
122
- }
123
-
124
- /**
125
- * Manages a single KMS HTTP request/response.
126
- */
127
- public static class mongocrypt_kms_ctx_t extends PointerType {
128
- }
129
-
130
- /**
131
- * Returns the version string x.y.z for libmongocrypt.
132
- *
133
- * @param len an optional length of the returned string. May be NULL.
134
- * @return the version string x.y.z for libmongocrypt.
135
- */
136
- public static native cstring
137
- mongocrypt_version(Pointer len);
138
-
139
-
140
- /**
141
- * Create a new non-owning view of a buffer (data + length).
142
- * <p>
143
- * Use this to create a mongocrypt_binary_t used for output parameters.
144
- *
145
- * @return A new mongocrypt_binary_t.
146
- */
147
- public static native mongocrypt_binary_t
148
- mongocrypt_binary_new();
149
-
150
-
151
- /**
152
- * Create a new non-owning view of a buffer (data + length).
153
- *
154
- * @param data A pointer to an array of bytes. This is not copied. data must outlive the binary object.
155
- * @param len The length of the @p data byte array.
156
- * @return A new mongocrypt_binary_t.
157
- */
158
- public static native mongocrypt_binary_t
159
- mongocrypt_binary_new_from_data(Pointer data, int len);
160
-
161
-
162
- /**
163
- * Get a pointer to the referenced data.
164
- *
165
- * @param binary The @ref mongocrypt_binary_t.
166
- * @return A pointer to the referenced data.
167
- */
168
- public static native Pointer
169
- mongocrypt_binary_data(mongocrypt_binary_t binary);
170
-
171
-
172
- /**
173
- * Get the length of the referenced data.
174
- *
175
- * @param binary The @ref mongocrypt_binary_t.
176
- * @return The length of the referenced data.
177
- */
178
- public static native int
179
- mongocrypt_binary_len(mongocrypt_binary_t binary);
180
-
181
-
182
- /**
183
- * Free the @ref mongocrypt_binary_t.
184
- * <p>
185
- * This does not free the referenced data. Refer to individual function
186
- * documentation to determine the lifetime guarantees of the underlying
187
- * data.
188
- *
189
- * @param binary The mongocrypt_binary_t destroy.
190
- */
191
- public static native void
192
- mongocrypt_binary_destroy(mongocrypt_binary_t binary);
193
-
194
-
195
- public static final int MONGOCRYPT_STATUS_OK = 0;
196
- public static final int MONGOCRYPT_STATUS_ERROR_CLIENT = 1;
197
- public static final int MONGOCRYPT_STATUS_ERROR_KMS = 2;
198
-
199
- /**
200
- * Create a new status object.
201
- * <p>
202
- * Use a new status object to retrieve the status from a handle by passing
203
- * this as an out-parameter to functions like @ref mongocrypt_ctx_status.
204
- * When done, destroy it with @ref mongocrypt_status_destroy.
205
- *
206
- * @return A new status object.
207
- */
208
- public static native mongocrypt_status_t
209
- mongocrypt_status_new();
210
-
211
- /**
212
- * Set a status object with message, type, and code.
213
- * <p>
214
- * Use this to set the mongocrypt_status_t given in the crypto hooks.
215
- *
216
- * @param status The status.
217
- * @param type The status type.
218
- * @param code The status code.
219
- * @param message The message.
220
- * @param message_len The length of @p message. Pass -1 to determine the * string length with strlen (must * be NULL terminated).
221
- */
222
- public static native void
223
- mongocrypt_status_set(mongocrypt_status_t status,
224
- int type,
225
- int code,
226
- cstring message,
227
- int message_len);
228
-
229
- /**
230
- * Indicates success or the type of error.
231
- *
232
- * @param status The status object.
233
- * @return A @ref mongocrypt_status_type_t.
234
- */
235
-
236
- public static native int
237
- mongocrypt_status_type(mongocrypt_status_t status);
238
-
239
-
240
- /**
241
- * Get an error code or 0.
242
- *
243
- * @param status The status object.
244
- * @return An error code.
245
- */
246
- public static native int
247
- mongocrypt_status_code(mongocrypt_status_t status);
248
-
249
-
250
- /**
251
- * Get the error message associated with a status, or an empty string.
252
- *
253
- * @param status The status object.
254
- * @param len an optional length of the returned string. May be NULL.
255
- * @return An error message or an empty string.
256
- */
257
- public static native cstring
258
- mongocrypt_status_message(mongocrypt_status_t status, Pointer len);
259
-
260
-
261
- /**
262
- * Returns true if the status indicates success.
263
- *
264
- * @param status The status to check.
265
- * @return A boolean indicating success.
266
- */
267
- public static native boolean
268
- mongocrypt_status_ok(mongocrypt_status_t status);
269
-
270
-
271
- /**
272
- * Free the memory for a status object.
273
- *
274
- * @param status The status to destroy.
275
- */
276
- public static native void
277
- mongocrypt_status_destroy(mongocrypt_status_t status);
278
-
279
-
280
- public static final int MONGOCRYPT_LOG_LEVEL_FATAL = 0;
281
- public static final int MONGOCRYPT_LOG_LEVEL_ERROR = 1;
282
- public static final int MONGOCRYPT_LOG_LEVEL_WARNING = 2;
283
- public static final int MONGOCRYPT_LOG_LEVEL_INFO = 3;
284
- public static final int MONGOCRYPT_LOG_LEVEL_TRACE = 4;
285
-
286
-
287
- /**
288
- * A log callback function. Set a custom log callback with mongocrypt_setopt_log_handler.
289
- */
290
- public interface mongocrypt_log_fn_t extends Callback {
291
- void log(int level, cstring message, int message_len, Pointer ctx);
292
- }
293
-
294
- public interface mongocrypt_crypto_fn extends Callback {
295
- boolean crypt(Pointer ctx, mongocrypt_binary_t key, mongocrypt_binary_t iv, mongocrypt_binary_t in,
296
- mongocrypt_binary_t out, Pointer bytesWritten, mongocrypt_status_t status);
297
- }
298
-
299
- public interface mongocrypt_hmac_fn extends Callback {
300
- boolean hmac(Pointer ctx, mongocrypt_binary_t key, mongocrypt_binary_t in, mongocrypt_binary_t out,
301
- mongocrypt_status_t status);
302
- }
303
-
304
- public interface mongocrypt_hash_fn extends Callback {
305
- boolean hash(Pointer ctx, mongocrypt_binary_t in, mongocrypt_binary_t out, mongocrypt_status_t status);
306
- }
307
-
308
- public interface mongocrypt_random_fn extends Callback {
309
- boolean random(Pointer ctx, mongocrypt_binary_t out, int count, mongocrypt_status_t status);
310
- }
311
-
312
- /**
313
- * Allocate a new @ref mongocrypt_t object.
314
- * <p>
315
- * Initialize with @ref mongocrypt_init. When done, free with @ref
316
- * mongocrypt_destroy.
317
- *
318
- * @return A new @ref mongocrypt_t object.
319
- */
320
- public static native mongocrypt_t
321
- mongocrypt_new();
322
-
323
- /**
324
- * Set a handler to get called on every log message.
325
- *
326
- * @param crypt The @ref mongocrypt_t object.
327
- * @param log_fn The log callback.
328
- * @param log_ctx A context passed as an argument to the log callback every
329
- * invokation.
330
- * @return A boolean indicating success.
331
- */
332
- public static native boolean
333
- mongocrypt_setopt_log_handler(mongocrypt_t crypt,
334
- mongocrypt_log_fn_t log_fn,
335
- Pointer log_ctx);
336
-
337
-
338
- public static native boolean
339
- mongocrypt_setopt_crypto_hooks(mongocrypt_t crypt,
340
- mongocrypt_crypto_fn aes_256_cbc_encrypt,
341
- mongocrypt_crypto_fn aes_256_cbc_decrypt,
342
- mongocrypt_random_fn random,
343
- mongocrypt_hmac_fn hmac_sha_512,
344
- mongocrypt_hmac_fn hmac_sha_256,
345
- mongocrypt_hash_fn sha_256,
346
- Pointer ctx);
347
-
348
- /**
349
- * Set a crypto hook for the AES256-CTR operations.
350
- *
351
- * @param crypt The @ref mongocrypt_t object.
352
- * @param aes_256_ctr_encrypt The crypto callback function for encrypt
353
- * operation.
354
- * @param aes_256_ctr_decrypt The crypto callback function for decrypt
355
- * operation.
356
- * @param ctx A context passed as an argument to the crypto callback
357
- * every invocation.
358
- * @return A boolean indicating success. If false, an error status is set.
359
- * Retrieve it with @ref mongocrypt_status
360
- *
361
- */
362
- public static native boolean
363
- mongocrypt_setopt_aes_256_ctr (mongocrypt_t crypt,
364
- mongocrypt_crypto_fn aes_256_ctr_encrypt,
365
- mongocrypt_crypto_fn aes_256_ctr_decrypt,
366
- Pointer ctx);
367
-
368
- /**
369
- * Set a crypto hook for the RSASSA-PKCS1-v1_5 algorithm with a SHA-256 hash.
370
- *
371
- * <p>See: https://tools.ietf.org/html/rfc3447#section-8.2</p>
372
- *
373
- * <p>Note: this function has the wrong name. It should be:
374
- * mongocrypt_setopt_crypto_hook_sign_rsassa_pkcs1_v1_5</p>
375
- *
376
- * @param crypt The @ref mongocrypt_t object.
377
- * @param sign_rsaes_pkcs1_v1_5 The crypto callback function.
378
- * @param sign_ctx A context passed as an argument to the crypto callback
379
- * every invocation.
380
- * @return A boolean indicating success. If false, an error status is set.
381
- * Retrieve it with @ref mongocrypt_status
382
- */
383
- public static native boolean
384
- mongocrypt_setopt_crypto_hook_sign_rsaes_pkcs1_v1_5(
385
- mongocrypt_t crypt,
386
- mongocrypt_hmac_fn sign_rsaes_pkcs1_v1_5,
387
- Pointer sign_ctx);
388
-
389
- /**
390
- * Set a handler to get called on every log message.
391
- *
392
- * @param crypt The @ref mongocrypt_t object.
393
- * @param aws_access_key_id The AWS access key ID used to generate KMS
394
- * messages.
395
- * @param aws_access_key_id_len The string length (in bytes) of @p
396
- * * aws_access_key_id. Pass -1 to determine the string length with strlen (must
397
- * * be NULL terminated).
398
- * @param aws_secret_access_key The AWS secret access key used to generate
399
- * KMS messages.
400
- * @param aws_secret_access_key_len The string length (in bytes) of @p
401
- * aws_secret_access_key. Pass -1 to determine the string length with strlen
402
- * (must be NULL terminated).
403
- * @return A boolean indicating success.
404
- */
405
- public static native boolean
406
- mongocrypt_setopt_kms_provider_aws(mongocrypt_t crypt,
407
- cstring aws_access_key_id,
408
- int aws_access_key_id_len,
409
- cstring aws_secret_access_key,
410
- int aws_secret_access_key_len);
411
-
412
- /**
413
- * Configure a local KMS provider on the @ref mongocrypt_t object.
414
- *
415
- * @param crypt The @ref mongocrypt_t object.
416
- * @param key A 64 byte master key used to encrypt and decrypt key vault keys.
417
- * @return A boolean indicating success.
418
- */
419
- public static native boolean
420
- mongocrypt_setopt_kms_provider_local(mongocrypt_t crypt,
421
- mongocrypt_binary_t key);
422
-
423
- /**
424
- * Configure KMS providers with a BSON document.
425
- *
426
- * @param crypt The @ref mongocrypt_t object.
427
- * @param kms_providers A BSON document mapping the KMS provider names to credentials.
428
- * @return A boolean indicating success. If false, an error status is set.
429
- * @since 1.1
430
- */
431
- public static native boolean
432
- mongocrypt_setopt_kms_providers(mongocrypt_t crypt,
433
- mongocrypt_binary_t kms_providers);
434
-
435
- /**
436
- * Set a local schema map for encryption.
437
- *
438
- * @param crypt The @ref mongocrypt_t object.
439
- * @param schema_map A BSON document representing the schema map supplied by
440
- * the user. The keys are collection namespaces and values are JSON schemas.
441
- * @return A boolean indicating success. If false, an error status is set.
442
- * Retrieve it with @ref mongocrypt_status
443
- */
444
- public static native boolean
445
- mongocrypt_setopt_schema_map (mongocrypt_t crypt, mongocrypt_binary_t schema_map);
446
-
447
- /**
448
- * Opt-into setting KMS providers before each KMS request.
449
- *
450
- * If set, before entering the MONGOCRYPT_CTX_NEED_KMS state,
451
- * contexts will enter the MONGOCRYPT_CTX_NEED_KMS_CREDENTIALS state
452
- * and then wait for credentials to be supplied through @ref mongocrypt_ctx_provide_kms_providers.
453
- *
454
- * @param crypt The @ref mongocrypt_t object to update
455
- */
456
- public static native void
457
- mongocrypt_setopt_use_need_kms_credentials_state (mongocrypt_t crypt);
458
-
459
-
460
- /**
461
- * Set a local EncryptedFieldConfigMap for encryption.
462
- *
463
- * @param crypt The @ref mongocrypt_t object.
464
- * @param encryptedFieldConfigMap A BSON document representing the EncryptedFieldConfigMap
465
- * supplied by the user. The keys are collection namespaces and values are
466
- * EncryptedFieldConfigMap documents. The viewed data copied. It is valid to
467
- * destroy @p efc_map with @ref mongocrypt_binary_destroy immediately after.
468
- * @return A boolean indicating success. If false, an error status is set.
469
- * Retrieve it with @ref mongocrypt_status
470
- */
471
- public static native boolean
472
- mongocrypt_setopt_encrypted_field_config_map (mongocrypt_t crypt, mongocrypt_binary_t encryptedFieldConfigMap);
473
-
474
- /**
475
- * Opt-into skipping query analysis.
476
- *
477
- * <p>If opted in:
478
- * <ul>
479
- * <li>The crypt_shared shared library will not attempt to be loaded.</li>
480
- * <li>A mongocrypt_ctx_t will never enter the MONGOCRYPT_CTX_NEED_MARKINGS state.</li>
481
- * </ul>
482
- *
483
- * @param crypt The @ref mongocrypt_t object to update
484
- * @since 1.5
485
- */
486
- public static native void
487
- mongocrypt_setopt_bypass_query_analysis (mongocrypt_t crypt);
488
-
489
- /**
490
- * Set the contention factor used for explicit encryption.
491
- * The contention factor is only used for indexed Queryable Encryption.
492
- *
493
- * @param ctx The @ref mongocrypt_ctx_t object.
494
- * @param contention_factor the contention factor
495
- * @return A boolean indicating success. If false, an error status is set.
496
- * Retrieve it with @ref mongocrypt_ctx_status.
497
- * @since 1.5
498
- */
499
- public static native boolean
500
- mongocrypt_ctx_setopt_contention_factor (mongocrypt_ctx_t ctx, long contention_factor);
501
-
502
- /**
503
- * Set the index key id to use for Queryable Encryption explicit encryption.
504
- *
505
- * If the index key id not set, the key id from @ref mongocrypt_ctx_setopt_key_id is used.
506
- *
507
- * @param ctx The @ref mongocrypt_ctx_t object.
508
- * @param key_id The binary corresponding to the _id (a UUID) of the data key to use from
509
- * the key vault collection. Note, the UUID must be encoded with RFC-4122 byte order.
510
- * The viewed data is copied. It is valid to destroy key_id with @ref mongocrypt_binary_destroy immediately after.
511
- * @return A boolean indicating success. If false, an error status is set.
512
- * Retrieve it with @ref mongocrypt_ctx_status
513
- * @since 1.5
514
- */
515
- public static native boolean
516
- mongocrypt_ctx_setopt_index_key_id (mongocrypt_ctx_t ctx, mongocrypt_binary_t key_id);
517
-
518
- /**
519
- * Append an additional search directory to the search path for loading
520
- * the crypt_shared dynamic library.
521
- *
522
- * @param crypt The @ref mongocrypt_t object to update
523
- * @param path A null-terminated sequence of bytes for the search path. On
524
- * some filesystems, this may be arbitrary bytes. On other filesystems, this may
525
- * be required to be a valid UTF-8 code unit sequence. If the leading element of
526
- * the path is the literal string "$ORIGIN", that substring will be replaced
527
- * with the directory path containing the executable libmongocrypt module. If
528
- * the path string is literal "$SYSTEM", then libmongocrypt will defer to the
529
- * system's library resolution mechanism to find the crypt_shared library.
530
- *
531
- * <p>If no crypt_shared dynamic library is found in any of the directories
532
- * specified by the search paths loaded here, @ref mongocrypt_init() will still
533
- * succeed and continue to operate without crypt_shared.</p>
534
- *
535
- * <p>The search paths are searched in the order that they are appended. This
536
- * allows one to provide a precedence in how the library will be discovered. For
537
- * example, appending known directories before appending "$SYSTEM" will allow
538
- * one to supersede the system's installed library, but still fall-back to it if
539
- * the library wasn't found otherwise. If one does not ever append "$SYSTEM",
540
- * then the system's library-search mechanism will never be consulted.</p>
541
- *
542
- * <p>If an absolute path to the library is specified using @ref mongocrypt_setopt_set_crypt_shared_lib_path_override,
543
- * then paths appended here will have no effect.</p>
544
- * @since 1.5
545
- */
546
- public static native void
547
- mongocrypt_setopt_append_crypt_shared_lib_search_path (mongocrypt_t crypt, cstring path);
548
-
549
- /**
550
- * Set a single override path for loading the crypt_shared dynamic library.
551
- * @param crypt The @ref mongocrypt_t object to update
552
- * @param path A null-terminated sequence of bytes for a path to the crypt_shared
553
- * dynamic library. On some filesystems, this may be arbitrary bytes. On other
554
- * filesystems, this may be required to be a valid UTF-8 code unit sequence. If
555
- * the leading element of the path is the literal string `$ORIGIN`, that
556
- * substring will be replaced with the directory path containing the executable
557
- * libmongocrypt module.
558
- *
559
- * <p>This function will do no IO nor path validation. All validation will
560
- * occur during the call to @ref mongocrypt_init.</p>
561
- * <p>If a crypt_shared library path override is specified here, then no paths given
562
- * to @ref mongocrypt_setopt_append_crypt_shared_lib_search_path will be consulted when
563
- * opening the crypt_shared library.</p>
564
- * <p>If a path is provided via this API and @ref mongocrypt_init fails to
565
- * initialize a valid crypt_shared library instance for the path specified, then
566
- * the initialization of mongocrypt_t will fail with an error.</p>
567
- * @since 1.5
568
- */
569
- public static native void
570
- mongocrypt_setopt_set_crypt_shared_lib_path_override(mongocrypt_t crypt, cstring path);
571
-
572
- /**
573
- * Set the query type to use for Queryable Encryption explicit encryption.
574
- * The query type is only used for indexed Queryable Encryption.
575
- *
576
- * @param ctx The @ref mongocrypt_ctx_t object.
577
- * @param query_type the query type
578
- * @param len the length
579
- * @return A boolean indicating success. If false, an error status is set.
580
- * Retrieve it with @ref mongocrypt_ctx_status
581
- */
582
- public static native boolean
583
- mongocrypt_ctx_setopt_query_type (mongocrypt_ctx_t ctx, cstring query_type, int len);
584
-
585
- /**
586
- * Set options for explicit encryption with the "range" algorithm.
587
- * NOTE: "range" is currently unstable API and subject to backwards breaking changes.
588
- *
589
- * opts is a BSON document of the form:
590
- * {
591
- * "min": Optional&#60;BSON value&#62;,
592
- * "max": Optional&#60;BSON value&#62;,
593
- * "sparsity": Int64,
594
- * "precision": Optional&#60;Int32&#62;
595
- * "trimFactor": Optional&#60;Int32&#62;
596
- * }
597
- *
598
- * @param ctx The @ref mongocrypt_ctx_t object.
599
- * @param opts BSON.
600
- * @return A boolean indicating success. If false, an error status is set.
601
- * @since 1.7
602
- */
603
- public static native boolean
604
- mongocrypt_ctx_setopt_algorithm_range (mongocrypt_ctx_t ctx, mongocrypt_binary_t opts);
605
-
606
- /**
607
- * Initialize new @ref mongocrypt_t object.
608
- *
609
- * @param crypt The @ref mongocrypt_t object.
610
- * @return A boolean indicating success. Failure may occur if previously set options are invalid.
611
- */
612
- public static native boolean
613
- mongocrypt_init(mongocrypt_t crypt);
614
-
615
-
616
- /**
617
- * Get the status associated with a @ref mongocrypt_t object.
618
- *
619
- * @param crypt The @ref mongocrypt_t object.
620
- * @param status Receives the status.
621
- * @return A boolean indicating success.
622
- */
623
- public static native boolean
624
- mongocrypt_status(mongocrypt_t crypt, mongocrypt_status_t status);
625
-
626
- /**
627
- * Returns true if libmongocrypt was built with native crypto support.
628
- *
629
- * <p>
630
- * If libmongocrypt was not built with native crypto support, setting crypto hooks is required.
631
- * </p>
632
- *
633
- * @return true if libmongocrypt was built with native crypto support
634
- */
635
- public static native boolean
636
- mongocrypt_is_crypto_available();
637
-
638
- /**
639
- * Destroy the @ref mongocrypt_t object.
640
- *
641
- * @param crypt The @ref mongocrypt_t object to destroy.
642
- */
643
- public static native void
644
- mongocrypt_destroy(mongocrypt_t crypt);
645
-
646
- /**
647
- * Obtain a nul-terminated version string of the loaded crypt_shared dynamic library,
648
- * if available.
649
- *
650
- * If no crypt_shared was successfully loaded, this function returns NULL.
651
- *
652
- * @param crypt The mongocrypt_t object after a successful call to mongocrypt_init.
653
- * @param len an optional length of the returned string. May be NULL.
654
- *
655
- * @return A nul-terminated string of the dynamically loaded crypt_shared library.
656
- * @since 1.5
657
- */
658
- public static native cstring
659
- mongocrypt_crypt_shared_lib_version_string (mongocrypt_t crypt, Pointer len);
660
-
661
- /**
662
- * Call in response to the MONGOCRYPT_CTX_NEED_KMS_CREDENTIALS state
663
- * to set per-context KMS provider settings. These follow the same format
664
- * as @ref mongocrypt_setopt_kms_providers. If no keys are present in the
665
- * BSON input, the KMS provider settings configured for the @ref mongocrypt_t
666
- * at initialization are used.
667
- *
668
- * @param ctx The @ref mongocrypt_ctx_t object.
669
- * @param kms_providers A BSON document mapping the KMS provider names
670
- * to credentials.
671
- * @return A boolean indicating success. If false, an error status is set.
672
- * Retrieve it with @ref mongocrypt_ctx_status.
673
- */
674
- public static native boolean
675
- mongocrypt_ctx_provide_kms_providers (mongocrypt_ctx_t ctx,
676
- mongocrypt_binary_t kms_providers);
677
-
678
- /**
679
- * Set the key id to use for explicit encryption.
680
- *
681
- * @param ctx The @ref mongocrypt_ctx_t object.
682
- * @param key_id The key_id to use.
683
- * @return A boolean indicating success.
684
- */
685
- public static native boolean
686
- mongocrypt_ctx_setopt_key_id (mongocrypt_ctx_t ctx,
687
- mongocrypt_binary_t key_id);
688
-
689
- /**
690
- * Set the keyAltName to use for explicit encryption.
691
- * keyAltName should be a binary encoding a bson document
692
- * with the following format: <code>{ "keyAltName" : &gt;BSON UTF8 value&lt; }</code>
693
- *
694
- * <p>It is an error to set both this and the key id.</p>
695
- *
696
- * @param ctx The @ref mongocrypt_ctx_t object.
697
- * @param key_alt_name The name to use.
698
- * @return A boolean indicating success. If false, an error status is set.
699
- * Retrieve it with @ref mongocrypt_ctx_status
700
- */
701
- public static native boolean
702
- mongocrypt_ctx_setopt_key_alt_name (mongocrypt_ctx_t ctx,
703
- mongocrypt_binary_t key_alt_name);
704
-
705
- /**
706
- * Set the keyMaterial to use for encrypting data.
707
- *
708
- * <p>
709
- * Pass the binary encoding of a BSON document like the following:
710
- * <code>{ "keyMaterial" : (BSON BINARY value) }</code>
711
- * </p>
712
- *
713
- * @param ctx The @ref mongocrypt_ctx_t object.
714
- * @param key_material The data encryption key to use. The viewed data is
715
- * copied. It is valid to destroy @p key_material with @ref
716
- * mongocrypt_binary_destroy immediately after.
717
- * @return A boolean indicating success. If false, an error status is set.
718
- * Retrieve it with @ref mongocrypt_ctx_status
719
- */
720
- public static native boolean
721
- mongocrypt_ctx_setopt_key_material (mongocrypt_ctx_t ctx, mongocrypt_binary_t key_material);
722
-
723
- /**
724
- * Set the algorithm used for encryption to either
725
- * deterministic or random encryption. This value
726
- * should only be set when using explicit encryption.
727
- *
728
- * If -1 is passed in for "len", then "algorithm" is
729
- * assumed to be a null-terminated string.
730
- *
731
- * Valid values for algorithm are:
732
- * "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic"
733
- * "AEAD_AES_256_CBC_HMAC_SHA_512-Randomized"
734
- *
735
- * @param ctx The @ref mongocrypt_ctx_t object.
736
- * @param algorithm A string specifying the algorithm to
737
- * use for encryption.
738
- * @param len The length of the algorithm string.
739
- * @return A boolean indicating success.
740
- */
741
- public static native boolean
742
- mongocrypt_ctx_setopt_algorithm (mongocrypt_ctx_t ctx,
743
- cstring algorithm,
744
- int len);
745
-
746
-
747
- /**
748
- * Create a new uninitialized @ref mongocrypt_ctx_t.
749
- * <p>
750
- * Initialize the context with functions like @ref mongocrypt_ctx_encrypt_init.
751
- * When done, destroy it with @ref mongocrypt_ctx_destroy.
752
- *
753
- * @param crypt The @ref mongocrypt_t object.
754
- * @return A new context.
755
- */
756
- public static native mongocrypt_ctx_t
757
- mongocrypt_ctx_new(mongocrypt_t crypt);
758
-
759
-
760
- /**
761
- * Get the status associated with a @ref mongocrypt_ctx_t object.
762
- *
763
- * @param ctx The @ref mongocrypt_ctx_t object.
764
- * @param status Receives the status.
765
- * @return A boolean indicating success.
766
- */
767
-
768
- public static native boolean
769
- mongocrypt_ctx_status(mongocrypt_ctx_t ctx, mongocrypt_status_t status);
770
-
771
-
772
- /**
773
- * Identify the AWS KMS master key to use for creating a data key.
774
- *
775
- * @param ctx The @ref mongocrypt_ctx_t object.
776
- * @param region The AWS region.
777
- * @param region_len The string length of @p region. Pass -1 to determine
778
- * the string length with strlen (must be NULL terminated).
779
- * @param cmk The Amazon Resource Name (ARN) of the customer master key
780
- * (CMK).
781
- * @param cmk_len The string length of @p cmk_len. Pass -1 to determine the
782
- * string length with strlen (must be NULL terminated).
783
- * @return A boolean indicating success.
784
- */
785
- public static native boolean
786
- mongocrypt_ctx_setopt_masterkey_aws (mongocrypt_ctx_t ctx,
787
- cstring region,
788
- int region_len,
789
- cstring cmk,
790
- int cmk_len);
791
-
792
- /**
793
- * Identify a custom AWS endpoint when creating a data key.
794
- * This is used internally to construct the correct HTTP request
795
- * (with the Host header set to this endpoint). This endpoint
796
- * is persisted in the new data key, and will be returned via
797
- * mongocrypt_kms_ctx_endpoint.
798
- *
799
- * @param ctx The @ref mongocrypt_ctx_t object.
800
- * @param endpoint The endpoint.
801
- * @param endpoint_len The string length of @p endpoint. Pass -1 to
802
- * determine the string length with strlen (must be NULL terminated).
803
- * @return A boolean indicating success. If false, an error status is set.
804
- * Retrieve it with @ref mongocrypt_ctx_status
805
- */
806
- public static native boolean
807
- mongocrypt_ctx_setopt_masterkey_aws_endpoint (mongocrypt_ctx_t ctx,
808
- cstring endpoint,
809
- int endpoint_len);
810
-
811
-
812
- /**
813
- * Set the master key to "local" for creating a data key.
814
- *
815
- * @param ctx The @ref mongocrypt_ctx_t object.
816
- * @return A boolean indicating success.
817
- */
818
- public static native boolean
819
- mongocrypt_ctx_setopt_masterkey_local (mongocrypt_ctx_t ctx);
820
-
821
- /**
822
- * Set key encryption key document for creating a data key.
823
- *
824
- * @param ctx The @ref mongocrypt_ctx_t object.
825
- * @param keyDocument BSON representing the key encryption key document.
826
- * @return A boolean indicating success. If false, and error status is set.
827
- * @since 1.1
828
- */
829
- public static native boolean
830
- mongocrypt_ctx_setopt_key_encryption_key(mongocrypt_ctx_t ctx,
831
- mongocrypt_binary_t keyDocument);
832
-
833
- /**
834
- * Initialize a context to create a data key.
835
- *
836
- * Set options before using @ref mongocrypt_ctx_setopt_masterkey_aws and
837
- * mongocrypt_ctx_setopt_masterkey_local.
838
- *
839
- * @param ctx The @ref mongocrypt_ctx_t object.
840
- * @return A boolean indicating success.
841
- *
842
- * Assumes a master key option has been set, and an associated KMS provider
843
- * has been set on the parent @ref mongocrypt_t.
844
- */
845
- public static native boolean
846
- mongocrypt_ctx_datakey_init (mongocrypt_ctx_t ctx);
847
-
848
- /**
849
- * Initialize a context for encryption.
850
- *
851
- * Associated options:
852
- * - @ref mongocrypt_ctx_setopt_cache_noblock
853
- * - @ref mongocrypt_ctx_setopt_schema
854
- *
855
- * @param ctx The @ref mongocrypt_ctx_t object.
856
- * @param db The database name.
857
- * @param db_len The byte length of @p db. Pass -1 to determine the string length with strlen (must be NULL terminated).
858
- * @param cmd The BSON command to be encrypted.
859
- * @return A boolean indicating success. If false, an error status is set.
860
- * Retrieve it with @ref mongocrypt_ctx_status
861
- */
862
- public static native boolean
863
- mongocrypt_ctx_encrypt_init(mongocrypt_ctx_t ctx,
864
- cstring db,
865
- int db_len,
866
- mongocrypt_binary_t cmd);
867
-
868
- /**
869
- * Explicit helper method to encrypt a single BSON object. Contexts
870
- * created for explicit encryption will not go through mongocryptd.
871
- *
872
- * To specify a key_id, algorithm, or iv to use, please use the
873
- * corresponding mongocrypt_setopt methods before calling this.
874
- *
875
- * This method expects the passed-in BSON to be of the form:
876
- * { "v" : BSON value to encrypt }
877
- *
878
- * @param ctx A @ref mongocrypt_ctx_t.
879
- * @param msg A @ref mongocrypt_binary_t the plaintext BSON value.
880
- * @return A boolean indicating success.
881
- */
882
- public static native boolean
883
- mongocrypt_ctx_explicit_encrypt_init (mongocrypt_ctx_t ctx,
884
- mongocrypt_binary_t msg);
885
-
886
- /**
887
- * Explicit helper method to encrypt a Match Expression or Aggregate Expression.
888
- * Contexts created for explicit encryption will not go through mongocryptd.
889
- * Requires query_type to be "range".
890
- * NOTE: "range" is currently unstable API and subject to backwards breaking changes.
891
- *
892
- * This method expects the passed-in BSON to be of the form:
893
- * { "v" : FLE2RangeFindDriverSpec }
894
- *
895
- * FLE2RangeFindDriverSpec is a BSON document with one of these forms:
896
- *
897
- * 1. A Match Expression of this form:
898
- * {$and: [{&#60;field&#62;: {&#60;op&#62;: &#60;value1&#62;, {&#60;field&#62;: {&#60;op&#62;: &#60;value2&#62; }}]}
899
- * 2. An Aggregate Expression of this form:
900
- * {$and: [{&#60;op&#62;: [&#60;fieldpath&#62;, &#60;value1&#62;]}, {&#60;op&#62;: [&#60;fieldpath&#62;, &#60;value2&#62;]}]
901
- *
902
- * may be $lt, $lte, $gt, or $gte.
903
- *
904
- * The value of "v" is expected to be the BSON value passed to a driver
905
- * ClientEncryption.encryptExpression helper.
906
- *
907
- * Associated options for FLE 1:
908
- * - @ref mongocrypt_ctx_setopt_key_id
909
- * - @ref mongocrypt_ctx_setopt_key_alt_name
910
- * - @ref mongocrypt_ctx_setopt_algorithm
911
- *
912
- * Associated options for Queryable Encryption:
913
- * - @ref mongocrypt_ctx_setopt_key_id
914
- * - @ref mongocrypt_ctx_setopt_index_key_id
915
- * - @ref mongocrypt_ctx_setopt_contention_factor
916
- * - @ref mongocrypt_ctx_setopt_query_type
917
- * - @ref mongocrypt_ctx_setopt_algorithm_range
918
- *
919
- * An error is returned if FLE 1 and Queryable Encryption incompatible options
920
- * are set.
921
- *
922
- * @param ctx A @ref mongocrypt_ctx_t.
923
- * @param msg A @ref mongocrypt_binary_t the plaintext BSON value.
924
- * @return A boolean indicating success.
925
- * @since 1.7
926
- */
927
- public static native boolean
928
- mongocrypt_ctx_explicit_encrypt_expression_init (mongocrypt_ctx_t ctx,
929
- mongocrypt_binary_t msg);
930
-
931
- /**
932
- * Initialize a context for decryption.
933
- *
934
- * @param ctx The mongocrypt_ctx_t object.
935
- * @param doc The document to be decrypted.
936
- * @return A boolean indicating success.
937
- */
938
- public static native boolean
939
- mongocrypt_ctx_decrypt_init(mongocrypt_ctx_t ctx, mongocrypt_binary_t doc);
940
-
941
-
942
- /**
943
- * Explicit helper method to decrypt a single BSON object.
944
- *
945
- * @param ctx A @ref mongocrypt_ctx_t.
946
- * @param msg A @ref mongocrypt_binary_t the encrypted BSON.
947
- * @return A boolean indicating success.
948
- */
949
- public static native boolean
950
- mongocrypt_ctx_explicit_decrypt_init (mongocrypt_ctx_t ctx,
951
- mongocrypt_binary_t msg);
952
-
953
- /**
954
- * Initialize a context to rewrap datakeys.
955
- *
956
- * Associated options {@link #mongocrypt_ctx_setopt_key_encryption_key(mongocrypt_ctx_t, mongocrypt_binary_t)}
957
- *
958
- * @param ctx The @ref mongocrypt_ctx_t object.
959
- * @param filter The filter to use for the find command on the key vault collection to retrieve datakeys to rewrap.
960
- * @return A boolean indicating success. If false, and error status is set.
961
- * @since 1.5
962
- */
963
- public static native boolean
964
- mongocrypt_ctx_rewrap_many_datakey_init (mongocrypt_ctx_t ctx, mongocrypt_binary_t filter);
965
-
966
-
967
- public static final int MONGOCRYPT_CTX_ERROR = 0;
968
- public static final int MONGOCRYPT_CTX_NEED_MONGO_COLLINFO = 1; /* run on main MongoClient */
969
- public static final int MONGOCRYPT_CTX_NEED_MONGO_MARKINGS = 2; /* run on mongocryptd. */
970
- public static final int MONGOCRYPT_CTX_NEED_MONGO_KEYS = 3; /* run on key vault */
971
- public static final int MONGOCRYPT_CTX_NEED_KMS = 4;
972
- public static final int MONGOCRYPT_CTX_READY = 5; /* ready for encryption/decryption */
973
- public static final int MONGOCRYPT_CTX_DONE = 6;
974
- public static final int MONGOCRYPT_CTX_NEED_KMS_CREDENTIALS = 7; /* fetch/renew KMS credentials */
975
-
976
- public static final int MONGOCRYPT_INDEX_TYPE_NONE = 1;
977
- public static final int MONGOCRYPT_INDEX_TYPE_EQUALITY = 2;
978
- public static final int MONGOCRYPT_QUERY_TYPE_EQUALITY = 1;
979
-
980
- /**
981
- * Get the current state of a context.
982
- *
983
- * @param ctx The @ref mongocrypt_ctx_t object.
984
- * @return A @ref mongocrypt_ctx_state_t.
985
- */
986
- public static native int
987
- mongocrypt_ctx_state(mongocrypt_ctx_t ctx);
988
-
989
-
990
- /**
991
- * Get BSON necessary to run the mongo operation when mongocrypt_ctx_t
992
- * is in MONGOCRYPT_CTX_NEED_MONGO_* states.
993
- *
994
- * <p>
995
- * op_bson is a BSON document to be used for the operation.
996
- * - For MONGOCRYPT_CTX_NEED_MONGO_COLLINFO it is a listCollections filter.
997
- * - For MONGOCRYPT_CTX_NEED_MONGO_KEYS it is a find filter.
998
- * - For MONGOCRYPT_CTX_NEED_MONGO_MARKINGS it is a JSON schema to append.
999
- * </p>
1000
- *
1001
- * @param ctx The @ref mongocrypt_ctx_t object.
1002
- * @param op_bson A BSON document for the MongoDB operation.
1003
- * @return A boolean indicating success.
1004
- */
1005
- public static native boolean
1006
- mongocrypt_ctx_mongo_op(mongocrypt_ctx_t ctx, mongocrypt_binary_t op_bson);
1007
-
1008
-
1009
- /**
1010
- * Feed a BSON reply or result when when mongocrypt_ctx_t is in
1011
- * MONGOCRYPT_CTX_NEED_MONGO_* states. This may be called multiple times
1012
- * depending on the operation.
1013
- * <p>
1014
- * op_bson is a BSON document to be used for the operation.
1015
- * - For MONGOCRYPT_CTX_NEED_MONGO_COLLINFO it is a doc from a listCollections
1016
- * cursor.
1017
- * - For MONGOCRYPT_CTX_NEED_MONGO_KEYS it is a doc from a find cursor.
1018
- * - For MONGOCRYPT_CTX_NEED_MONGO_MARKINGS it is a reply from mongocryptd.
1019
- *
1020
- * @param ctx The @ref mongocrypt_ctx_t object.
1021
- * @param reply A BSON document for the MongoDB operation.
1022
- * @return A boolean indicating success.
1023
- */
1024
- public static native boolean
1025
- mongocrypt_ctx_mongo_feed(mongocrypt_ctx_t ctx, mongocrypt_binary_t reply);
1026
-
1027
-
1028
- /**
1029
- * Call when done feeding the reply (or replies) back to the context.
1030
- *
1031
- * @param ctx The @ref mongocrypt_ctx_t object.
1032
- * @return A boolean indicating success.
1033
- */
1034
-
1035
- public static native boolean
1036
- mongocrypt_ctx_mongo_done(mongocrypt_ctx_t ctx);
1037
-
1038
- /**
1039
- * Get the next KMS handle.
1040
- * <p>
1041
- * Multiple KMS handles may be retrieved at once. Drivers may do this to fan
1042
- * out multiple concurrent KMS HTTP requests. Feeding multiple KMS requests
1043
- * is thread-safe.
1044
- * <p>
1045
- * Is KMS handles are being handled synchronously, the driver can reuse the same
1046
- * TLS socket to send HTTP requests and receive responses.
1047
- *
1048
- * @param ctx A @ref mongocrypt_ctx_t.
1049
- * @return a new @ref mongocrypt_kms_ctx_t or NULL.
1050
- */
1051
- public static native mongocrypt_kms_ctx_t
1052
- mongocrypt_ctx_next_kms_ctx(mongocrypt_ctx_t ctx);
1053
-
1054
- /**
1055
- * Get the KMS provider identifier associated with this KMS request.
1056
- *
1057
- * This is used to conditionally configure TLS connections based on the KMS
1058
- * request. It is useful for KMIP, which authenticates with a client
1059
- * certificate.
1060
- *
1061
- * @param kms The mongocrypt_kms_ctx_t object.
1062
- * @param len Receives the length of the returned string.
1063
- *
1064
- * @return The name of the KMS provider
1065
- */
1066
- public static native cstring
1067
- mongocrypt_kms_ctx_get_kms_provider(mongocrypt_kms_ctx_t kms,
1068
- Pointer len);
1069
-
1070
- /**
1071
- * Get the HTTP request message for a KMS handle.
1072
- *
1073
- * @param kms A @ref mongocrypt_kms_ctx_t.
1074
- * @param msg The HTTP request to send to KMS.
1075
- * @return A boolean indicating success.
1076
- */
1077
- public static native boolean
1078
- mongocrypt_kms_ctx_message(mongocrypt_kms_ctx_t kms,
1079
- mongocrypt_binary_t msg);
1080
-
1081
- /**
1082
- * Get the hostname from which to connect over TLS.
1083
- * <p>
1084
- * The storage for @p endpoint is not owned by the caller, but
1085
- * is valid until calling @ref mongocrypt_ctx_kms_done on the
1086
- * parent @ref mongocrypt_ctx_t.
1087
- *
1088
- * @param kms A @ref mongocrypt_kms_ctx_t.
1089
- * @param endpoint The output hostname.
1090
- * @return A boolean indicating success.
1091
- */
1092
- public static native boolean
1093
- mongocrypt_kms_ctx_endpoint(mongocrypt_kms_ctx_t kms, PointerByReference endpoint);
1094
-
1095
- /**
1096
- * Indicates how many bytes to feed into @ref mongocrypt_kms_ctx_feed.
1097
- *
1098
- * @param kms The @ref mongocrypt_kms_ctx_t.
1099
- * @return The number of requested bytes.
1100
- */
1101
- public static native int
1102
- mongocrypt_kms_ctx_bytes_needed(mongocrypt_kms_ctx_t kms);
1103
-
1104
-
1105
- /**
1106
- * Feed bytes from the HTTP response.
1107
- * <p>
1108
- * Feeding more bytes than what has been returned in @ref
1109
- * mongocrypt_kms_ctx_bytes_needed is an error.
1110
- *
1111
- * @param kms The @ref mongocrypt_kms_ctx_t.
1112
- * @param bytes The bytes to feed.
1113
- * @return A boolean indicating success.
1114
- */
1115
- public static native boolean
1116
- mongocrypt_kms_ctx_feed(mongocrypt_kms_ctx_t kms, mongocrypt_binary_t bytes);
1117
-
1118
-
1119
- /**
1120
- * Get the status associated with a @ref mongocrypt_kms_ctx_t object.
1121
- *
1122
- * @param kms The @ref mongocrypt_kms_ctx_t object.
1123
- * @param status Receives the status.
1124
- * @return A boolean indicating success.
1125
- */
1126
- public static native boolean
1127
- mongocrypt_kms_ctx_status(mongocrypt_kms_ctx_t kms,
1128
- mongocrypt_status_t status);
1129
-
1130
-
1131
- /**
1132
- * Call when done handling all KMS contexts.
1133
- *
1134
- * @param ctx The @ref mongocrypt_ctx_t object.
1135
- * @return A boolean indicating success.
1136
- */
1137
- public static native boolean
1138
- mongocrypt_ctx_kms_done(mongocrypt_ctx_t ctx);
1139
-
1140
-
1141
- /**
1142
- * Perform the final encryption or decryption.
1143
- *
1144
- * @param ctx A @ref mongocrypt_ctx_t.
1145
- * @param out The final BSON to send to the server.
1146
- * @return a boolean indicating success.
1147
- */
1148
- public static native boolean
1149
- mongocrypt_ctx_finalize(mongocrypt_ctx_t ctx, mongocrypt_binary_t out);
1150
-
1151
-
1152
- /**
1153
- * Destroy and free all memory associated with a @ref mongocrypt_ctx_t.
1154
- *
1155
- * @param ctx A @ref mongocrypt_ctx_t.
1156
- */
1157
- public static native void
1158
- mongocrypt_ctx_destroy(mongocrypt_ctx_t ctx);
1159
-
1160
- static final String NATIVE_LIBRARY_NAME = "mongocrypt";
1161
-
1162
- static {
1163
- Native.register(CAPI.class, NATIVE_LIBRARY_NAME);
1164
- }
1165
- }