1 /*
2  * gnome-keyring
3  *
4  * Copyright (C) 2008 Stefan Walter
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as
8  * published by the Free Software Foundation; either version 2.1 of
9  * the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this program; if not, see
18  * <http://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef __GKM_CERTIFICATE_H__
22 #define __GKM_CERTIFICATE_H__
23 
24 #include <glib-object.h>
25 
26 #include "gkm-object.h"
27 #include "gkm-types.h"
28 
29 #define GKM_FACTORY_CERTIFICATE            (gkm_certificate_get_factory ())
30 
31 #define GKM_TYPE_CERTIFICATE               (gkm_certificate_get_type ())
32 #define GKM_CERTIFICATE(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKM_TYPE_CERTIFICATE, GkmCertificate))
33 #define GKM_CERTIFICATE_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GKM_TYPE_CERTIFICATE, GkmCertificateClass))
34 #define GKM_IS_CERTIFICATE(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKM_TYPE_CERTIFICATE))
35 #define GKM_IS_CERTIFICATE_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GKM_TYPE_CERTIFICATE))
36 #define GKM_CERTIFICATE_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GKM_TYPE_CERTIFICATE, GkmCertificateClass))
37 
38 typedef struct _GkmCertificateClass GkmCertificateClass;
39 typedef struct _GkmCertificatePrivate GkmCertificatePrivate;
40 
41 struct _GkmCertificate {
42 	GkmObject parent;
43 	GkmCertificatePrivate *pv;
44 };
45 
46 struct _GkmCertificateClass {
47 	GkmObjectClass parent_class;
48 };
49 
50 GType                      gkm_certificate_get_type               (void);
51 
52 GkmFactory*                gkm_certificate_get_factory            (void);
53 
54 gboolean                   gkm_certificate_calc_category          (GkmCertificate *self,
55                                                                    GkmSession *session,
56                                                                    CK_ULONG* category);
57 
58 GkmCertificateKey*         gkm_certificate_get_public_key         (GkmCertificate *self);
59 
60 GBytes *                   gkm_certificate_get_extension          (GkmCertificate *self,
61                                                                    GQuark oid,
62                                                                    gboolean *critical);
63 
64 const gchar*               gkm_certificate_get_label              (GkmCertificate *self);
65 
66 void                       gkm_certificate_set_label              (GkmCertificate *self,
67                                                                    const gchar *label);
68 
69 guchar*                    gkm_certificate_hash                   (GkmCertificate *self,
70                                                                    int hash_algo,
71                                                                    gsize *n_hash);
72 
73 gconstpointer              gkm_certificate_der_data               (GkmCertificate *self,
74                                                                    gsize *n_data);
75 
76 #endif /* __GKM_CERTIFICATE_H__ */
77