/[winpt]/trunk/Include/wptKeyserver.h
ViewVC logotype

Contents of /trunk/Include/wptKeyserver.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 226 - (show annotations)
Mon Jun 12 13:40:21 2006 UTC (18 years, 8 months ago) by twoaday
File MIME type: text/plain
File size: 4703 byte(s)
Prepare new release.


1 /* wptKeyserver.h - Keyserver headerfile
2 * Copyright (C) 2000-2006 Timo Schulz
3 *
4 * This file is part of WinPT.
5 *
6 * WinPT is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * WinPT is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with WinPT; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21 #ifndef WPT_KEYSERVER_H
22 #define WPT_KEYSERVER_H
23
24 #define HKP_PORT 11371 /* Horowitz Keyserver Protocol */
25 #define FINGER_PORT 79 /* Finger Protocol */
26 #define LDAP_PORT 389 /* Light Weight Dir Access Protocol. */
27
28 /* Default keyserver URL. */
29 #define DEF_HKP_KEYSERVER "http://subkeys.pgp.net"
30
31 /* Valid proxy protocols. */
32 enum proxy_proto_t {
33 PROXY_PROTO_NONE = 0,
34 PROXY_PROTO_HTTP,
35 PROXY_PROTO_SOCKS4,
36 PROXY_PROTO_SOCKS5
37 };
38
39 /* Valid proxy authentications. */
40 enum proxy_auth_t {
41 PROXY_AUTH_NONE = 0,
42 PROXY_AUTH_PLAIN = 2
43 };
44
45 /* Valid key server protocols. */
46 enum ksproto_t {
47 KSPROTO_HTTP = 0,
48 KSPROTO_LDAP = 1,
49 KSPROTO_FINGER = 2
50 };
51 #define KSPROTO_HKP 0 /* alias for http */
52
53 struct keyserver_ctx {
54 const char *name;
55 unsigned short port;
56 const char *pattern;
57 };
58
59 struct keyserver {
60 char *name; /* name of the keyserver. */
61 int port; /* used tcp port. */
62 int used; /* 1=entry will be used. */
63 int proto; /* protocol (0..2). */
64 };
65
66 /* Proxy configuration context. */
67 struct keyserver_proxy_s {
68 int proto; /* protocol. */
69 int port; /* server port. */
70 char *host; /* server host. */
71 int auth_mode; /* authentication mode. */
72 char *user; /* user. */
73 char *base64_user; /* base64 encoded user. */
74 char *pass; /* password. */
75 };
76 typedef struct keyserver_proxy_s *keyserver_proxy_t;
77
78 #define MAX_KEYSERVERS 32
79 extern keyserver server[MAX_KEYSERVERS]; /* runtime initialized */
80 extern char *default_keyserver;
81 extern WORD default_keyserver_port;
82 extern keyserver_proxy_s proxy;
83
84
85 struct keyserver_uid_s {
86 struct keyserver_uid_s *next;
87 long creation;
88 long expires;
89 char *uid;
90 };
91
92 struct keyserver_key_s {
93 int algo; /* pubkey algorithm. */
94 int bits; /* length of the key. */
95 char *keyid; /* keyid of the key. */
96 long creation; /* creation date. */
97 long expires;
98 struct keyserver_uid_s *uids; /* list ofuser-ids. */
99 const struct keyserver_uid_s *main_uid;
100 };
101
102
103 /*-- wptSOCKS.cpp --*/
104 int socks_handshake (keyserver_proxy_t ctx, int conn_fd,
105 const char *hostname, WORD port);
106
107 /*-- Winsock2 support --*/
108 int wsock_init (void);
109 void wsock_end (void);
110 const char* wsock_strerror (void);
111
112 /*-- Keyserver config --*/
113 int kserver_load_conf (const char *conf);
114 int kserver_save_conf (const char *conf);
115 const char* kserver_check_keyid (const char *keyid);
116 void kserver_proxy_release (keyserver_proxy_t ctx);
117 const char* kserver_get_hostname (int idx, int type, unsigned short *port);
118 void keyserver_set_default (const char *hostname, unsigned short port);
119 void kserver_set_socket_timeout (int nsec);
120
121 /*-- General --*/
122 int check_IP_or_hostname (const char *name);
123 const char* kserver_strerror (void);
124 int kserver_check_inet_connection (void);
125 int kserver_connect (const char *hostname, WORD port, int *conn_fd);
126 int kserver_sendkey (const char *hostname, WORD port,
127 const char *pubkey, int len);
128 int kserver_recvkey (const char *hostname, WORD port,
129 const char *keyid, char **r_key, int *r_keylen);
130 int kserver_search_begin (const char *hostname, WORD port,
131 const char *pattern, int *conn_fd, int *nkeys);
132 int kserver_search_next (int conn_fd, keyserver_key_s **r_key);
133 void kserver_search_end (int conn_fd);
134 void kserver_release_key (keyserver_key_s *key);
135
136 /*-- Finger/LDAP Protocol --*/
137 int ldap_recvkey (const char *hostname, const char *keyid,
138 char **r_key, int *r_keylen);
139 int finger_recvkey (const char *host, const char *user,
140 char **r_key, int *r_keylen);
141
142 /*-- Dialog support --*/
143 int hkp_send_key (HWND dlg, const char *kserver, unsigned short port,
144 const char *pattern);
145 int hkp_recv_key (HWND dlg, const char *kserver, unsigned short port,
146 const char *pattern, int proto, int flags);
147
148 #endif /* WPT_KEYSERVER_H */

Properties

Name Value
svn:eol-style native

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26