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

Contents of /trunk/Include/wptKeyserver.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 180 - (show annotations)
Mon Mar 6 14:41:58 2006 UTC (18 years, 11 months ago) by twoaday
File MIME type: text/plain
File size: 4295 byte(s)
2006-02-27  Timo Schulz  <twoaday@freakmail.de>
 
        * wptSOCKS.cpp (socks_handshake): New.
        * wptMainProc.cpp (winpt_main_proc): A dbl-click forces
        the key manager in teh foreground if possible.
        * wptHotkey.cpp (hotkey_unregister): Unregister all hotkeys.
        * wptRegistry.cpp (get_reg_proxy_prefs,
        set_reg_proxy_prefs): Use directly the proxy context.
        Changed all callers.
        * wptProxySettingsDlg.cpp (init_proxy_protocols): New.
        (keyserver_proxy_dlg_proc): Use directly the proxy context.
        * wptKeyserver.cpp (kserver_connect): Better proxy support.
        (kserver_send_request, kserver_recvkey_request): Likewise.
        * wptKeyserverDlg.cpp (name_from_proto): New.
        (set_proxy): Adjusted for the new code.


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
27 /* Default keyserver URL. */
28 #define DEF_HKP_KEYSERVER "http://subkeys.pgp.net"
29
30 /* Valid proxy protocols. */
31 enum proxy_proto_t {
32 PROXY_PROTO_HTTP = 0,
33 PROXY_PROTO_SOCKS4,
34 PROXY_PROTO_SOCKS5
35 };
36
37 /* Valid proxy authentications. */
38 enum proxy_auth_t {
39 PROXY_AUTH_NONE = 0,
40 PROXY_AUTH_PLAIN = 2
41 };
42
43 /* Valid key server protocols. */
44 enum ksproto_t {
45 KSPROTO_HTTP = 0,
46 KSPROTO_LDAP = 1,
47 KSPROTO_FINGER = 2
48 };
49 #define KSPROTO_HKP 0 /* alias for http */
50
51 struct keyserver_ctx {
52 const char *name;
53 unsigned short port;
54 const char *pattern;
55 };
56
57 struct keyserver {
58 char *name; /* name of the keyserver. */
59 int port; /* used tcp port. */
60 int used; /* 1=entry will be used. */
61 int proto; /* protocol (0..2). */
62 };
63
64 /* Proxy configuration context. */
65 struct keyserver_proxy_s {
66 int proto; /* protocol. */
67 int port; /* server port. */
68 char *host; /* server host. */
69 int auth_mode; /* authentication mode. */
70 char *user; /* user. */
71 char *base64_user; /* base64 encoded user. */
72 char *pass; /* password. */
73 };
74 typedef struct keyserver_proxy_s *keyserver_proxy_t;
75
76 #define MAX_KEYSERVERS 32
77 extern keyserver server[MAX_KEYSERVERS]; /* runtime initialized */
78 extern char *default_keyserver;
79 extern WORD default_keyserver_port;
80 extern keyserver_proxy_s proxy;
81
82 struct keyserver_key {
83 int bits; /* length of the key. */
84 char keyid[8+1]; /* keyid of the key. */
85 char date[10+1]; /* date of creation. */
86 char uid[384]; /* primary user-id. */
87 };
88
89
90 /*-- wptSOCKS.cpp --*/
91 int socks_handshake (keyserver_proxy_t ctx, int conn_fd,
92 const char *hostname, WORD port);
93
94 /*-- Winsock2 support --*/
95 int wsock_init (void);
96 void wsock_end (void);
97 const char* wsock_strerror (void);
98
99 /*-- Keyserver config --*/
100 int kserver_load_conf (const char *conf);
101 int kserver_save_conf (const char *conf);
102 const char* kserver_check_keyid (const char *keyid);
103 void kserver_proxy_release (keyserver_proxy_t ctx);
104 const char* kserver_get_hostname (int idx, int type, unsigned short *port);
105 void keyserver_set_default (const char *hostname, unsigned short port);
106 void set_default_kserver (void);
107
108 /*-- General --*/
109 int check_IP_or_hostname (const char *name);
110 const char* kserver_strerror (void);
111 int kserver_check_inet_connection (void);
112 int kserver_connect (const char *hostname, WORD port, int *conn_fd);
113 int kserver_sendkey (const char *hostname, WORD port,
114 const char *pubkey, int len);
115 int kserver_recvkey (const char *hostname, WORD port,
116 const char *keyid, char *key, int maxkeylen);
117
118 int kserver_search_init(const char *hostname, WORD port,
119 const char *keyid, int *conn_fd);
120 int kserver_search_chkresp (int conn_fd);
121 int kserver_search (int conn_fd, keyserver_key *key);
122
123 /*-- Finger/LDAP Protocol --*/
124 int ldap_recvkey (const char *hostname, const char *keyid, char *key,
125 int maxkeylen);
126 int finger_recvkey (const char * host, const char * user, char * key,
127 int maxkeylen);
128
129 /*-- Dialog support --*/
130 int hkp_send_key (HWND dlg, const char *kserver, unsigned short port,
131 const char *pattern);
132 int hkp_recv_key (HWND dlg, const char *kserver, unsigned short port,
133 const char *pattern, int proto, int flags);
134
135 #endif /* WPT_KEYSERVER_H */

Properties

Name Value
svn:eol-style native

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26