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

Annotation of /trunk/Include/wptKeyserver.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (hide annotations)
Mon Jan 31 11:02:21 2005 UTC (20 years, 1 month ago) by twoaday
File MIME type: text/plain
File size: 3993 byte(s)
WinPT initial checkin.


1 twoaday 2 /* wptKeyserver.h - Keyserver headerfile
2     * Copyright (C) 2000-2005 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     #define DEF_HKP_KEYSERVER "http://subkeys.pgp.net"
28    
29     enum {
30     PROXY_USER = 0,
31     PROXY_PASS = 1,
32     };
33    
34     enum {
35     KSPROTO_HTTP = 0,
36     KSPROTO_LDAP = 1,
37     KSPROTO_FINGER = 2
38     };
39    
40     struct keyserver_ctx {
41     const char * name;
42     unsigned short port;
43     const char * pattern;
44     };
45    
46     struct keyserver {
47     char * name;
48     int port;
49     int used;
50     int proto;
51     };
52    
53     struct keyserver_proxy_ctx {
54     int port;
55     char * host;
56     char * user;
57     char * base64_user;
58     char * pass;
59     };
60    
61     struct keyserver_node {
62     keyserver_node * next;
63     keyserver host;
64     int used;
65     };
66    
67     struct keyserver_cfgfile {
68     keyserver_node * list;
69     keyserver_proxy_ctx proxy;
70     int nlist;
71     };
72    
73     #define MAX_KEYSERVERS 32
74     extern keyserver server[MAX_KEYSERVERS]; /* runtime initialized */
75     extern char * default_keyserver;
76     extern unsigned short default_keyserver_port;
77    
78     struct keyserver_key {
79     int bits;
80     char keyid[8+1];
81     char date[10+1];
82     char uid[384];
83     };
84    
85     const char* kserver_strerror( void );
86    
87     /*-- Winsock2 support --*/
88     int wsock_init( void );
89     void wsock_end( void );
90     const char* wsock_strerror( void );
91    
92     /*-- Keyserver config --*/
93     int kserver_load_conf (const char *conf);
94     const char* kserver_check_keyid( const char *keyid );
95     const char* kserver_get_proxy( int *r_port );
96     const char* kserver_get_proxy_info( int id );
97    
98     int kserver_read_config( const char *fname, keyserver_cfgfile **ret_cfg );
99     int kserver_write_config( const char *fname, keyserver_cfgfile *cfg );
100     void kserver_cfgfile_release( keyserver_cfgfile *cfg );
101     void kserver_change_proxy( keyserver_proxy_ctx *ctx );
102     void proxy_release( keyserver_proxy_ctx *ctx );
103     const char * kserver_get_hostname (int idx, int type, unsigned short *port);
104     void keyserver_set_default (const char *hostname, unsigned short port);
105     void set_default_kserver (void);
106    
107     /*-- General --*/
108     int kserver_check_inet_connection (void);
109     int kserver_connect (const char *hostname, unsigned short port, int *conn_fd);
110     int kserver_sendkey (const char *hostname, unsigned short port, const char *pubkey, int len);
111     int kserver_recvkey (const char *hostname, unsigned short port,
112     const char *keyid, char *key, int maxkeylen);
113    
114     int kserver_search_init(const char *hostname, unsigned short port, const char *keyid, int *conn_fd);
115     int kserver_search_chkresp (int conn_fd);
116     int kserver_search (int conn_fd, keyserver_key *key);
117    
118     /*-- Finger/LDAP Protocol --*/
119     int ldap_recvkey (const char *hostname, const char *keyid, char *key,
120     int maxkeylen);
121     int finger_recvkey (const char * host, const char * user, char * key,
122     int maxkeylen);
123    
124     /*-- Dialog support --*/
125     int hkp_send_key (HWND dlg, const char *kserver, unsigned short port, const char *pattern);
126     int hkp_recv_key (HWND dlg, const char *kserver, unsigned short port, const char *pattern,
127     int proto, int flags);
128    
129     #endif /* WPT_KEYSERVER_H_ */

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26