1 /*
2  * gnome-keyring
3  *
4  * Copyright (C) 2010 Collabora Ltd.
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 <http://www.gnu.org/licenses/>.
18  *
19  * Author: Stef Walter <stefw@collabora.co.uk>
20  */
21 
22 #if !defined (__GCR_INSIDE_HEADER__) && !defined (GCR_COMPILATION)
23 #error "Only <gcr/gcr.h> or <gcr/gcr-base.h> can be included directly."
24 #endif
25 
26 #ifndef GCRTYPES_H_
27 #define GCRTYPES_H_
28 
29 #include <glib.h>
30 
31 #ifndef GCK_API_SUBJECT_TO_CHANGE
32 
33 #ifndef __GI_SCANNER__
34 #define GCK_API_SUBJECT_TO_CHANGE 1
35 #define __GCR_DEFINED_GCK_SUBJECT_TO_CHANGE__ 1
36 #endif
37 
38 #endif
39 
40 #include <gck/gck.h>
41 
42 #ifdef __GCR_DEFINED_GCK_SUBJECT_TO_CHANGE__
43 #undef GCK_API_SUBJECT_TO_CHANGE
44 #endif
45 
46 G_BEGIN_DECLS
47 
48 #define             GCR_DATA_ERROR                    (gcr_data_error_get_domain ())
49 
50 GQuark 	            gcr_data_error_get_domain         (void) G_GNUC_CONST;
51 
52 typedef enum {
53 	GCR_ERROR_FAILURE = -1,
54 	GCR_ERROR_UNRECOGNIZED = 1,
55 	GCR_ERROR_CANCELLED = 2,
56 	GCR_ERROR_LOCKED = 3
57 } GcrDataError;
58 
59 typedef enum {
60 	GCR_FORMAT_ALL = -1,
61 	GCR_FORMAT_INVALID = 0,
62 
63 	GCR_FORMAT_DER_PRIVATE_KEY = 100,
64 	GCR_FORMAT_DER_PRIVATE_KEY_RSA,
65 	GCR_FORMAT_DER_PRIVATE_KEY_DSA,
66 	GCR_FORMAT_DER_PRIVATE_KEY_EC,
67 
68 	GCR_FORMAT_DER_SUBJECT_PUBLIC_KEY = 150,
69 
70 	GCR_FORMAT_DER_CERTIFICATE_X509 = 200,
71 
72 	GCR_FORMAT_DER_PKCS7 = 300,
73 
74 	GCR_FORMAT_DER_PKCS8 = 400,
75 	GCR_FORMAT_DER_PKCS8_PLAIN,
76 	GCR_FORMAT_DER_PKCS8_ENCRYPTED,
77 
78 	GCR_FORMAT_DER_PKCS10 = 450,
79 	GCR_FORMAT_DER_SPKAC = 455,
80 	GCR_FORMAT_BASE64_SPKAC,
81 
82 	GCR_FORMAT_DER_PKCS12 = 500,
83 
84 	GCR_FORMAT_OPENSSH_PUBLIC = 600,
85 
86 	GCR_FORMAT_OPENPGP_PACKET = 700,
87 	GCR_FORMAT_OPENPGP_ARMOR,
88 
89 	GCR_FORMAT_PEM = 1000,
90 	GCR_FORMAT_PEM_PRIVATE_KEY_RSA,
91 	GCR_FORMAT_PEM_PRIVATE_KEY_DSA,
92 	GCR_FORMAT_PEM_CERTIFICATE_X509,
93 	GCR_FORMAT_PEM_PKCS7,
94 	GCR_FORMAT_PEM_PKCS8_PLAIN,
95 	GCR_FORMAT_PEM_PKCS8_ENCRYPTED,
96 	GCR_FORMAT_PEM_PKCS12,
97 	GCR_FORMAT_PEM_PRIVATE_KEY,
98 	GCR_FORMAT_PEM_PKCS10,
99 	GCR_FORMAT_PEM_PRIVATE_KEY_EC,
100 	GCR_FORMAT_PEM_PUBLIC_KEY,
101 } GcrDataFormat;
102 
103 /*
104  * Special PKCS#11 style attributes that we use internally in GCR.
105  * These are used by GcrParser the most
106  */
107 
108 enum {
109 	/* An object class representing GcrRecord/gnupg-colons style data */
110 	CKO_GCR_GNUPG_RECORDS = (CKO_VENDOR_DEFINED | 0x47435200UL /* GCR0 */),
111 
112 	CKO_GCR_CERTIFICATE_REQUEST,
113 	CKA_GCR_CERTIFICATE_REQUEST_TYPE,
114 };
115 
116 enum {
117 	CKQ_GCR_PKCS10 = 1,
118 	CKQ_GCR_SPKAC
119 };
120 
121 G_END_DECLS
122 
123 #endif /* GCRTYPES_H_ */
124