diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2012-10-07 10:33:55 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2012-10-07 10:37:44 +0200 |
commit | 531bac41a0ee19158f0722937d0c9efafbc3bb14 (patch) | |
tree | c768f0c17ae335479b628d0c644742da63fb0f44 /lib/x509/pkcs7.c | |
parent | 5afff3b04637ee2d0fa29bf783428e7fc43ea722 (diff) | |
download | gnutls-531bac41a0ee19158f0722937d0c9efafbc3bb14.tar.gz |
Added functions to export structures in an allocated buffer.
Diffstat (limited to 'lib/x509/pkcs7.c')
-rw-r--r-- | lib/x509/pkcs7.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/x509/pkcs7.c b/lib/x509/pkcs7.c index 16e4d3b28e..5149f5c3fe 100644 --- a/lib/x509/pkcs7.c +++ b/lib/x509/pkcs7.c @@ -432,6 +432,32 @@ gnutls_pkcs7_export (gnutls_pkcs7_t pkcs7, output_data, output_data_size); } +/** + * gnutls_pkcs7_export2: + * @pkcs7: Holds the pkcs7 structure + * @format: the format of output params. One of PEM or DER. + * @out: will contain a structure PEM or DER encoded + * + * This function will export the pkcs7 structure to DER or PEM format. + * + * The output buffer is allocated using gnutls_malloc(). + * + * If the structure is PEM encoded, it will have a header + * of "BEGIN PKCS7". + * + * Returns: On success, %GNUTLS_E_SUCCESS (0) is returned, otherwise a + * negative error value. + **/ +int +gnutls_pkcs7_export2 (gnutls_pkcs7_t pkcs7, + gnutls_x509_crt_fmt_t format, gnutls_datum_t *out) +{ + if (pkcs7 == NULL) + return GNUTLS_E_INVALID_REQUEST; + + return _gnutls_x509_export_int2 (pkcs7->pkcs7, format, PEM_PKCS7, out); +} + /* Creates an empty signed data structure in the pkcs7 * structure and returns a handle to the signed data. */ |