src/libmongoc/tests/test-mongoc-client-side-encryption.c
/* Convenience helper for creating KMS providers doc */
Convenience helper for creating KMS providers doc
Convenience helper for creating KMS providers doc
static bson_t *
_make_kms_providers (bool with_aws, bool with_local)
{
   bson_t *kms_providers = bson_new ();
   if (with_aws) {
      char *aws_secret_access_key;
      char *aws_access_key_id;
      aws_secret_access_key =
         test_framework_getenv ("MONGOC_TEST_AWS_SECRET_ACCESS_KEY");
      aws_access_key_id =
         test_framework_getenv ("MONGOC_TEST_AWS_ACCESS_KEY_ID");
      if (!aws_secret_access_key || !aws_access_key_id) {
         fprintf (stderr,
                  "Set MONGOC_TEST_AWS_SECRET_ACCESS_KEY and "
                  "MONGOC_TEST_AWS_ACCESS_KEY_ID environment "
                  "variables to run Client Side Encryption tests.");
         abort ();
      }
      bson_concat (
         kms_providers,
         tmp_bson ("{ 'aws': { 'secretAccessKey': '%s', 'accessKeyId': '%s' }}",
                   aws_secret_access_key,
                   aws_access_key_id));
      bson_free (aws_secret_access_key);
      bson_free (aws_access_key_id);
   }
   if (with_local) {
      bson_t *local = BCON_NEW ("local",
                                "{",
                                "key",
                                BCON_BIN (0, (uint8_t *) LOCAL_MASTERKEY, 96),
                                "}");
      bson_concat (kms_providers, local);
      bson_destroy (local);
   }
   return kms_providers;
}
static bson_t * _make_kms_providers ( bool with_aws , bool with_local ) { bson_t * kms_providers = bson_new ( ) ; if ( with_aws ) { char * aws_secret_access_key ; char * aws_access_key_id ; aws_secret_access_key = test_framework_getenv ( " " ) ; aws_access_key_id = test_framework_getenv ( " " ) ; if ( ! aws_secret_access_key || ! aws_access_key_id ) { fprintf ( stderr , " " " " " " ) ; abort ( ) ; } bson_concat ( kms_providers , tmp_bson ( " " , aws_secret_access_key , aws_access_key_id ) ) ; bson_free ( aws_secret_access_key ) ; bson_free ( aws_access_key_id ) ; } if ( with_local ) { bson_t * local = BCON_NEW ( " " , " " , " " , BCON_BIN ( 0 , ( uint8_t * ) LOCAL_MASTERKEY , 96 ) , " " ) ; bson_concat ( kms_providers , local ) ; bson_destroy ( local ) ; } return kms_providers ; }
Convenience helper for creating KMS providers doc
Convenience helper for creating KMS providers doc