Mercurial > pidgin
changeset 32414:7ceb5ca4b323
Add a function for retrieving the raw DER representation of a
certification.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Fri, 23 Dec 2011 01:09:13 +0000 |
parents | 82e524e447f1 |
children | 105202d802db |
files | libpurple/certificate.c libpurple/certificate.h |
diffstat | 2 files changed, 38 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/certificate.c Thu Dec 22 23:57:38 2011 +0000 +++ b/libpurple/certificate.c Fri Dec 23 01:09:13 2011 +0000 @@ -499,6 +499,24 @@ return (scheme->get_times)(crt, activation, expiration); } +GByteArray * +purple_certificate_get_der_data(PurpleCertificate *crt) +{ + PurpleCertificateScheme *scheme; + GByteArray *data; + + g_return_val_if_fail(crt, NULL); + g_return_val_if_fail(crt->scheme, NULL); + + scheme = crt->scheme; + + g_return_val_if_fail(scheme->get_der_data, NULL); + + data = (scheme->get_der_data)(crt); + + return data; +} + gchar * purple_certificate_pool_mkpath(PurpleCertificatePool *pool, const gchar *id) {
--- a/libpurple/certificate.h Thu Dec 22 23:57:38 2011 +0000 +++ b/libpurple/certificate.h Fri Dec 23 01:09:13 2011 +0000 @@ -257,9 +257,17 @@ */ GSList * (* import_certificates)(const gchar * filename); + /** + * Retrieves the certificate data in DER form + * + * @param crt Certificate instance + * @return Binary DER representation of certificate - must be freed using + * g_byte_array_free() + */ + GByteArray * (* get_der_data)(PurpleCertificate *crt); + void (*_purple_reserved1)(void); void (*_purple_reserved2)(void); - void (*_purple_reserved3)(void); }; /** A set of operations used to provide logic for verifying a Certificate's @@ -561,6 +569,17 @@ gboolean purple_certificate_get_times(PurpleCertificate *crt, time_t *activation, time_t *expiration); +/** + * Retrieves the certificate data in DER form. + * + * @param crt Certificate instance + * + * @return Binary DER representation of the certificate - must be freed using + * g_byte_array_free(). + */ +GByteArray * +purple_certificate_get_der_data(PurpleCertificate *crt); + /*@}*/ /*****************************************************************************/