diff options
author | Chris Toshok <toshok@ximian.com> | 2003-11-12 10:07:25 +0800 |
---|---|---|
committer | Chris Toshok <toshok@src.gnome.org> | 2003-11-12 10:07:25 +0800 |
commit | 4e1bce59fa373fd302b994d495427109c9fff121 (patch) | |
tree | 0769e76165203f6ee8395589441a5053074e3ea5 /smime/lib/e-cert-db.h | |
parent | 747e7843d135ca6640db787819b2664fe97afdad (diff) | |
download | gsoc2013-evolution-4e1bce59fa373fd302b994d495427109c9fff121.tar.gz gsoc2013-evolution-4e1bce59fa373fd302b994d495427109c9fff121.tar.zst gsoc2013-evolution-4e1bce59fa373fd302b994d495427109c9fff121.zip |
don't init NSS here. it's done in e_cert_db_peek.
2003-11-11 Chris Toshok <toshok@ximian.com>
* tests/import-cert.c (main): don't init NSS here. it's done in
e_cert_db_peek.
* lib/Makefile.am (libessmime_la_SOURCES): add e-cert-db.[ch]
* gui/smime-ui.glade: set the initial sensitivity of the buttons
here, and add the beginnings of the CA import dialog (where you
assign trust levels to it.)
* gui/certificate-manager.c (handle_selection_changed):
sensitize/desensitize all the various buttons correctly when the
GtkTreeView's selection changes.
(yourcerts_selection_changed): new, selection change handler for
the Your Certs tab.
(initialize_yourcerts_ui): hook up the tree selection, and add a
model column for the ECert.
(contactcerts_selection_changed): new, selection change handler
for the Contact Certs tab.
(initialize_contactcerts_ui): hook up the tree selection, and add
a model column for the ECert.
(import_ca): new function.
(delete_ca): new function.
(authoritycerts_selection_changed): new, selection change handler
for the Authority Certs tab.
(create_authoritycerts_treemodel): new function for creating the
authority cert tree model. the other tabs will eventually use a
separate function for this too, as unload_certs gets fleshed out.
(initialize_authoritycerts_ui): hook up the tree selection, and
add import/delete buttons.
(destroy_key): dtor for the keys in our hashes.
(destroy_value): dtor for the values in our hashes.
(unload_certs): new function. basically destroy/recreate the
model and hash for the particular cert type/tab.
(load_certs): use e_cert_get_cert_type.
(populate_ui): use unload_certs as well as load_certs.
(certificate_manager_config_control_new): call e_cert_db_peek
,which will initialize all of NSS. hook up all the widgets from
libglade.
* lib/e-cert.h: add prototypes for all the new methods, and add
the ECertType enum.
* lib/e-cert.c (e_cert_dispose): handle deletion from the DB here.
(e_cert_new_from_der): new function.
(e_cert_get_internal_cert): new function.
(e_cert_get_raw_der): new function.
(e_cert_get_issuer_name): new
(e_cert_get_subject_name): new
(e_cert_mark_for_deletion): new
(e_cert_get_cert_type): new.
(e_cert_is_ca_cert): nuke.
* lib/e-cert-db.[ch]: new, partly implemented, derived from
mozilla's nsNSSCertificateDB code.
svn path=/trunk/; revision=23292
Diffstat (limited to 'smime/lib/e-cert-db.h')
-rw-r--r-- | smime/lib/e-cert-db.h | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/smime/lib/e-cert-db.h b/smime/lib/e-cert-db.h new file mode 100644 index 0000000000..ffc381587a --- /dev/null +++ b/smime/lib/e-cert-db.h @@ -0,0 +1,128 @@ +/* -*- 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_DB_H_ +#define _E_CERT_DB_H_ + +#include <glib-object.h> +#include "e-cert.h" +#include <cert.h> + +#define E_TYPE_CERT_DB (e_cert_db_get_type ()) +#define E_CERT_DB(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_CERT_DB, ECertDB)) +#define E_CERT_DB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_CERT_DB, ECertDBClass)) +#define E_IS_CERT_DB(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_CERT_DB)) +#define E_IS_CERT_DB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_CERT_DB)) +#define E_CERT_DB_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), E_TYPE_CERT_DB, ECertDBClass)) + +typedef struct _ECertDB ECertDB; +typedef struct _ECertDBClass ECertDBClass; +typedef struct _ECertDBPrivate ECertDBPrivate; + +struct _ECertDB { + GObject parent; + + ECertDBPrivate *priv; +}; + +struct _ECertDBClass { + 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_db_get_type (void); + +/* single instance */ +ECertDB* e_cert_db_peek (void); + +void e_cert_db_shutdown (void); + +/* searching for certificates */ +ECert* e_cert_db_find_cert_by_nickname (ECertDB *certdb, + const char *nickname, + GError **error); + +ECert* e_cert_db_find_cert_by_key (ECertDB *certdb, + const char *db_key, + GError **error); + +GList* e_cert_db_get_cert_nicknames (ECertDB *certdb, + ECertType cert_type, + GError **error); + + +ECert* e_cert_db_find_email_encryption_cert (ECertDB *certdb, + const char *nickname, + GError **error); + +ECert* e_cert_db_find_email_signing_cert (ECertDB *certdb, + const char *nickname, + GError **error); + +ECert* e_cert_db_find_cert_by_email_address (ECertDB *certdb, + const char *nickname, + GError **error); + +/* deleting certificates */ +gboolean e_cert_db_delete_cert (ECertDB *certdb, + ECert *cert); + +/* importing certificates */ +gboolean e_cert_db_import_certs (ECertDB *certdb, + char *data, guint32 length, + ECertType cert_type, + GError **error); + +gboolean e_cert_db_import_email_cert (ECertDB *certdb, + char *data, guint32 length, + GError **error); + +gboolean e_cert_db_import_user_cert (ECertDB *certdb, + char *data, guint32 length, + GError **error); + +gboolean e_cert_db_import_server_cert (ECertDB *certdb, + char *data, guint32 length, + GError **error); + +gboolean e_cert_db_import_certs_from_file (ECertDB *cert_db, + const char *file_path, + ECertType cert_type, + GError **error); + +gboolean e_cert_db_import_pkcs12_file (ECertDB *cert_db, + const char *file_path, + GError **error); + +gboolean e_cert_db_export_pkcs12_file (ECertDB *cert_db, + const char *file_path, + GList *certs, + GError **error); + + +#endif /* _E_CERT_DB_H_ */ |