diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2015-06-17 16:40:15 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2015-06-17 16:40:41 +0200 |
commit | aa68821a7e149a7a62d15a1096c079293d808e71 (patch) | |
tree | 160660c4688a62572747fa1f31c165e93be27511 /lib/x509/pkcs7.c | |
parent | 1a901b6ca3c25125f1fb83959a208642c218b0cb (diff) | |
download | gnutls-aa68821a7e149a7a62d15a1096c079293d808e71.tar.gz |
Added gnutls_pkcs7_get_signature_count
Diffstat (limited to 'lib/x509/pkcs7.c')
-rw-r--r-- | lib/x509/pkcs7.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/lib/x509/pkcs7.c b/lib/x509/pkcs7.c index 3f61a80cfe..e5d6d1619a 100644 --- a/lib/x509/pkcs7.c +++ b/lib/x509/pkcs7.c @@ -405,7 +405,7 @@ gnutls_pkcs7_get_crt_raw(gnutls_pkcs7_t pkcs7, * This function will return the number of certifcates in the PKCS7 * or RFC2630 certificate set. * - * Returns: On success, %GNUTLS_E_SUCCESS (0) is returned, otherwise a + * Returns: On success, a positive number is returned, otherwise a * negative error value. **/ int gnutls_pkcs7_get_crt_count(gnutls_pkcs7_t pkcs7) @@ -483,6 +483,34 @@ static time_t parse_time(gnutls_pkcs7_t pkcs7, const char *root) } /** + * gnutls_pkcs7_get_signature_count: + * @pkcs7: should contain a #gnutls_pkcs7_t type + * + * This function will return the number of signatures in the PKCS7 + * structure. + * + * Returns: On success, a positive number is returned, otherwise a + * negative error value. + * + * Since: 3.4.3 + **/ +int gnutls_pkcs7_get_signature_count(gnutls_pkcs7_t pkcs7) +{ + int ret, count; + + if (pkcs7 == NULL) + return GNUTLS_E_INVALID_REQUEST; + + ret = asn1_number_of_elements(pkcs7->signed_data, "signerInfos", &count); + if (ret != ASN1_SUCCESS) { + gnutls_assert(); + return 0; + } + + return count; +} + +/** * gnutls_pkcs7_get_signature_info: * @pkcs7: should contain a #gnutls_pkcs7_t type * @idx: the index of the signature info to check |