aboutsummaryrefslogtreecommitdiffstats
path: root/smime/lib/e-asn1-object.c
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2003-12-05 09:56:08 +0800
committerChris Toshok <toshok@src.gnome.org>2003-12-05 09:56:08 +0800
commit999ef98d7640005b86cd958ed062ee1213008c49 (patch)
treeacf3eae40e22d67ad830b67ec0f9a31edcf567bb /smime/lib/e-asn1-object.c
parent56ac1ec642fb0713434132a76186290018569f67 (diff)
downloadgsoc2013-evolution-999ef98d7640005b86cd958ed062ee1213008c49.tar.gz
gsoc2013-evolution-999ef98d7640005b86cd958ed062ee1213008c49.tar.zst
gsoc2013-evolution-999ef98d7640005b86cd958ed062ee1213008c49.zip
add prototype for e_cert_get_asn1_struct.
2003-12-04 Chris Toshok <toshok@ximian.com> * lib/e-cert.h: add prototype for e_cert_get_asn1_struct. * lib/e-cert.c (e_cert_dispose): unref the asn1 object. (get_int_value): copy and massage from mozilla source. (process_version): same. (process_serial_number_der): same. (get_default_oid_format): same. (get_oid_text): same. (process_raw_bytes): same. (process_sec_algorithm_id): same. (process_subject_public_key_info): same. (process_ns_cert_type_extensions): same. (process_key_usage_extensions): same. (process_extension_data): same. (process_single_extension): same. (process_extensions): same. (process_name): same. (create_tbs_certificate_asn1_struct): same. (create_asn1_struct): same. (e_cert_get_asn1_struct): new function. * lib/e-asn1-object.c (e_asn1_object_dispose): free the display name, value, and children. (e_asn1_object_init): assume it's a valid container unless we hear otherwise. (e_asn1_object_new_from_cert): nuke. (e_asn1_object_set_valid_container): implement. (e_asn1_object_append_child): same. (e_asn1_object_set_display_name): same. (e_asn1_object_set_display_value): same. * lib/e-asn1-object.h: add prototypes for e_asn1_object_set_valid_container, e_asn1_object_set_display_name, e_asn1_object_set_display_value, and e_asn1_object_append_child. * gui/certificate-viewer.c (populate_fields_tree): populate the tree from the asn structure. (hierarchy_selection_changed): blow away the old fields_tree content and populate it again. (fields_selection_changed): implement, set the text view's contents to the asn1 object's display_value. (fill_in_details): expand all nodes in the hierarchy tree. svn path=/trunk/; revision=23640
Diffstat (limited to 'smime/lib/e-asn1-object.c')
-rw-r--r--smime/lib/e-asn1-object.c62
1 files changed, 43 insertions, 19 deletions
diff --git a/smime/lib/e-asn1-object.c b/smime/lib/e-asn1-object.c
index 47cf591b48..b7528dcd22 100644
--- a/smime/lib/e-asn1-object.c
+++ b/smime/lib/e-asn1-object.c
@@ -79,6 +79,21 @@ static GObjectClass *parent_class;
static void
e_asn1_object_dispose (GObject *object)
{
+ EASN1Object *obj = E_ASN1_OBJECT (object);
+ if (obj->priv) {
+
+ if (obj->priv->display_name)
+ g_free (obj->priv->display_name);
+
+ if (obj->priv->value)
+ g_free (obj->priv->value);
+
+ g_list_foreach (obj->priv->children, (GFunc)g_object_unref, NULL);
+ g_list_free (obj->priv->children);
+
+ g_free (obj->priv);
+ obj->priv = NULL;
+ }
}
static void
@@ -97,6 +112,8 @@ static void
e_asn1_object_init (EASN1Object *asn1)
{
asn1->priv = g_new0 (EASN1ObjectPrivate, 1);
+
+ asn1->priv->valid_container = TRUE;
}
GType
@@ -296,31 +313,18 @@ e_asn1_object_new_from_der (char *data, guint32 len)
}
EASN1Object*
-e_asn1_object_new_from_cert (ECert *cert)
-{
- char *data;
- guint32 len;
- EASN1Object *obj;
-
- if (!e_cert_get_raw_der (cert, &data, &len))
- return NULL;
-
- obj = g_object_new (E_TYPE_ASN1_OBJECT, NULL);
- if (!build_from_der (obj, data, data + len)) {
- g_object_unref (obj);
- return NULL;
- }
-
- return obj;
-}
-
-EASN1Object*
e_asn1_object_new (void)
{
return E_ASN1_OBJECT (g_object_new (E_TYPE_ASN1_OBJECT, NULL));
}
+void
+e_asn1_object_set_valid_container (EASN1Object *obj, gboolean flag)
+{
+ obj->priv->valid_container = flag;
+}
+
gboolean
e_asn1_object_is_valid_container (EASN1Object *obj)
{
@@ -349,12 +353,32 @@ e_asn1_object_get_children (EASN1Object *obj)
return children;
}
+void
+e_asn1_object_append_child (EASN1Object *parent, EASN1Object *child)
+{
+ parent->priv->children = g_list_append (parent->priv->children, g_object_ref (child));
+}
+
+void
+e_asn1_object_set_display_name (EASN1Object *obj, const char *name)
+{
+ g_free (obj->priv->display_name);
+ obj->priv->display_name = g_strdup (name);
+}
+
const char*
e_asn1_object_get_display_name (EASN1Object *obj)
{
return obj->priv->display_name;
}
+void
+e_asn1_object_set_display_value (EASN1Object *obj, const char *value)
+{
+ g_free (obj->priv->value);
+ obj->priv->value = g_strdup (value);
+}
+
const char*
e_asn1_object_get_display_value (EASN1Object *obj)
{