Skip to content

Commit 3f9165d

Browse files
committed
FFI: Add function rnp_signature_get_trust_level().
1 parent e672bb4 commit 3f9165d

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

include/rnp/rnp.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2101,6 +2101,21 @@ RNP_API rnp_result_t rnp_signature_get_revocation_reason(rnp_signature_handle_t
21012101
char ** code,
21022102
char ** reason);
21032103

2104+
/**
2105+
* @brief Get the signature trust level and amount. See OpenPGP specification for the details
2106+
* on their interpretation ('Trust Signature' signature subpacket).
2107+
*
2108+
* @param sig signature handle, cannot be NULL.
2109+
* @param level trust level will be stored here if non-NULL. If corresponding value is not
2110+
* available then 0 will be stored.
2111+
* @param amount trust amount will be stored here if non-NULL. If corresponding value is not
2112+
* available then 0 will be stored.
2113+
* @return RNP_SUCCESS or error code if failed.
2114+
*/
2115+
RNP_API rnp_result_t rnp_signature_get_trust_level(rnp_signature_handle_t sig,
2116+
uint8_t * level,
2117+
uint8_t * amount);
2118+
21042119
/**
21052120
* @brief Get signature validity, revalidating it if didn't before.
21062121
*

src/lib/rnp.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6915,6 +6915,25 @@ try {
69156915
}
69166916
FFI_GUARD
69176917

6918+
rnp_result_t
6919+
rnp_signature_get_trust_level(rnp_signature_handle_t sig, uint8_t *level, uint8_t *amount)
6920+
try {
6921+
if (!sig) {
6922+
return RNP_ERROR_NULL_POINTER;
6923+
}
6924+
if (!sig->sig) {
6925+
return RNP_ERROR_BAD_PARAMETERS;
6926+
}
6927+
if (level) {
6928+
*level = sig->sig->sig.trust_level();
6929+
}
6930+
if (amount) {
6931+
*amount = sig->sig->sig.trust_amount();
6932+
}
6933+
return RNP_SUCCESS;
6934+
}
6935+
FFI_GUARD
6936+
69186937
rnp_result_t
69196938
rnp_signature_is_valid(rnp_signature_handle_t sig, uint32_t flags)
69206939
try {

0 commit comments

Comments
 (0)