@@ -2069,7 +2069,7 @@ TEST_F(rnp_tests, test_ffi_create_key_certification_signature)
20692069 assert_rnp_success (rnp_key_get_uid_handle_at (key, 0 , &uid));
20702070 rnp_key_handle_t signer = NULL ;
20712071 assert_rnp_success (rnp_locate_key (ffi, " userid" , " ecc-25519" , &signer));
2072- /* Create other key certification with default type*/
2072+ /* Create other key certification with default type */
20732073 rnp_signature_handle_t newsig = NULL ;
20742074 assert_rnp_success (rnp_key_certification_create (signer, uid, NULL , &newsig));
20752075 const char *hash = " SHA384" ;
@@ -2083,6 +2083,8 @@ TEST_F(rnp_tests, test_ffi_create_key_certification_signature)
20832083 rnp_key_certification_create (signer, uid, RNP_CERTIFICATION_CASUAL, &newsig));
20842084 const char *hash2 = " SHA512" ;
20852085 assert_rnp_success (rnp_key_signature_set_hash (newsig, hash2));
2086+ assert_rnp_failure (rnp_key_signature_set_trust_level (NULL , 1 , 120 ));
2087+ assert_rnp_success (rnp_key_signature_set_trust_level (newsig, 1 , 120 ));
20862088 assert_rnp_success (rnp_key_signature_sign (newsig));
20872089 rnp_signature_handle_destroy (newsig);
20882090 /* Check certification parameters */
@@ -2093,11 +2095,26 @@ TEST_F(rnp_tests, test_ffi_create_key_certification_signature)
20932095 assert_rnp_success (rnp_signature_is_valid (newsig, 0 ));
20942096 assert_true (check_sig_hash (newsig, hash));
20952097 assert_true (check_sig_type (newsig, " certification (generic)" ));
2098+ uint8_t level = 255 ;
2099+ uint8_t amount = 255 ;
2100+ assert_rnp_failure (rnp_signature_get_trust_level (NULL , NULL , NULL ));
2101+ assert_rnp_success (rnp_signature_get_trust_level (newsig, NULL , NULL ));
2102+ assert_rnp_success (rnp_signature_get_trust_level (newsig, &level, NULL ));
2103+ assert_int_equal (level, 0 );
2104+ assert_rnp_success (rnp_signature_get_trust_level (newsig, NULL , &amount));
2105+ assert_int_equal (amount, 0 );
2106+ level = amount = 255 ;
2107+ assert_rnp_success (rnp_signature_get_trust_level (newsig, &level, &amount));
2108+ assert_int_equal (level, 0 );
2109+ assert_int_equal (amount, 0 );
20962110 rnp_signature_handle_destroy (newsig);
20972111 assert_rnp_success (rnp_uid_get_signature_at (uid, 2 , &newsig));
20982112 assert_rnp_success (rnp_signature_is_valid (newsig, 0 ));
20992113 assert_true (check_sig_hash (newsig, hash2));
21002114 assert_true (check_sig_type (newsig, " certification (casual)" ));
2115+ assert_rnp_success (rnp_signature_get_trust_level (newsig, &level, &amount));
2116+ assert_int_equal (level, 1 );
2117+ assert_int_equal (amount, 120 );
21012118 rnp_signature_handle_destroy (newsig);
21022119 rnp_uid_handle_destroy (uid);
21032120 rnp_key_handle_destroy (signer);
0 commit comments