aboutsummaryrefslogtreecommitdiffstats
path: root/smime/lib
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2003-10-24 00:11:32 +0800
committerChris Toshok <toshok@src.gnome.org>2003-10-24 00:11:32 +0800
commit1609f69980b34649ee50ab8ec411609ad94106c9 (patch)
treedcca2cd586ff7f3a6be005c163a683bc4bf9bdae /smime/lib
parenteca844b013c8de01e2b6dcdecffdf50e1ecab7b6 (diff)
downloadgsoc2013-evolution-1609f69980b34649ee50ab8ec411609ad94106c9.tar
gsoc2013-evolution-1609f69980b34649ee50ab8ec411609ad94106c9.tar.gz
gsoc2013-evolution-1609f69980b34649ee50ab8ec411609ad94106c9.tar.bz2
gsoc2013-evolution-1609f69980b34649ee50ab8ec411609ad94106c9.tar.lz
gsoc2013-evolution-1609f69980b34649ee50ab8ec411609ad94106c9.tar.xz
gsoc2013-evolution-1609f69980b34649ee50ab8ec411609ad94106c9.tar.zst
gsoc2013-evolution-1609f69980b34649ee50ab8ec411609ad94106c9.zip
initial addition of s/mime foo.
2003-10-23 Chris Toshok <toshok@ximian.com> * lib/e-cert.[ch], lib/Makefile.am, gui/certificate-manager.[ch], gui/Makefile.am, gui/smime-ui.glade, Makefile.am: initial addition of s/mime foo. svn path=/trunk/; revision=23042
Diffstat (limited to 'smime/lib')
-rw-r--r--smime/lib/.cvsignore3
-rw-r--r--smime/lib/Makefile.am24
-rw-r--r--smime/lib/e-cert.c148
-rw-r--r--smime/lib/e-cert.h67
4 files changed, 242 insertions, 0 deletions
diff --git a/smime/lib/.cvsignore b/smime/lib/.cvsignore
new file mode 100644
index 0000000000..74b73492ca
--- /dev/null
+++ b/smime/lib/.cvsignore
@@ -0,0 +1,3 @@
+Makefile
+Makefile.in
+*.la
diff --git a/smime/lib/Makefile.am b/smime/lib/Makefile.am
new file mode 100644
index 0000000000..4af28f2994
--- /dev/null
+++ b/smime/lib/Makefile.am
@@ -0,0 +1,24 @@
+INCLUDES = \
+ -DG_LOG_DOMAIN=\"evolution-smime\" \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/shell \
+ -I$(top_builddir) \
+ -DEVOLUTION_DATADIR=\""$(datadir)"\" \
+ -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
+ -DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \
+ -DEVOLUTION_IMAGESDIR=\""$(imagesdir)"\" \
+ -DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \
+ -DEVOLUTION_UIDIR=\""$(evolutionuidir)"\" \
+ -DPREFIX=\""$(prefix)"\" \
+ -DG_DISABLE_DEPRECATED \
+ -DGTK_DISABLE_DEPRECATED \
+ -DLIBGNOME_DISABLE_DEPRECATED \
+ -DLIBGNOMEUI_DISABLE_DEPRECATED \
+ $(EVOLUTION_ADDRESSBOOK_CFLAGS) \
+ $(CAMEL_CFLAGS)
+
+noinst_LTLIBRARIES = libessmime.la
+
+libessmime_la_SOURCES = \
+ e-cert.c \
+ e-cert.h
diff --git a/smime/lib/e-cert.c b/smime/lib/e-cert.c
new file mode 100644
index 0000000000..5636730401
--- /dev/null
+++ b/smime/lib/e-cert.c
@@ -0,0 +1,148 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* e-cert.c
+ *
+ * Copyright (C) 2003 Ximian, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Chris Toshok (toshok@ximian.com)
+ */
+
+#include "e-cert.h"
+
+struct _ECertPrivate {
+ CERTCertificate *cert;
+ char *org_name;
+ char *cn;
+};
+
+#define PARENT_TYPE G_TYPE_OBJECT
+static GObjectClass *parent_class;
+
+static void
+e_cert_dispose (GObject *object)
+{
+ ECert *ec = E_CERT (object);
+
+ if (!ec->priv)
+ return;
+
+ if (ec->priv->org_name)
+ PORT_Free (ec->priv->org_name);
+ if (ec->priv->cn)
+ PORT_Free (ec->priv->org_name);
+
+ g_free (ec->priv);
+ ec->priv = NULL;
+
+ if (G_OBJECT_CLASS (parent_class)->dispose)
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+e_cert_class_init (ECertClass *klass)
+{
+ GObjectClass *object_class;
+
+ object_class = G_OBJECT_CLASS(klass);
+
+ parent_class = g_type_class_ref (PARENT_TYPE);
+
+ object_class->dispose = e_cert_dispose;
+}
+
+static void
+e_cert_init (ECert *ec)
+{
+ ec->priv = g_new0 (ECertPrivate, 1);
+}
+
+GType
+e_cert_get_type (void)
+{
+ static GType cert_type = 0;
+
+ if (!cert_type) {
+ static const GTypeInfo cert_info = {
+ sizeof (ECertClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc) e_cert_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (ECert),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) e_cert_init,
+ };
+
+ cert_type = g_type_register_static (PARENT_TYPE, "ECert", &cert_info, 0);
+ }
+
+ return cert_type;
+}
+
+
+
+static void
+e_cert_populate (ECert *cert)
+{
+ CERTCertificate *c = cert->priv->cert;
+ cert->priv->org_name = CERT_GetOrgName (&c->subject);
+ cert->priv->cn = CERT_GetCommonName (&c->subject);
+}
+
+ECert*
+e_cert_new (CERTCertificate *cert)
+{
+ ECert *ecert = E_CERT (g_object_new (E_TYPE_CERT, NULL));
+
+ ecert->priv->cert = cert;
+
+ e_cert_populate (ecert);
+
+ return ecert;
+}
+
+
+
+
+const char*
+e_cert_get_nickname (ECert *cert)
+{
+ return cert->priv->cert->nickname;
+}
+
+const char*
+e_cert_get_email (ECert *cert)
+{
+}
+
+const char*
+e_cert_get_org (ECert *cert)
+{
+ return cert->priv->org_name;
+}
+
+const char*
+e_cert_get_cn (ECert *cert)
+{
+ return cert->priv->cn;
+}
+
+gboolean
+e_cert_is_ca_cert (ECert *cert)
+{
+ return CERT_IsCACert (cert->priv->cert, NULL);
+}
diff --git a/smime/lib/e-cert.h b/smime/lib/e-cert.h
new file mode 100644
index 0000000000..86517dad79
--- /dev/null
+++ b/smime/lib/e-cert.h
@@ -0,0 +1,67 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Authors: Chris Toshok <toshok@ximian.com>
+ *
+ * Copyright (C) 2003 Ximian, Inc. (www.ximian.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef _E_CERT_H_
+#define _E_CERT_H_
+
+#include <glib-object.h>
+#include <cert.h>
+
+#define E_TYPE_CERT (e_cert_get_type ())
+#define E_CERT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_CERT, ECert))
+#define E_CERT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_CERT, ECertClass))
+#define E_IS_CERT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_CERT))
+#define E_IS_CERT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_CERT))
+#define E_CERT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), E_TYPE_CERT, ECertClass))
+
+typedef struct _ECert ECert;
+typedef struct _ECertClass ECertClass;
+typedef struct _ECertPrivate ECertPrivate;
+
+struct _ECert {
+ GObject parent;
+
+ ECertPrivate *priv;
+};
+
+struct _ECertClass {
+ GObjectClass parent_class;
+
+ /* Padding for future expansion */
+ void (*_ecert_reserved0) (void);
+ void (*_ecert_reserved1) (void);
+ void (*_ecert_reserved2) (void);
+ void (*_ecert_reserved3) (void);
+ void (*_ecert_reserved4) (void);
+};
+
+GType e_cert_get_type (void);
+
+ECert* e_cert_new (CERTCertificate *cert);
+
+const char* e_cert_get_nickname (ECert *cert);
+const char* e_cert_get_email (ECert *cert);
+const char* e_cert_get_org (ECert *cert);
+const char* e_cert_get_cn (ECert *cert);
+
+gboolean e_cert_is_ca_cert (ECert *cert);
+#endif /* _E_CERT_H_ */