[trust-prompt] Add certificate viewer and "issuer*" parameters
[platform/upstream/evolution-data-server.git] / modules / trust-prompt / e-asn1-object.h
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU Lesser General Public
4  * License as published by the Free Software Foundation; either
5  * version 2 of the License, or (at your option) version 3.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
10  * Lesser General Public License for more details.
11  *
12  * You should have received a copy of the GNU Lesser General Public
13  * License along with the program; if not, see <http://www.gnu.org/licenses/>
14  *
15  *
16  * Authors:
17  *              Chris Toshok <toshok@ximian.com>
18  *
19  * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
20  */
21
22 #ifndef E_ASN1_OBJECT_H
23 #define E_ASN1_OBJECT_H
24
25 #include <glib-object.h>
26
27 #include <cert.h>
28
29 #define E_TYPE_ASN1_OBJECT            (e_asn1_object_get_type ())
30 #define E_ASN1_OBJECT(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_ASN1_OBJECT, EASN1Object))
31 #define E_ASN1_OBJECT_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_ASN1_OBJECT, EASN1ObjectClass))
32 #define E_IS_ASN1_OBJECT(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_ASN1_OBJECT))
33 #define E_IS_ASN1_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_ASN1_OBJECT))
34 #define E_ASN1_OBJECT_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), E_TYPE_ASN1_OBJECT, EASN1ObjectClass))
35
36 typedef struct _EASN1Object EASN1Object;
37 typedef struct _EASN1ObjectClass EASN1ObjectClass;
38 typedef struct _EASN1ObjectPrivate EASN1ObjectPrivate;
39
40 enum {
41         /*
42          *  Identifiers for the possible types of object.
43          */
44         E_ASN1_OBJECT_TYPE_END_CONTENTS     = 0,
45         E_ASN1_OBJECT_TYPE_BOOLEAN          = 1,
46         E_ASN1_OBJECT_TYPE_INTEGER          = 2,
47         E_ASN1_OBJECT_TYPE_BIT_STRING       = 3,
48         E_ASN1_OBJECT_TYPE_OCTET_STRING     = 4,
49         E_ASN1_OBJECT_TYPE_NULL             = 5,
50         E_ASN1_OBJECT_TYPE_OBJECT_ID        = 6,
51         E_ASN1_OBJECT_TYPE_ENUMERATED       = 10,
52         E_ASN1_OBJECT_TYPE_UTF8_STRING      = 12,
53         E_ASN1_OBJECT_TYPE_SEQUENCE         = 16,
54         E_ASN1_OBJECT_TYPE_SET              = 17,
55         E_ASN1_OBJECT_TYPE_PRINTABLE_STRING = 19,
56         E_ASN1_OBJECT_TYPE_T61_STRING       = 20,
57         E_ASN1_OBJECT_TYPE_IA5_STRING       = 22,
58         E_ASN1_OBJECT_TYPE_UTC_TIME         = 23,
59         E_ASN1_OBJECT_TYPE_GEN_TIME         = 24,
60         E_ASN1_OBJECT_TYPE_VISIBLE_STRING   = 26,
61         E_ASN1_OBJECT_TYPE_UNIVERSAL_STRING = 28,
62         E_ASN1_OBJECT_TYPE_BMP_STRING       = 30,
63         E_ASN1_OBJECT_TYPE_HIGH_TAG_NUMBER  = 31,
64         E_ASN1_OBJECT_TYPE_CONTEXT_SPECIFIC = 32,
65         E_ASN1_OBJECT_TYPE_APPLICATION      = 33,
66         E_ASN1_OBJECT_TYPE_PRIVATE          = 34
67 };
68
69 struct _EASN1Object {
70         GObject parent;
71
72         EASN1ObjectPrivate *priv;
73 };
74
75 struct _EASN1ObjectClass {
76         GObjectClass parent_class;
77
78         /* Padding for future expansion */
79         void (*_ecert_reserved0) (void);
80         void (*_ecert_reserved1) (void);
81         void (*_ecert_reserved2) (void);
82         void (*_ecert_reserved3) (void);
83         void (*_ecert_reserved4) (void);
84 };
85
86 GType           e_asn1_object_get_type                  (void);
87 EASN1Object *   e_asn1_object_new                       (void);
88 EASN1Object *   e_asn1_object_new_from_cert             (CERTCertificate *cert);
89
90 void            e_asn1_object_set_valid_container       (EASN1Object *obj,
91                                                          gboolean flag);
92 gboolean        e_asn1_object_is_valid_container        (EASN1Object *obj);
93 PRUint32        e_asn1_object_get_asn1_type             (EASN1Object *obj);
94 PRUint32        e_asn1_object_get_asn1_tag              (EASN1Object *obj);
95 GList *         e_asn1_object_get_children              (EASN1Object *obj);
96 void            e_asn1_object_append_child              (EASN1Object *parent,
97                                                          EASN1Object *child);
98 void            e_asn1_object_set_display_name          (EASN1Object *obj,
99                                                          const gchar *name);
100 const gchar *   e_asn1_object_get_display_name          (EASN1Object *obj);
101 void            e_asn1_object_set_display_value         (EASN1Object *obj,
102                                                          const gchar *value);
103 const gchar *   e_asn1_object_get_display_value         (EASN1Object *obj);
104
105 void            e_asn1_object_get_data                  (EASN1Object *obj,
106                                                          gchar **data,
107                                                          guint32 *len);
108
109 #endif /* E_ASN1_OBJECT_H */