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

Annotation of /trunk/Include/wptKeyserver.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 23 - (hide annotations)
Fri Sep 30 10:10:16 2005 UTC (19 years, 5 months ago) by twoaday
File MIME type: text/plain
File size: 4443 byte(s)
Almost finished phase 1 of the WinPT GPGME port.
Still need more cleanup, comments and tests.


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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26