diff options
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | pk/Makefile.am | 1 | ||||
-rw-r--r-- | pk/gkr-pk-cert.c (renamed from pkix/gkr-pkix-cert.c) | 96 | ||||
-rw-r--r-- | pk/gkr-pk-cert.h | 64 | ||||
-rw-r--r-- | pk/gkr-pk-object-manager.c | 2 | ||||
-rw-r--r-- | pk/gkr-pk-object-storage.c | 4 | ||||
-rw-r--r-- | pk/gkr-pk-privkey.c | 4 | ||||
-rw-r--r-- | pk/gkr-pk-pubkey.c | 4 | ||||
-rw-r--r-- | pkix/Makefile.am | 1 | ||||
-rw-r--r-- | pkix/gkr-pkix-cert.h | 64 |
10 files changed, 131 insertions, 120 deletions
@@ -1,5 +1,16 @@ 2007-12-07 Stef Walter <stef@memberwebs.com> + * pk/gkr-pk-cert.[ch]: (moved from pkix/) + * pk/gkr-pk-object-manager.c: + * pk/gkr-pk-object-storage.c: + * pk/gkr-pk-privkey.c: + * pk/gkr-pk-pubkey.c: + * pk/Makefile.am: + * pkix/gkr-pkix-cert.[ch]: (moved to pk/) + * pkix/Makefile.am: Move the GkrPkixCert class from pkix to pk + +2007-12-07 Stef Walter <stef@memberwebs.com> + * configure.in: * daemon/Makefile.am: Only install system DBus service file if DBus is in use. Patch from Tom Parker. See bug #421554 diff --git a/pk/Makefile.am b/pk/Makefile.am index b283f18c..252845e0 100644 --- a/pk/Makefile.am +++ b/pk/Makefile.am @@ -12,6 +12,7 @@ INCLUDES= \ $(GLIB_CFLAGS) libgkr_pk_la_SOURCES = \ + gkr-pk-cert.c gkr-pk-cert.h \ gkr-pk-index.c gkr-pk-index.h \ gkr-pk-object.c gkr-pk-object.h \ gkr-pk-object-manager.c gkr-pk-object-manager.h \ diff --git a/pkix/gkr-pkix-cert.c b/pk/gkr-pk-cert.c index c079aba3..3f508b09 100644 --- a/pkix/gkr-pkix-cert.c +++ b/pk/gkr-pk-cert.c @@ -1,5 +1,5 @@ /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* gkr-pkix-cert.c - An x509 certificate +/* gkr-pk-cert.c - An x509 certificate Copyright (C) 2007 Stefan Walter @@ -23,17 +23,17 @@ #include "config.h" -#include "gkr-pkix-asn1.h" -#include "gkr-pkix-cert.h" -#include "gkr-pkix-der.h" +#include "gkr-pk-cert.h" +#include "gkr-pk-pubkey.h" +#include "gkr-pk-object.h" +#include "gkr-pk-object-manager.h" +#include "gkr-pk-util.h" #include "common/gkr-crypto.h" #include "common/gkr-location.h" -#include "pk/gkr-pk-pubkey.h" -#include "pk/gkr-pk-object.h" -#include "pk/gkr-pk-object-manager.h" -#include "pk/gkr-pk-util.h" +#include "pkix/gkr-pkix-asn1.h" +#include "pkix/gkr-pkix-der.h" #include <glib.h> #include <glib-object.h> @@ -53,14 +53,14 @@ enum { PROP_ASN1_TREE }; -struct _GkrPkixCertData { +struct _GkrPkCertData { ASN1_TYPE asn1; GkrPkPubkey *pubkey; guchar *raw; gsize n_raw; }; -G_DEFINE_TYPE (GkrPkixCert, gkr_pkix_cert, GKR_TYPE_PK_OBJECT); +G_DEFINE_TYPE (GkrPkCert, gkr_pk_cert, GKR_TYPE_PK_OBJECT); static GQuark OID_BASIC_CONSTRAINTS; @@ -80,7 +80,7 @@ init_quarks (void) } static GkrPkPubkey* -get_public_key (GkrPkixCert *cert) +get_public_key (GkrPkCert *cert) { gcry_sexp_t s_key = NULL; GkrPkObject *obj; @@ -118,17 +118,17 @@ get_public_key (GkrPkixCert *cert) */ static void -gkr_pkix_cert_init (GkrPkixCert *cert) +gkr_pk_cert_init (GkrPkCert *cert) { - cert->data = G_TYPE_INSTANCE_GET_PRIVATE (cert, GKR_TYPE_PKIX_CERT, GkrPkixCertData); - memset (cert->data, 0, sizeof (GkrPkixCertData)); + cert->data = G_TYPE_INSTANCE_GET_PRIVATE (cert, GKR_TYPE_PK_CERT, GkrPkCertData); + memset (cert->data, 0, sizeof (GkrPkCertData)); } static void -gkr_pkix_cert_get_property (GObject *obj, guint prop_id, GValue *value, +gkr_pk_cert_get_property (GObject *obj, guint prop_id, GValue *value, GParamSpec *pspec) { - GkrPkixCert *cert = GKR_PKIX_CERT (obj); + GkrPkCert *cert = GKR_PK_CERT (obj); switch (prop_id) { case PROP_ASN1_TREE: @@ -138,10 +138,10 @@ gkr_pkix_cert_get_property (GObject *obj, guint prop_id, GValue *value, } static void -gkr_pkix_cert_set_property (GObject *obj, guint prop_id, const GValue *value, +gkr_pk_cert_set_property (GObject *obj, guint prop_id, const GValue *value, GParamSpec *pspec) { - GkrPkixCert *cert = GKR_PKIX_CERT (obj); + GkrPkCert *cert = GKR_PK_CERT (obj); switch (prop_id) { case PROP_ASN1_TREE: @@ -162,7 +162,7 @@ gkr_pkix_cert_set_property (GObject *obj, guint prop_id, const GValue *value, } static CK_RV -gkr_pkix_cert_get_bool_attribute (GkrPkObject* obj, CK_ATTRIBUTE_PTR attr) +gkr_pk_cert_get_bool_attribute (GkrPkObject* obj, CK_ATTRIBUTE_PTR attr) { gboolean val; @@ -191,9 +191,9 @@ gkr_pkix_cert_get_bool_attribute (GkrPkObject* obj, CK_ATTRIBUTE_PTR attr) } static CK_RV -gkr_pkix_cert_get_ulong_attribute (GkrPkObject* obj, CK_ATTRIBUTE_PTR attr) +gkr_pk_cert_get_ulong_attribute (GkrPkObject* obj, CK_ATTRIBUTE_PTR attr) { - GkrPkixCert *cert = GKR_PKIX_CERT (obj); + GkrPkCert *cert = GKR_PK_CERT (obj); gulong val; guchar *extension; gsize n_extension; @@ -211,7 +211,7 @@ gkr_pkix_cert_get_ulong_attribute (GkrPkObject* obj, CK_ATTRIBUTE_PTR attr) break; case CKA_CERTIFICATE_CATEGORY: - extension = gkr_pkix_cert_get_extension (cert, OID_BASIC_CONSTRAINTS, &n_extension, NULL); + extension = gkr_pk_cert_get_extension (cert, OID_BASIC_CONSTRAINTS, &n_extension, NULL); if (!extension) return CKR_GENERAL_ERROR; @@ -235,9 +235,9 @@ gkr_pkix_cert_get_ulong_attribute (GkrPkObject* obj, CK_ATTRIBUTE_PTR attr) } static CK_RV -gkr_pkix_cert_get_data_attribute (GkrPkObject* obj, CK_ATTRIBUTE_PTR attr) +gkr_pk_cert_get_data_attribute (GkrPkObject* obj, CK_ATTRIBUTE_PTR attr) { - GkrPkixCert *cert = GKR_PKIX_CERT (obj); + GkrPkCert *cert = GKR_PK_CERT (obj); const guchar *cdata = NULL; gkrconstunique keyid; gchar *label; @@ -257,7 +257,7 @@ gkr_pkix_cert_get_data_attribute (GkrPkObject* obj, CK_ATTRIBUTE_PTR attr) return CKR_OK; case CKA_ID: - keyid = gkr_pkix_cert_get_keyid (cert); + keyid = gkr_pk_cert_get_keyid (cert); if (!keyid) return CKR_GENERAL_ERROR; data = (CK_VOID_PTR)gkr_unique_get_raw (keyid, &n_data); @@ -316,9 +316,9 @@ gkr_pkix_cert_get_data_attribute (GkrPkObject* obj, CK_ATTRIBUTE_PTR attr) } static CK_RV -gkr_pkix_cert_get_date_attribute (GkrPkObject* obj, CK_ATTRIBUTE_PTR attr) +gkr_pk_cert_get_date_attribute (GkrPkObject* obj, CK_ATTRIBUTE_PTR attr) { - GkrPkixCert *cert = GKR_PKIX_CERT (obj); + GkrPkCert *cert = GKR_PK_CERT (obj); time_t time; switch (attr->type) @@ -342,9 +342,9 @@ gkr_pkix_cert_get_date_attribute (GkrPkObject* obj, CK_ATTRIBUTE_PTR attr) } static void -gkr_pkix_cert_finalize (GObject *obj) +gkr_pk_cert_finalize (GObject *obj) { - GkrPkixCert *cert = GKR_PKIX_CERT (obj); + GkrPkCert *cert = GKR_PK_CERT (obj); g_free (cert->data->raw); cert->data->raw = NULL; @@ -353,12 +353,12 @@ gkr_pkix_cert_finalize (GObject *obj) asn1_delete_structure (&cert->data->asn1); cert->data->asn1 = NULL; - G_OBJECT_CLASS (gkr_pkix_cert_parent_class)->finalize (obj); + G_OBJECT_CLASS (gkr_pk_cert_parent_class)->finalize (obj); } static void -gkr_pkix_cert_class_init (GkrPkixCertClass *klass) +gkr_pk_cert_class_init (GkrPkCertClass *klass) { GObjectClass *gobject_class; GkrPkObjectClass *parent_class; @@ -367,34 +367,34 @@ gkr_pkix_cert_class_init (GkrPkixCertClass *klass) gobject_class = (GObjectClass*)klass; - gkr_pkix_cert_parent_class = g_type_class_peek_parent (klass); + gkr_pk_cert_parent_class = g_type_class_peek_parent (klass); parent_class = GKR_PK_OBJECT_CLASS (klass); - parent_class->get_bool_attribute = gkr_pkix_cert_get_bool_attribute; - parent_class->get_ulong_attribute = gkr_pkix_cert_get_ulong_attribute; - parent_class->get_data_attribute = gkr_pkix_cert_get_data_attribute; - parent_class->get_date_attribute = gkr_pkix_cert_get_date_attribute; + parent_class->get_bool_attribute = gkr_pk_cert_get_bool_attribute; + parent_class->get_ulong_attribute = gkr_pk_cert_get_ulong_attribute; + parent_class->get_data_attribute = gkr_pk_cert_get_data_attribute; + parent_class->get_date_attribute = gkr_pk_cert_get_date_attribute; - gobject_class->get_property = gkr_pkix_cert_get_property; - gobject_class->set_property = gkr_pkix_cert_set_property; - gobject_class->finalize = gkr_pkix_cert_finalize; + gobject_class->get_property = gkr_pk_cert_get_property; + gobject_class->set_property = gkr_pk_cert_set_property; + gobject_class->finalize = gkr_pk_cert_finalize; g_object_class_install_property (gobject_class, PROP_ASN1_TREE, g_param_spec_pointer ("asn1-tree", "ASN1 Certificate", "Raw Certificate Object", G_PARAM_READWRITE)); - g_type_class_add_private (gobject_class, sizeof (GkrPkixCertData)); + g_type_class_add_private (gobject_class, sizeof (GkrPkCertData)); } -GkrPkixCert* -gkr_pkix_cert_new (GQuark location, ASN1_TYPE asn1) +GkrPkCert* +gkr_pk_cert_new (GQuark location, ASN1_TYPE asn1) { - return g_object_new (GKR_TYPE_PKIX_CERT, "location", location, "asn1-tree", asn1, NULL); + return g_object_new (GKR_TYPE_PK_CERT, "location", location, "asn1-tree", asn1, NULL); } guchar* -gkr_pkix_cert_get_extension (GkrPkixCert *cert, GQuark oid, gsize *n_extension, - gboolean *critical) +gkr_pk_cert_get_extension (GkrPkCert *cert, GQuark oid, gsize *n_extension, + gboolean *critical) { GQuark exoid; gchar *name; @@ -403,7 +403,7 @@ gkr_pkix_cert_get_extension (GkrPkixCert *cert, GQuark oid, gsize *n_extension, guint i; int len, res; - g_return_val_if_fail (GKR_IS_PKIX_CERT (cert), NULL); + g_return_val_if_fail (GKR_IS_PK_CERT (cert), NULL); g_return_val_if_fail (oid, NULL); g_return_val_if_fail (n_extension, NULL); @@ -450,11 +450,11 @@ gkr_pkix_cert_get_extension (GkrPkixCert *cert, GQuark oid, gsize *n_extension, } gkrconstunique -gkr_pkix_cert_get_keyid (GkrPkixCert *cert) +gkr_pk_cert_get_keyid (GkrPkCert *cert) { GkrPkPubkey *pub; - g_return_val_if_fail (GKR_IS_PKIX_CERT (cert), NULL); + g_return_val_if_fail (GKR_IS_PK_CERT (cert), NULL); /* Access via public key */ pub = get_public_key (cert); diff --git a/pk/gkr-pk-cert.h b/pk/gkr-pk-cert.h new file mode 100644 index 00000000..50d88f3a --- /dev/null +++ b/pk/gkr-pk-cert.h @@ -0,0 +1,64 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ +/* gkr-pk-cert.h - An x509 certificate + + Copyright (C) 2007 Stefan Walter + + The Gnome Keyring Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The Gnome Keyring Library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the Gnome Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + + Author: Stef Walter <stef@memberwebs.com> +*/ + +#ifndef __GKR_PK_CERT_H__ +#define __GKR_PK_CERT_H__ + +#include "pk/gkr-pk-object.h" + +#include <libtasn1.h> + +G_BEGIN_DECLS + +#define GKR_TYPE_PK_CERT (gkr_pk_cert_get_type()) +#define GKR_PK_CERT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GKR_TYPE_PK_CERT, GkrPkCert)) +#define GKR_PK_CERT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GKR_TYPE_PK_CERT, GkrPkObject)) +#define GKR_IS_PK_CERT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GKR_TYPE_PK_CERT)) +#define GKR_IS_PK_CERT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GKR_TYPE_PK_CERT)) +#define GKR_PK_CERT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GKR_TYPE_PK_CERT, GkrPkCertClass)) + +typedef struct _GkrPkCert GkrPkCert; +typedef struct _GkrPkCertClass GkrPkCertClass; +typedef struct _GkrPkCertData GkrPkCertData; + +struct _GkrPkCert { + GkrPkObject parent; + GkrPkCertData *data; +}; + +struct _GkrPkCertClass { + GkrPkObjectClass parent_class; +}; + +GType gkr_pk_cert_get_type (void) G_GNUC_CONST; + +GkrPkCert* gkr_pk_cert_new (GQuark location, ASN1_TYPE asn1); + +guchar* gkr_pk_cert_get_extension (GkrPkCert *cert, GQuark oid, + gsize *n_extension, gboolean *critical); + +gkrconstunique gkr_pk_cert_get_keyid (GkrPkCert *cert); + +G_END_DECLS + +#endif /* __GKR_PK_CERT_H__ */ diff --git a/pk/gkr-pk-object-manager.c b/pk/gkr-pk-object-manager.c index 9925c759..82f4950d 100644 --- a/pk/gkr-pk-object-manager.c +++ b/pk/gkr-pk-object-manager.c @@ -23,6 +23,7 @@ #include "config.h" +#include "gkr-pk-cert.h" #include "gkr-pk-object-manager.h" #include "gkr-pk-object-storage.h" #include "gkr-pk-privkey.h" @@ -37,7 +38,6 @@ #include "pkcs11/pkcs11.h" -#include "pkix/gkr-pkix-cert.h" #include "pkix/gkr-pkix-parser.h" #include "ui/gkr-ask-daemon.h" diff --git a/pk/gkr-pk-object-storage.c b/pk/gkr-pk-object-storage.c index c14cc545..298e9e6b 100644 --- a/pk/gkr-pk-object-storage.c +++ b/pk/gkr-pk-object-storage.c @@ -23,6 +23,7 @@ #include "config.h" +#include "gkr-pk-cert.h" #include "gkr-pk-object-manager.h" #include "gkr-pk-object-storage.h" #include "gkr-pk-privkey.h" @@ -37,7 +38,6 @@ #include "pkcs11/pkcs11.h" -#include "pkix/gkr-pkix-cert.h" #include "pkix/gkr-pkix-parser.h" #include "ui/gkr-ask-daemon.h" @@ -281,7 +281,7 @@ prepare_object (GkrPkObjectStorage *storage, GQuark location, gtype = GKR_TYPE_PK_PRIVKEY; break; case GKR_PARSED_CERTIFICATE: - gtype = GKR_TYPE_PKIX_CERT; + gtype = GKR_TYPE_PK_CERT; break; default: g_return_val_if_reached (NULL); diff --git a/pk/gkr-pk-privkey.c b/pk/gkr-pk-privkey.c index bd7c6251..d1d05794 100644 --- a/pk/gkr-pk-privkey.c +++ b/pk/gkr-pk-privkey.c @@ -23,6 +23,7 @@ #include "config.h" +#include "gkr-pk-cert.h" #include "gkr-pk-index.h" #include "gkr-pk-object.h" #include "gkr-pk-object-manager.h" @@ -36,7 +37,6 @@ #include "common/gkr-unique.h" #include "pkix/gkr-pkix-der.h" -#include "pkix/gkr-pkix-cert.h" #include <glib.h> #include <glib-object.h> @@ -204,7 +204,7 @@ attribute_from_certificate (GkrPkPrivkey *key, CK_ATTRIBUTE_PTR attr) return CKR_GENERAL_ERROR; obj = GKR_PK_OBJECT (key); - crt = gkr_pk_object_manager_find_by_id (obj->manager, GKR_TYPE_PKIX_CERT, keyid); + crt = gkr_pk_object_manager_find_by_id (obj->manager, GKR_TYPE_PK_CERT, keyid); if (crt == NULL) return CKR_ATTRIBUTE_TYPE_INVALID; diff --git a/pk/gkr-pk-pubkey.c b/pk/gkr-pk-pubkey.c index aae54363..41f4d412 100644 --- a/pk/gkr-pk-pubkey.c +++ b/pk/gkr-pk-pubkey.c @@ -23,6 +23,7 @@ #include "config.h" +#include "gkr-pk-cert.h" #include "gkr-pk-index.h" #include "gkr-pk-object.h" #include "gkr-pk-object-manager.h" @@ -35,7 +36,6 @@ #include "common/gkr-unique.h" #include "pkix/gkr-pkix-der.h" -#include "pkix/gkr-pkix-cert.h" #include <glib.h> #include <glib-object.h> @@ -352,7 +352,7 @@ gkr_pk_pubkey_get_data_attribute (GkrPkObject* obj, CK_ATTRIBUTE_PTR attr) case CKA_SUBJECT: /* The subject of a related certificate */ - if (attribute_from_related (key, GKR_TYPE_PKIX_CERT, attr) == CKR_OK) + if (attribute_from_related (key, GKR_TYPE_PK_CERT, attr) == CKR_OK) return CKR_OK; /* Empty subject */ diff --git a/pkix/Makefile.am b/pkix/Makefile.am index 0ffd9ed2..5a9808a5 100644 --- a/pkix/Makefile.am +++ b/pkix/Makefile.am @@ -18,7 +18,6 @@ BUILT_SOURCES = \ libgkr_pkix_la_SOURCES = \ gkr-pkix-asn1.c gkr-pkix-asn1.h \ - gkr-pkix-cert.c gkr-pkix-cert.h \ gkr-pkix-der.c gkr-pkix-der.h \ gkr-pkix-openssl.c gkr-pkix-openssl.h \ gkr-pkix-parser.c gkr-pkix-parser.h \ diff --git a/pkix/gkr-pkix-cert.h b/pkix/gkr-pkix-cert.h deleted file mode 100644 index 67df28be..00000000 --- a/pkix/gkr-pkix-cert.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* gkr-pkix-cert.h - An x509 certificate - - Copyright (C) 2007 Stefan Walter - - The Gnome Keyring Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The Gnome Keyring Library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the Gnome Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. - - Author: Stef Walter <stef@memberwebs.com> -*/ - -#ifndef __GKR_PKIX_CERT_H__ -#define __GKR_PKIX_CERT_H__ - -#include "pk/gkr-pk-object.h" - -#include <libtasn1.h> - -G_BEGIN_DECLS - -#define GKR_TYPE_PKIX_CERT (gkr_pkix_cert_get_type()) -#define GKR_PKIX_CERT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GKR_TYPE_PKIX_CERT, GkrPkixCert)) -#define GKR_PKIX_CERT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GKR_TYPE_PKIX_CERT, GkrPkObject)) -#define GKR_IS_PKIX_CERT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GKR_TYPE_PKIX_CERT)) -#define GKR_IS_PKIX_CERT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GKR_TYPE_PKIX_CERT)) -#define GKR_PKIX_CERT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GKR_TYPE_PKIX_CERT, GkrPkixCertClass)) - -typedef struct _GkrPkixCert GkrPkixCert; -typedef struct _GkrPkixCertClass GkrPkixCertClass; -typedef struct _GkrPkixCertData GkrPkixCertData; - -struct _GkrPkixCert { - GkrPkObject parent; - GkrPkixCertData *data; -}; - -struct _GkrPkixCertClass { - GkrPkObjectClass parent_class; -}; - -GType gkr_pkix_cert_get_type (void) G_GNUC_CONST; - -GkrPkixCert* gkr_pkix_cert_new (GQuark location, ASN1_TYPE asn1); - -guchar* gkr_pkix_cert_get_extension (GkrPkixCert *cert, GQuark oid, - gsize *n_extension, gboolean *critical); - -gkrconstunique gkr_pkix_cert_get_keyid (GkrPkixCert *cert); - -G_END_DECLS - -#endif /* __GKR_PKIX_CERT_H__ */ |