1 |
twoaday |
2 |
/* wptCard.h |
2 |
|
|
* Copyright (C) 2003, 2004, 2005 Timo Schulz |
3 |
|
|
* |
4 |
|
|
* This file is part of WinPT. |
5 |
|
|
* |
6 |
|
|
* WinPT is free software; you can redistribute it and/or modify |
7 |
|
|
* it under the terms of the GNU General Public License as published by |
8 |
|
|
* the Free Software Foundation; either version 2 of the License, or |
9 |
|
|
* (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 |
14 |
|
|
* GNU 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 |
|
|
#ifndef WPT_CARD_H |
21 |
|
|
#define WPT_CARD_H |
22 |
|
|
|
23 |
twoaday |
23 |
/* Existing card flags. */ |
24 |
twoaday |
2 |
enum { |
25 |
twoaday |
23 |
GPG_CARDFLAG_NONE = 0, |
26 |
|
|
GPG_CARDFLAG_REPLACE = 1, /* replace existing keys. */ |
27 |
|
|
GPG_CARDFLAG_BAKENC = 2 /* backup encryption key. */ |
28 |
|
|
}; |
29 |
|
|
|
30 |
twoaday |
26 |
/* Symbolic PIN ids */ |
31 |
twoaday |
23 |
enum { |
32 |
twoaday |
26 |
CARD_ADMIN_PIN, |
33 |
|
|
CARD_USER_PIN |
34 |
twoaday |
2 |
}; |
35 |
|
|
|
36 |
twoaday |
26 |
/* Card callback ids */ |
37 |
twoaday |
23 |
enum { |
38 |
twoaday |
26 |
CARD_CB_INS_CARD = 1, /* insert card */ |
39 |
twoaday |
23 |
}; |
40 |
twoaday |
2 |
|
41 |
|
|
|
42 |
twoaday |
26 |
/* openpgp card context. */ |
43 |
|
|
struct gpg_card_s { |
44 |
|
|
char *aid; /* appID */ |
45 |
|
|
char *card_type; |
46 |
|
|
char *version; /* version */ |
47 |
|
|
char *vendor; /* vendor */ |
48 |
|
|
char *serial; /* serial number */ |
49 |
|
|
char *surname; /* card users surname */ |
50 |
|
|
char *givenname; /* card users given name */ |
51 |
|
|
char *lang; /* language */ |
52 |
|
|
char sex; /* card users sex */ |
53 |
|
|
char *url; /* key url */ |
54 |
|
|
char *login; /* login data (name) */ |
55 |
|
|
int force_pin; |
56 |
|
|
char *maxpinlen[3]; |
57 |
|
|
int sig_count; /* signature counter */ |
58 |
|
|
char *ca_fpr[3]; /* CA fingerprints */ |
59 |
|
|
char *fpr[3]; /* key fingerprints */ |
60 |
|
|
long fpr_created[3];/* fingerprint timestamps. */ |
61 |
|
|
char *fpr_created_str[3]; |
62 |
|
|
}; |
63 |
|
|
typedef struct gpg_card_s *gpg_card_t; |
64 |
|
|
|
65 |
twoaday |
23 |
/* PIN callback context. */ |
66 |
twoaday |
2 |
struct pin_cb_ctx_s { |
67 |
twoaday |
23 |
int which; /* which command to execute. */ |
68 |
|
|
char *info_text; /* additional info text. */ |
69 |
|
|
char *apin; /* admin pin */ |
70 |
|
|
char *upin; /* user pin */ |
71 |
twoaday |
2 |
}; |
72 |
|
|
|
73 |
twoaday |
23 |
/* Card callback context. */ |
74 |
twoaday |
2 |
struct card_cb_s { |
75 |
twoaday |
23 |
int cancel; /* 1=user cancelled operation. */ |
76 |
twoaday |
2 |
int init; |
77 |
twoaday |
26 |
int code; /* 1=user need to insert card. */ |
78 |
|
|
char val[128]; /* application specific value. */ |
79 |
twoaday |
2 |
}; |
80 |
|
|
|
81 |
|
|
|
82 |
|
|
/*-- wptCardManager.cpp --*/ |
83 |
twoaday |
23 |
const char* card_callback (int code, void *opaque); |
84 |
twoaday |
2 |
|
85 |
twoaday |
23 |
#endif /*WPT_CARD_H*/ |