@@ -2001,6 +2001,7 @@ TEST_F(rnp_tests, test_ffi_create_self_certification_signature)
20012001 rnp_key_certification_create (key, NULL , RNP_CERTIFICATION_POSITIVE, &newsig));
20022002 assert_rnp_failure (
20032003 rnp_key_certification_create (key, uid, RNP_CERTIFICATION_POSITIVE, NULL ));
2004+ assert_rnp_failure (rnp_key_certification_create (key, uid, " wrong" , &newsig));
20042005 assert_rnp_success (rnp_key_certification_create (key, uid, NULL , &newsig));
20052006 const char *hash = " SHA384" ;
20062007 assert_rnp_success (rnp_key_signature_set_hash (newsig, hash));
@@ -2110,8 +2111,10 @@ TEST_F(rnp_tests, test_ffi_create_key_certification_signature)
21102111 rnp_signature_handle_destroy (newsig);
21112112 assert_rnp_success (rnp_uid_get_signature_at (uid, 2 , &newsig));
21122113 assert_rnp_success (rnp_signature_is_valid (newsig, 0 ));
2114+ assert_rnp_failure (rnp_key_signature_set_hash (newsig, hash));
21132115 assert_true (check_sig_hash (newsig, hash2));
21142116 assert_true (check_sig_type (newsig, " certification (casual)" ));
2117+ assert_rnp_failure (rnp_key_signature_set_trust_level (newsig, 1 , 60 ));
21152118 assert_rnp_success (rnp_signature_get_trust_level (newsig, &level, &amount));
21162119 assert_int_equal (level, 1 );
21172120 assert_int_equal (amount, 120 );
@@ -2308,50 +2311,61 @@ TEST_F(rnp_tests, test_ffi_key_self_certification_features)
23082311 uint32_t now = ::time (NULL );
23092312 assert_rnp_failure (rnp_signature_get_creation (NULL , &check));
23102313 assert_rnp_failure (rnp_signature_get_creation (newsig, NULL ));
2314+ assert_rnp_failure (rnp_key_signature_set_creation (newsig, 0 ));
23112315 assert_rnp_success (rnp_signature_get_creation (newsig, &check));
23122316 assert_true (check >= now - 10 );
23132317 assert_rnp_failure (rnp_signature_get_key_expiration (NULL , &check));
23142318 assert_rnp_failure (rnp_signature_get_key_expiration (newsig, NULL ));
2319+ assert_rnp_failure (rnp_key_signature_set_key_expiration (newsig, 10000 ));
23152320 assert_rnp_success (rnp_signature_get_key_expiration (newsig, &check));
23162321 assert_int_equal (check, 0 );
23172322 assert_rnp_failure (rnp_signature_get_primary_uid (NULL , &primary));
23182323 assert_rnp_failure (rnp_signature_get_primary_uid (newsig, NULL ));
2324+ assert_rnp_failure (rnp_key_signature_set_primary_uid (newsig, true ));
23192325 assert_rnp_success (rnp_signature_get_primary_uid (newsig, &primary));
23202326 assert_false (primary);
23212327 char *strcheck = NULL ;
23222328 assert_rnp_failure (rnp_signature_get_key_server (NULL , &strcheck));
23232329 assert_rnp_failure (rnp_signature_get_key_server (newsig, NULL ));
2330+ assert_rnp_failure (rnp_key_signature_set_key_server (newsig, " server" ));
23242331 assert_rnp_success (rnp_signature_get_key_server (newsig, &strcheck));
23252332 assert_string_equal (strcheck, " " );
23262333 rnp_buffer_destroy (strcheck);
23272334 assert_rnp_failure (rnp_signature_get_features (NULL , &check));
23282335 assert_rnp_failure (rnp_signature_get_features (newsig, NULL ));
2336+ assert_rnp_failure (rnp_key_signature_set_features (newsig, features));
23292337 assert_rnp_success (rnp_signature_get_features (newsig, &check));
23302338 assert_int_equal (check, 0 );
23312339 assert_rnp_failure (rnp_signature_get_key_flags (NULL , &check));
23322340 assert_rnp_failure (rnp_signature_get_key_flags (newsig, NULL ));
2341+ assert_rnp_failure (rnp_key_signature_set_key_flags (newsig, RNP_KEY_USAGE_CERTIFY));
23332342 assert_rnp_success (rnp_signature_get_features (newsig, &check));
23342343 assert_int_equal (check, 0 );
23352344 assert_rnp_failure (rnp_signature_get_key_server_prefs (NULL , &check));
23362345 assert_rnp_failure (rnp_signature_get_key_server_prefs (newsig, NULL ));
2346+ assert_rnp_failure (
2347+ rnp_key_signature_set_key_server_prefs (newsig, RNP_KEY_SERVER_NO_MODIFY));
23372348 assert_rnp_success (rnp_signature_get_key_server_prefs (newsig, &check));
23382349 assert_int_equal (check, 0 );
23392350 assert_rnp_failure (rnp_signature_get_preferred_alg_count (NULL , &count));
23402351 assert_rnp_failure (rnp_signature_get_preferred_alg_count (newsig, NULL ));
2352+ assert_rnp_failure (rnp_key_signature_add_preferred_alg (newsig, RNP_ALGNAME_AES_256));
23412353 assert_rnp_success (rnp_signature_get_preferred_alg_count (newsig, &count));
23422354 assert_int_equal (count, 0 );
23432355 assert_rnp_failure (rnp_signature_get_preferred_alg (NULL , 0 , &alg));
23442356 assert_rnp_failure (rnp_signature_get_preferred_alg (newsig, 0 , NULL ));
23452357 assert_rnp_failure (rnp_signature_get_preferred_alg (newsig, 0 , &alg));
23462358 assert_rnp_failure (rnp_signature_get_preferred_hash_count (NULL , &count));
23472359 assert_rnp_failure (rnp_signature_get_preferred_hash_count (newsig, NULL ));
2360+ assert_rnp_failure (rnp_key_signature_add_preferred_hash (newsig, RNP_ALGNAME_SHA512));
23482361 assert_rnp_success (rnp_signature_get_preferred_hash_count (newsig, &count));
23492362 assert_int_equal (count, 0 );
23502363 assert_rnp_failure (rnp_signature_get_preferred_hash (NULL , 0 , &alg));
23512364 assert_rnp_failure (rnp_signature_get_preferred_hash (newsig, 0 , NULL ));
23522365 assert_rnp_failure (rnp_signature_get_preferred_hash (newsig, 0 , &alg));
23532366 assert_rnp_failure (rnp_signature_get_preferred_zalg_count (NULL , &count));
23542367 assert_rnp_failure (rnp_signature_get_preferred_zalg_count (newsig, NULL ));
2368+ assert_rnp_failure (rnp_key_signature_add_preferred_zalg (newsig, RNP_ALGNAME_BZIP2));
23552369 assert_rnp_success (rnp_signature_get_preferred_zalg_count (newsig, &count));
23562370 assert_int_equal (count, 0 );
23572371 assert_rnp_failure (rnp_signature_get_preferred_zalg (NULL , 0 , &alg));
0 commit comments