FreeRDP
Loading...
Searching...
No Matches
x509_utils.h
1
22#ifndef FREERDP_LIB_X509_UTILS_H
23#define FREERDP_LIB_X509_UTILS_H
24
25#include <winpr/custom-crypto.h>
26
27#include <openssl/x509.h>
28
29#include <freerdp/api.h>
30
31#ifdef __cplusplus
32extern "C"
33{
34#endif
35
36 WINPR_ATTR_NODISCARD
37 FREERDP_LOCAL WINPR_MD_TYPE x509_utils_get_signature_alg(const X509* xcert);
38
39 WINPR_ATTR_MALLOC(free, 1)
40 FREERDP_LOCAL BYTE* x509_utils_get_hash(const X509* xcert, const char* hash, size_t* length);
41
42 WINPR_ATTR_MALLOC(free, 1)
43 FREERDP_LOCAL BYTE* x509_utils_to_pem(const X509* xcert, const STACK_OF(X509) * chain,
44 size_t* length);
45
46 WINPR_ATTR_MALLOC(free, 1)
47 FREERDP_LOCAL X509* x509_utils_from_pem(const char* data, size_t length, BOOL fromFile);
48
49 WINPR_ATTR_MALLOC(free, 1)
50 FREERDP_LOCAL char* x509_utils_get_subject(const X509* xcert);
51
52 WINPR_ATTR_MALLOC(free, 1)
53 FREERDP_LOCAL char* x509_utils_get_issuer(const X509* xcert);
54
55 WINPR_ATTR_MALLOC(free, 1)
56 FREERDP_LOCAL char* x509_utils_get_email(const X509* x509);
57
58 WINPR_ATTR_MALLOC(free, 1)
59 FREERDP_LOCAL char* x509_utils_get_upn(const X509* x509);
60
61 WINPR_ATTR_MALLOC(free, 1)
62 FREERDP_LOCAL char* x509_utils_get_date(const X509* x509, BOOL startDate);
63
64 WINPR_ATTR_MALLOC(free, 1)
65 FREERDP_LOCAL char* x509_utils_get_common_name(const X509* xcert, size_t* plength);
66
67 WINPR_ATTR_MALLOC(free, 1)
68 FREERDP_LOCAL char** x509_utils_get_dns_names(const X509* xcert, size_t* count,
69 size_t** pplengths);
70
71 FREERDP_LOCAL void x509_utils_dns_names_free(size_t count, size_t* lengths, char** dns_names);
72
73 WINPR_ATTR_MALLOC(free, 1)
74 FREERDP_LOCAL char** x509_utils_get_ip_names(const X509* xcert, size_t* count,
75 size_t** pplengths);
76
77 FREERDP_LOCAL void x509_utils_ip_names_free(size_t count, size_t* lengths, char** dns_names);
78
79 WINPR_ATTR_NODISCARD
80 FREERDP_LOCAL BOOL x509_utils_check_eku(const X509* xcert, int nid);
81
82 FREERDP_LOCAL void x509_utils_print_info(const X509* xcert);
83
84 WINPR_ATTR_NODISCARD
85 FREERDP_LOCAL BOOL x509_utils_verify(X509* xcert, STACK_OF(X509) * chain,
86 const char* certificate_store_path);
87
88 WINPR_ATTR_MALLOC(free, 1)
89 FREERDP_LOCAL char* x509_utils_bio_read(BIO* bio, size_t* plen);
90
91#ifdef __cplusplus
92}
93#endif
94
95#endif /* FREERDP_LIB_X509_UTILS_H */