comparison cinst/windowsstore.c @ 1288:265583011f24

(issue123) Add possibility to open native certificate dialog This is currently only implemented for windows.
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 29 Sep 2014 13:12:58 +0200
parents 698b6a9bd75e
children 32a44cfb78c0
comparison
equal deleted inserted replaced
1287:d3d66d43365f 1288:265583011f24
13 #include "errorcodes.h" 13 #include "errorcodes.h"
14 #include "listutil.h" 14 #include "listutil.h"
15 #include "strhelp.h" 15 #include "strhelp.h"
16 #include "logging.h" 16 #include "logging.h"
17 #include "util.h" 17 #include "util.h"
18 18 #include "certhelp.h"
19 static PCCERT_CONTEXT
20 b64_to_cert_context(char *b64_data, size_t b64_size)
21 {
22 size_t buf_size = 0;
23 char *buf = NULL;
24 PCCERT_CONTEXT pCert = NULL;
25 int ret = -1;
26
27 ret = str_base64_decode (&buf, &buf_size, b64_data, b64_size);
28
29 if (ret != 0)
30 {
31 ERRORPRINTF ("decoding certificate failed\n");
32 return NULL;
33 }
34
35 pCert = CertCreateContext (CERT_STORE_CERTIFICATE_CONTEXT,
36 X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
37 (const PBYTE) buf,
38 (DWORD) buf_size,
39 0,
40 NULL);
41 free (buf); /* Windows has a copy */
42
43 if (pCert == NULL)
44 {
45 char *error = getLastErrorMsg();
46 if (error)
47 {
48 ERRORPRINTF ("Failed to create cert context: %s \n", error);
49 free (error);
50 }
51 return NULL;
52 }
53 return pCert;
54 }
55 19
56 void 20 void
57 do_remove(HCERTSTORE hStore, char **to_remove) 21 do_remove(HCERTSTORE hStore, char **to_remove)
58 { 22 {
59 PCCERT_CONTEXT pCert = NULL; 23 PCCERT_CONTEXT pCert = NULL;

http://wald.intevation.org/projects/trustbridge/