-
Notifications
You must be signed in to change notification settings - Fork 1
/
ExportCertificates.h
68 lines (56 loc) · 1.71 KB
/
ExportCertificates.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*++
Copyright 2009-2012 IPcom GmbH
Copyright 1995 - 2000 Microsoft Corporation
Module Name:
ExportCertificates.h
These functions dump the CA certificates from the Windows
certificate store into the file provided by the file handle
--*/
#pragma once
// We are using "insecure" string functions. But this
// shouldn't be a problem, as we carefully check the number of characters
// and null-terminate them always!
#pragma warning (disable:4996)
/*
* generate an absolute filename pointing to the user's temp directory
*
* filename: generated name of the absolute filename (with terminating 0) will
* be stored in this buffer
* len: length of buffer
* suffix: name of the file in the temp directory
*
* return value: 0 == OK, other values indicate error
*
* Note that the function does not verify that the path exists, nor
* does it test to see if the current process has any kind of access
* rights to the path.
*
*/
int getTemporaryFilename(char *filename, size_t len, const char* suffix);
/*
* generates(overwrites) a file and export certificates into this file
*
* filename: file which should be created
*
* return value: 0 == OK, other values indicate error
*/
int exportCertificates(const char* filename);
/*
* export certificates
*
* h: the already opened file handle
*
* return value: 0 == OK, other values indicate error
*/
int ExportCertificatesToFile(HANDLE h);
/*
* export certificates
*
* binary: binary data which should be encoded
* len: length of binary data
*
* return value: pointer to a allocated buffer with the base64 string, NULL on errors
*
* NOTE: the returned buffer must be freed with LocalFree().
*/
char * base64_Encode(BYTE const* binary, DWORD len);