32 |
#include "wptW32API.h" |
#include "wptW32API.h" |
33 |
#include "wptVersion.h" |
#include "wptVersion.h" |
34 |
#include "wptKeyEdit.h" |
#include "wptKeyEdit.h" |
35 |
|
#include "StringBuffer.h" |
36 |
|
|
37 |
|
|
38 |
/* Context to store associated data of the dialog. */ |
/* Context to store associated data of the dialog. */ |
47 |
static int |
static int |
48 |
do_check_key (gpgme_key_t key) |
do_check_key (gpgme_key_t key) |
49 |
{ |
{ |
50 |
int invalid; |
int invalid = key->expired; |
|
|
|
|
invalid = key->expired; |
|
51 |
if (!invalid) |
if (!invalid) |
52 |
invalid = key->revoked; |
invalid = key->revoked; |
53 |
return invalid; |
return invalid; |
78 |
return inf; |
return inf; |
79 |
} |
} |
80 |
|
|
81 |
|
/* Generate a temporary name for the photo ID */ |
82 |
int |
int |
83 |
get_photo_tmpname (gpgme_key_t key, char *buf, size_t buflen) |
get_photo_tmpname (gpgme_key_t key, char *buf, size_t buflen) |
84 |
{ |
{ |
101 |
char *photo_file, size_t photo_file_size, |
char *photo_file, size_t photo_file_size, |
102 |
gpgme_validity_t *r_valid) |
gpgme_validity_t *r_valid) |
103 |
{ |
{ |
104 |
FILE *fp; |
const BYTE *img = key->ext->attrib.d; |
105 |
const BYTE *img; |
DWORD imglen = key->ext->attrib.len; |
|
DWORD imglen; |
|
|
|
|
|
img = key->ext->attrib.d; |
|
|
imglen = key->ext->attrib.len; |
|
106 |
if (img && !key->ext->attrib.validity) |
if (img && !key->ext->attrib.validity) |
107 |
get_uat_validity (key->ctx->subkeys->keyid, |
get_uat_validity (key->ctx->subkeys->keyid, |
108 |
&key->ext->attrib.validity); |
&key->ext->attrib.validity); |
113 |
return -1; |
return -1; |
114 |
|
|
115 |
get_photo_tmpname (key->ctx, photo_file, photo_file_size); |
get_photo_tmpname (key->ctx, photo_file, photo_file_size); |
116 |
fp = fopen (photo_file, "wb"); |
FILE *fp = fopen (photo_file, "wb"); |
117 |
if (fp != NULL) { |
if (fp == NULL) |
118 |
const int pos = 16; |
return -1; |
|
fwrite (img + pos, 1, imglen - pos, fp); |
|
|
fclose (fp); |
|
|
return 0; |
|
|
} |
|
119 |
|
|
120 |
return -1; |
const int HEADER_OFF = 16; |
121 |
|
fwrite (img + HEADER_OFF, 1, imglen - HEADER_OFF, fp); |
122 |
|
fclose (fp); |
123 |
|
return 0; |
124 |
} |
} |
125 |
|
|
126 |
|
|
242 |
{ |
{ |
243 |
winpt_key_t k = (winpt_key_t)lparam; |
winpt_key_t k = (winpt_key_t)lparam; |
244 |
assert (k != NULL); |
assert (k != NULL); |
245 |
SetWindowText (dlg, _("Key Properties")); |
|
246 |
|
StringBuffer s = _("Key Properties"); |
247 |
|
if (k->ext->key->revoked) |
248 |
|
s += " - REVOKED KEY"; |
249 |
|
|
250 |
|
SetWindowText (dlg, s.getBuffer()); |
251 |
SetDlgItemText (dlg, IDC_KEYPROPS_OT_CHANGE, _("&Change")); |
SetDlgItemText (dlg, IDC_KEYPROPS_OT_CHANGE, _("&Change")); |
252 |
SetDlgItemText (dlg, IDC_KEYPROPS_REVOKERS, _("&Revokers")); |
SetDlgItemText (dlg, IDC_KEYPROPS_REVOKERS, _("&Revokers")); |
253 |
SetDlgItemText (dlg, IDC_KEYPROPS_CHANGE_PWD, _("Change &Password")); |
SetDlgItemText (dlg, IDC_KEYPROPS_CHANGE_PWD, _("Change &Password")); |