Mercurial > pidgin.yaz
annotate libpurple/certificate.h @ 18936:895831f93380
- Documentation correction
author | William Ehlhardt <williamehlhardt@gmail.com> |
---|---|
date | Fri, 22 Jun 2007 03:33:52 +0000 |
parents | 04be1b885ef3 |
children | eac58c6caae7 |
rev | line source |
---|---|
17638
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
1 /** |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
2 * @file certificate.h Public-Key Certificate API |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
3 * @ingroup core |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
4 */ |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
5 |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
6 /* |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
7 * |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
8 * purple |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
9 * |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
10 * Purple is the legal property of its developers, whose names are too numerous |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
11 * to list here. Please refer to the COPYRIGHT file distributed with this |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
12 * source distribution. |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
13 * |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
14 * This program is free software; you can redistribute it and/or modify |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
15 * it under the terms of the GNU General Public License as published by |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
16 * the Free Software Foundation; either version 2 of the License, or |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
17 * (at your option) any later version. |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
18 * |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
19 * This program is distributed in the hope that it will be useful, |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
22 * GNU General Public License for more details. |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
23 * |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
24 * You should have received a copy of the GNU General Public License |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
25 * along with this program; if not, write to the Free Software |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
27 */ |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
28 |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
29 #ifndef _PURPLE_CERTIFICATE_H |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
30 #define _PURPLE_CERTIFICATE_H |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
31 |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
32 #include <glib.h> |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
33 |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
34 #ifdef __cplusplus |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
35 extern "C" { |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
36 #endif /* __cplusplus */ |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
37 |
18928
299022c9b32d
- More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18926
diff
changeset
|
38 |
299022c9b32d
- More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18926
diff
changeset
|
39 typedef enum |
299022c9b32d
- More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18926
diff
changeset
|
40 { |
299022c9b32d
- More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18926
diff
changeset
|
41 PURPLE_CERTIFICATE_INVALID = 0, |
299022c9b32d
- More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18926
diff
changeset
|
42 PURPLE_CERTIFICATE_VALID = 1 |
299022c9b32d
- More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18926
diff
changeset
|
43 } PurpleCertificateVerificationStatus; |
299022c9b32d
- More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18926
diff
changeset
|
44 |
18189
030a2209ae96
- Style issues
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18188
diff
changeset
|
45 typedef struct _PurpleCertificate PurpleCertificate; |
030a2209ae96
- Style issues
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18188
diff
changeset
|
46 typedef struct _PurpleCertificateScheme PurpleCertificateScheme; |
18928
299022c9b32d
- More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18926
diff
changeset
|
47 typedef struct _PurpleCertificateVerifier PurpleCertificateVerifier; |
299022c9b32d
- More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18926
diff
changeset
|
48 typedef struct _PurpleCertificateVerificationRequest PurpleCertificateVerificationRequest; |
17638
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
49 |
17641
55a0b0a42000
- Exposed the _Certificate struct definition in certificate.h
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17640
diff
changeset
|
50 /** A certificate instance |
55a0b0a42000
- Exposed the _Certificate struct definition in certificate.h
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17640
diff
changeset
|
51 * |
55a0b0a42000
- Exposed the _Certificate struct definition in certificate.h
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17640
diff
changeset
|
52 * An opaque data structure representing a single certificate under some |
55a0b0a42000
- Exposed the _Certificate struct definition in certificate.h
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17640
diff
changeset
|
53 * CertificateScheme |
55a0b0a42000
- Exposed the _Certificate struct definition in certificate.h
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17640
diff
changeset
|
54 */ |
18189
030a2209ae96
- Style issues
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18188
diff
changeset
|
55 struct _PurpleCertificate |
17641
55a0b0a42000
- Exposed the _Certificate struct definition in certificate.h
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17640
diff
changeset
|
56 { |
55a0b0a42000
- Exposed the _Certificate struct definition in certificate.h
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17640
diff
changeset
|
57 /** Scheme this certificate is under */ |
18189
030a2209ae96
- Style issues
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18188
diff
changeset
|
58 PurpleCertificateScheme * scheme; |
17641
55a0b0a42000
- Exposed the _Certificate struct definition in certificate.h
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17640
diff
changeset
|
59 /** Opaque pointer to internal data */ |
55a0b0a42000
- Exposed the _Certificate struct definition in certificate.h
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17640
diff
changeset
|
60 gpointer data; |
55a0b0a42000
- Exposed the _Certificate struct definition in certificate.h
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17640
diff
changeset
|
61 }; |
55a0b0a42000
- Exposed the _Certificate struct definition in certificate.h
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17640
diff
changeset
|
62 |
17638
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
63 /** A certificate type |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
64 * |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
65 * A CertificateScheme must implement all of the fields in the structure, |
18936
895831f93380
- Documentation correction
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18934
diff
changeset
|
66 * and register it using purple_certificate_register_scheme() |
17638
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
67 * |
17640
945b60f02767
- Fixed a comment
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17638
diff
changeset
|
68 * There may be only ONE CertificateScheme provided for each certificate |
945b60f02767
- Fixed a comment
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17638
diff
changeset
|
69 * type, as specified by the "name" field. |
17638
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
70 */ |
18189
030a2209ae96
- Style issues
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18188
diff
changeset
|
71 struct _PurpleCertificateScheme |
17638
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
72 { |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
73 /** Name of the certificate type |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
74 * ex: "x509", "pgp", etc. |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
75 * This must be globally unique - you may not register more than one |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
76 * CertificateScheme of the same name at a time. |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
77 */ |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
78 gchar * name; |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
79 |
18188
e6271671eb24
- Expose some more functions in the x509 CertificateScheme. Doesn't
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17641
diff
changeset
|
80 /** User-friendly name for this type |
e6271671eb24
- Expose some more functions in the x509 CertificateScheme. Doesn't
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17641
diff
changeset
|
81 * ex: N_("X.509 Certificates") |
18928
299022c9b32d
- More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18926
diff
changeset
|
82 * When this is displayed anywhere, it should be i18ned |
299022c9b32d
- More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18926
diff
changeset
|
83 * ex: _(scheme->name) |
18188
e6271671eb24
- Expose some more functions in the x509 CertificateScheme. Doesn't
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17641
diff
changeset
|
84 */ |
e6271671eb24
- Expose some more functions in the x509 CertificateScheme. Doesn't
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17641
diff
changeset
|
85 gchar * fullname; |
e6271671eb24
- Expose some more functions in the x509 CertificateScheme. Doesn't
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17641
diff
changeset
|
86 |
e6271671eb24
- Expose some more functions in the x509 CertificateScheme. Doesn't
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17641
diff
changeset
|
87 /** Imports a certificate from a file |
e6271671eb24
- Expose some more functions in the x509 CertificateScheme. Doesn't
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17641
diff
changeset
|
88 * |
e6271671eb24
- Expose some more functions in the x509 CertificateScheme. Doesn't
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17641
diff
changeset
|
89 * @param filename File to import the certificate from |
e6271671eb24
- Expose some more functions in the x509 CertificateScheme. Doesn't
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17641
diff
changeset
|
90 * @return Pointer to the newly allocated Certificate struct |
e6271671eb24
- Expose some more functions in the x509 CertificateScheme. Doesn't
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17641
diff
changeset
|
91 * or NULL on failure. |
e6271671eb24
- Expose some more functions in the x509 CertificateScheme. Doesn't
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17641
diff
changeset
|
92 */ |
18190
b2d110e9857f
- Eliminate compiler warning
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18189
diff
changeset
|
93 PurpleCertificate * (* import_certificate)(const gchar * filename); |
18188
e6271671eb24
- Expose some more functions in the x509 CertificateScheme. Doesn't
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17641
diff
changeset
|
94 |
e6271671eb24
- Expose some more functions in the x509 CertificateScheme. Doesn't
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17641
diff
changeset
|
95 /** Destroys and frees a Certificate structure |
e6271671eb24
- Expose some more functions in the x509 CertificateScheme. Doesn't
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17641
diff
changeset
|
96 * |
e6271671eb24
- Expose some more functions in the x509 CertificateScheme. Doesn't
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17641
diff
changeset
|
97 * Destroys a Certificate's internal data structures and calls |
e6271671eb24
- Expose some more functions in the x509 CertificateScheme. Doesn't
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17641
diff
changeset
|
98 * free(crt) |
e6271671eb24
- Expose some more functions in the x509 CertificateScheme. Doesn't
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17641
diff
changeset
|
99 * |
e6271671eb24
- Expose some more functions in the x509 CertificateScheme. Doesn't
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17641
diff
changeset
|
100 * @param crt Certificate instance to be destroyed. It WILL NOT be |
e6271671eb24
- Expose some more functions in the x509 CertificateScheme. Doesn't
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17641
diff
changeset
|
101 * destroyed if it is not of the correct |
e6271671eb24
- Expose some more functions in the x509 CertificateScheme. Doesn't
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17641
diff
changeset
|
102 * CertificateScheme. Can be NULL |
e6271671eb24
- Expose some more functions in the x509 CertificateScheme. Doesn't
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17641
diff
changeset
|
103 */ |
18189
030a2209ae96
- Style issues
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18188
diff
changeset
|
104 void (* destroy_certificate)(PurpleCertificate * crt); |
18934
04be1b885ef3
- Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18933
diff
changeset
|
105 |
04be1b885ef3
- Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18933
diff
changeset
|
106 /** |
04be1b885ef3
- Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18933
diff
changeset
|
107 * Retrieves the certificate public key fingerprint using SHA1 |
04be1b885ef3
- Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18933
diff
changeset
|
108 * |
04be1b885ef3
- Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18933
diff
changeset
|
109 * @param crt Certificate instance |
04be1b885ef3
- Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18933
diff
changeset
|
110 * @return Binary representation of SHA1 hash |
04be1b885ef3
- Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18933
diff
changeset
|
111 */ |
04be1b885ef3
- Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18933
diff
changeset
|
112 GByteArray * (* get_fingerprint_sha1)(PurpleCertificate *crt); |
04be1b885ef3
- Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18933
diff
changeset
|
113 |
04be1b885ef3
- Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18933
diff
changeset
|
114 /** |
04be1b885ef3
- Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18933
diff
changeset
|
115 * Reads "who the certificate is assigned to" |
04be1b885ef3
- Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18933
diff
changeset
|
116 * |
04be1b885ef3
- Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18933
diff
changeset
|
117 * For SSL X.509 certificates, this is something like |
04be1b885ef3
- Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18933
diff
changeset
|
118 * "gmail.com" or "jabber.org" |
04be1b885ef3
- Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18933
diff
changeset
|
119 * |
04be1b885ef3
- Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18933
diff
changeset
|
120 * @param crt Certificate instance |
04be1b885ef3
- Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18933
diff
changeset
|
121 * @return Newly allocated string specifying "whose certificate this |
04be1b885ef3
- Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18933
diff
changeset
|
122 * is" |
04be1b885ef3
- Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18933
diff
changeset
|
123 */ |
04be1b885ef3
- Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18933
diff
changeset
|
124 gchar * (* get_certificate_subject)(PurpleCertificate *crt); |
04be1b885ef3
- Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18933
diff
changeset
|
125 |
04be1b885ef3
- Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18933
diff
changeset
|
126 /** |
04be1b885ef3
- Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18933
diff
changeset
|
127 * Retrieves a unique certificate identifier |
04be1b885ef3
- Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18933
diff
changeset
|
128 * |
04be1b885ef3
- Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18933
diff
changeset
|
129 * @param crt Certificate instance |
04be1b885ef3
- Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18933
diff
changeset
|
130 * @return Newly allocated string that can be used to uniquely |
04be1b885ef3
- Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18933
diff
changeset
|
131 * identify the certificate. |
04be1b885ef3
- Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18933
diff
changeset
|
132 */ |
04be1b885ef3
- Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18933
diff
changeset
|
133 gchar * (* get_unique_id)(PurpleCertificate *crt); |
04be1b885ef3
- Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18933
diff
changeset
|
134 |
04be1b885ef3
- Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18933
diff
changeset
|
135 /** |
04be1b885ef3
- Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18933
diff
changeset
|
136 * Retrieves a unique identifier for the certificate's issuer |
04be1b885ef3
- Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18933
diff
changeset
|
137 * |
04be1b885ef3
- Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18933
diff
changeset
|
138 * @param crt Certificate instance |
04be1b885ef3
- Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18933
diff
changeset
|
139 * @return Newly allocated string that can be used to uniquely |
04be1b885ef3
- Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18933
diff
changeset
|
140 * identify the issuer's certificate. |
04be1b885ef3
- Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18933
diff
changeset
|
141 */ |
04be1b885ef3
- Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18933
diff
changeset
|
142 gchar * (* get_issuer_unique_id)(PurpleCertificate *crt); |
04be1b885ef3
- Add more to the Certificate struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18933
diff
changeset
|
143 |
18188
e6271671eb24
- Expose some more functions in the x509 CertificateScheme. Doesn't
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17641
diff
changeset
|
144 |
17638
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
145 /* TODO: Fill out this structure */ |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
146 }; |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
147 |
18928
299022c9b32d
- More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18926
diff
changeset
|
148 /** A set of operations used to provide logic for verifying a Certificate's |
299022c9b32d
- More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18926
diff
changeset
|
149 * authenticity. |
299022c9b32d
- More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18926
diff
changeset
|
150 */ |
299022c9b32d
- More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18926
diff
changeset
|
151 struct _PurpleCertificateVerifier |
299022c9b32d
- More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18926
diff
changeset
|
152 { |
299022c9b32d
- More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18926
diff
changeset
|
153 /** Scheme this Verifier operates on */ |
299022c9b32d
- More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18926
diff
changeset
|
154 PurpleCertificateScheme *scheme; |
299022c9b32d
- More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18926
diff
changeset
|
155 |
299022c9b32d
- More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18926
diff
changeset
|
156 /** Internal name used for lookups |
299022c9b32d
- More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18926
diff
changeset
|
157 * |
299022c9b32d
- More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18926
diff
changeset
|
158 * Case insensitive |
299022c9b32d
- More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18926
diff
changeset
|
159 */ |
299022c9b32d
- More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18926
diff
changeset
|
160 gchar * name; |
299022c9b32d
- More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18926
diff
changeset
|
161 }; |
299022c9b32d
- More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18926
diff
changeset
|
162 |
299022c9b32d
- More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18926
diff
changeset
|
163 /** Structure for a single certificate request |
299022c9b32d
- More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18926
diff
changeset
|
164 * |
299022c9b32d
- More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18926
diff
changeset
|
165 * Useful for keeping track of the state of a verification that involves |
299022c9b32d
- More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18926
diff
changeset
|
166 * several steps |
299022c9b32d
- More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18926
diff
changeset
|
167 */ |
299022c9b32d
- More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18926
diff
changeset
|
168 struct _PurpleCertificateVerificationRequest |
299022c9b32d
- More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18926
diff
changeset
|
169 { |
299022c9b32d
- More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18926
diff
changeset
|
170 /** Reference to the verification logic used */ |
299022c9b32d
- More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18926
diff
changeset
|
171 PurpleCertificateVerifier *verifier; |
299022c9b32d
- More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18926
diff
changeset
|
172 |
18931
e634122cec47
- purple_ssl_get_peer_certificates
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18928
diff
changeset
|
173 /** Certificate subject's name. |
e634122cec47
- purple_ssl_get_peer_certificates
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18928
diff
changeset
|
174 * |
e634122cec47
- purple_ssl_get_peer_certificates
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18928
diff
changeset
|
175 * For X.509 certificates, this is the Common Name |
e634122cec47
- purple_ssl_get_peer_certificates
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18928
diff
changeset
|
176 */ |
e634122cec47
- purple_ssl_get_peer_certificates
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18928
diff
changeset
|
177 gchar *subject_name; |
e634122cec47
- purple_ssl_get_peer_certificates
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18928
diff
changeset
|
178 |
e634122cec47
- purple_ssl_get_peer_certificates
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18928
diff
changeset
|
179 /** List of certificates in the chain to be verified (such as that returned by purple_ssl_get_peer_certificates ) |
18928
299022c9b32d
- More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18926
diff
changeset
|
180 * |
299022c9b32d
- More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18926
diff
changeset
|
181 * This is most relevant for X.509 certificates used in SSL sessions. |
18931
e634122cec47
- purple_ssl_get_peer_certificates
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18928
diff
changeset
|
182 * The list order should be: certificate, issuer, issuer's issuer, etc. |
18928
299022c9b32d
- More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18926
diff
changeset
|
183 */ |
299022c9b32d
- More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18926
diff
changeset
|
184 GList *cert_chain; |
299022c9b32d
- More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18926
diff
changeset
|
185 |
299022c9b32d
- More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18926
diff
changeset
|
186 /** Internal data used by the Verifier code */ |
299022c9b32d
- More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18926
diff
changeset
|
187 gpointer *data; |
299022c9b32d
- More API additions
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18926
diff
changeset
|
188 }; |
17638
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
189 |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
190 /*****************************************************************************/ |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
191 /** @name PurpleCertificate Subsystem API */ |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
192 /*****************************************************************************/ |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
193 /*@{*/ |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
194 |
18192
dc7e7b8bdc8c
- Add chunks of the certificate scheme registration interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18190
diff
changeset
|
195 /** Look up a registered CertificateScheme by name |
dc7e7b8bdc8c
- Add chunks of the certificate scheme registration interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18190
diff
changeset
|
196 * @param name The scheme name. Case insensitive. |
dc7e7b8bdc8c
- Add chunks of the certificate scheme registration interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18190
diff
changeset
|
197 * @return Pointer to the located Scheme, or NULL if it isn't found. |
dc7e7b8bdc8c
- Add chunks of the certificate scheme registration interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18190
diff
changeset
|
198 */ |
dc7e7b8bdc8c
- Add chunks of the certificate scheme registration interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18190
diff
changeset
|
199 PurpleCertificateScheme * |
dc7e7b8bdc8c
- Add chunks of the certificate scheme registration interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18190
diff
changeset
|
200 purple_certificate_find_scheme(const gchar *name); |
dc7e7b8bdc8c
- Add chunks of the certificate scheme registration interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18190
diff
changeset
|
201 |
dc7e7b8bdc8c
- Add chunks of the certificate scheme registration interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18190
diff
changeset
|
202 /** Register a CertificateScheme with libpurple |
dc7e7b8bdc8c
- Add chunks of the certificate scheme registration interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18190
diff
changeset
|
203 * |
dc7e7b8bdc8c
- Add chunks of the certificate scheme registration interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18190
diff
changeset
|
204 * No two schemes can be registered with the same name; this function enforces |
dc7e7b8bdc8c
- Add chunks of the certificate scheme registration interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18190
diff
changeset
|
205 * that. |
dc7e7b8bdc8c
- Add chunks of the certificate scheme registration interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18190
diff
changeset
|
206 * |
dc7e7b8bdc8c
- Add chunks of the certificate scheme registration interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18190
diff
changeset
|
207 * @param scheme Pointer to the scheme to register. |
dc7e7b8bdc8c
- Add chunks of the certificate scheme registration interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18190
diff
changeset
|
208 * @return TRUE if the scheme was successfully added, otherwise FALSE |
dc7e7b8bdc8c
- Add chunks of the certificate scheme registration interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18190
diff
changeset
|
209 */ |
dc7e7b8bdc8c
- Add chunks of the certificate scheme registration interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18190
diff
changeset
|
210 gboolean |
dc7e7b8bdc8c
- Add chunks of the certificate scheme registration interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18190
diff
changeset
|
211 purple_certificate_register_scheme(PurpleCertificateScheme *scheme); |
dc7e7b8bdc8c
- Add chunks of the certificate scheme registration interface
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18190
diff
changeset
|
212 |
18926
8c4d52bc0319
- Add unregister_scheme
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18192
diff
changeset
|
213 /** Unregister a CertificateScheme from libpurple |
8c4d52bc0319
- Add unregister_scheme
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18192
diff
changeset
|
214 * |
8c4d52bc0319
- Add unregister_scheme
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18192
diff
changeset
|
215 * @param scheme Scheme to unregister. |
8c4d52bc0319
- Add unregister_scheme
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18192
diff
changeset
|
216 * If the scheme is not registered, this is a no-op. |
8c4d52bc0319
- Add unregister_scheme
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18192
diff
changeset
|
217 * |
8c4d52bc0319
- Add unregister_scheme
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18192
diff
changeset
|
218 * @return TRUE if the unregister completed successfully |
8c4d52bc0319
- Add unregister_scheme
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18192
diff
changeset
|
219 */ |
8c4d52bc0319
- Add unregister_scheme
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18192
diff
changeset
|
220 gboolean |
8c4d52bc0319
- Add unregister_scheme
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18192
diff
changeset
|
221 purple_certificate_unregister_scheme(PurpleCertificateScheme *scheme); |
8c4d52bc0319
- Add unregister_scheme
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18192
diff
changeset
|
222 |
17638
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
223 /* TODO: ADD STUFF HERE */ |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
224 |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
225 /*@}*/ |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
226 |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
227 |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
228 #ifdef __cplusplus |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
229 } |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
230 #endif /* __cplusplus */ |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
231 |
668a294f9a72
- Added certificate.[ch] and got them integrated into the build
William Ehlhardt <williamehlhardt@gmail.com>
parents:
diff
changeset
|
232 #endif /* _PURPLE_CERTIFICATE_H */ |