aboutsummaryrefslogtreecommitdiffstats
path: root/asn1
diff options
context:
space:
mode:
Diffstat (limited to 'asn1')
-rw-r--r--asn1/x509af/packet-x509af-template.c21
-rw-r--r--asn1/x509af/x509af.cnf6
2 files changed, 27 insertions, 0 deletions
diff --git a/asn1/x509af/packet-x509af-template.c b/asn1/x509af/packet-x509af-template.c
index 21211401ff..c6941421d2 100644
--- a/asn1/x509af/packet-x509af-template.c
+++ b/asn1/x509af/packet-x509af-template.c
@@ -33,6 +33,9 @@
#include "packet-x509if.h"
#include "packet-x509sat.h"
#include "packet-ldap.h"
+#if defined(HAVE_LIBGNUTLS)
+#include <gnutls/gnutls.h>
+#endif
#define PNAME "X.509 Authentication Framework"
#define PSNAME "X509AF"
@@ -51,8 +54,26 @@ static int hf_x509af_extension_id = -1;
static gint ett_pkix_crl = -1;
#include "packet-x509af-ett.c"
static const char *algorithm_id;
+static void
+x509af_export_publickey(tvbuff_t *tvb, asn1_ctx_t *actx, int offset, int len);
#include "packet-x509af-fn.c"
+/* Exports the SubjectPublicKeyInfo structure as gnutls_datum_t.
+ * actx->private_data is assumed to be a gnutls_datum_t pointer which will be
+ * filled in if non-NULL. */
+static void
+x509af_export_publickey(tvbuff_t *tvb _U_, asn1_ctx_t *actx _U_, int offset _U_, int len _U_)
+{
+#if defined(HAVE_LIBGNUTLS)
+ gnutls_datum_t *subjectPublicKeyInfo = (gnutls_datum_t *)actx->private_data;
+ if (subjectPublicKeyInfo) {
+ subjectPublicKeyInfo->data = (guchar *) tvb_get_ptr(tvb, offset, len);
+ subjectPublicKeyInfo->size = len;
+ actx->private_data = NULL;
+ }
+#endif
+}
+
const char *x509af_get_last_algorithm_id(void) {
return algorithm_id;
}
diff --git a/asn1/x509af/x509af.cnf b/asn1/x509af/x509af.cnf
index de4d171348..5c98d6dbaf 100644
--- a/asn1/x509af/x509af.cnf
+++ b/asn1/x509af/x509af.cnf
@@ -81,6 +81,12 @@ CertificateList/signedCertificateList/revokedCertificates/_item/userCertificate
#.FN_BODY AlgorithmIdentifier/parameters
offset=call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree, NULL);
+#.FN_HDR SubjectPublicKeyInfo
+ int orig_offset = offset;
+#.FN_FTR SubjectPublicKeyInfo
+ x509af_export_publickey(tvb, actx, orig_offset, offset - orig_offset);
+#.END
+
#.FN_PARS Extension/extnId
FN_VARIANT = _str HF_INDEX = hf_x509af_extension_id VAL_PTR = &actx->external.direct_reference