21 #ifndef FREERDP_CRYPTO_CERTIFICATE_H
22 #define FREERDP_CRYPTO_CERTIFICATE_H
24 #include <winpr/crypto.h>
26 #include <freerdp/api.h>
33 enum FREERDP_CERT_PARAM
39 typedef struct rdp_certificate rdpCertificate;
41 FREERDP_API
void freerdp_certificate_free(rdpCertificate* certificate);
43 WINPR_ATTR_MALLOC(freerdp_certificate_free, 1)
44 FREERDP_API rdpCertificate* freerdp_certificate_new(
void);
46 WINPR_ATTR_MALLOC(freerdp_certificate_free, 1)
47 FREERDP_API rdpCertificate* freerdp_certificate_new_from_file(const
char* file);
49 WINPR_ATTR_MALLOC(freerdp_certificate_free, 1)
50 FREERDP_API rdpCertificate* freerdp_certificate_new_from_pem(const
char* pem);
52 WINPR_ATTR_MALLOC(freerdp_certificate_free, 1)
53 FREERDP_API rdpCertificate* freerdp_certificate_new_from_der(const BYTE* data,
size_t length);
55 FREERDP_API BOOL freerdp_certificate_is_rsa(const rdpCertificate* certificate);
57 WINPR_ATTR_MALLOC(free, 1)
58 FREERDP_API
char* freerdp_certificate_get_hash(const rdpCertificate* certificate,
59 const
char* hash,
size_t* plength);
61 WINPR_ATTR_MALLOC(free, 1)
62 FREERDP_API
char* freerdp_certificate_get_fingerprint_by_hash(const rdpCertificate* certificate,
65 WINPR_ATTR_MALLOC(free, 1)
67 freerdp_certificate_get_fingerprint_by_hash_ex(const rdpCertificate* certificate,
68 const
char* hash, BOOL separator);
70 WINPR_ATTR_MALLOC(free, 1)
71 FREERDP_API
char* freerdp_certificate_get_fingerprint(const rdpCertificate* certificate);
73 WINPR_ATTR_MALLOC(free, 1)
74 FREERDP_API
char* freerdp_certificate_get_pem(const rdpCertificate* certificate,
86 WINPR_ATTR_MALLOC(free, 1)
87 FREERDP_API
char* freerdp_certificate_get_pem_ex(const rdpCertificate* certificate,
88 size_t* pLength, BOOL withCertChain);
90 WINPR_ATTR_MALLOC(free, 1)
91 FREERDP_API BYTE* freerdp_certificate_get_der(const rdpCertificate* certificate,
94 WINPR_ATTR_MALLOC(free, 1)
95 FREERDP_API
char* freerdp_certificate_get_subject(const rdpCertificate* certificate);
97 WINPR_ATTR_MALLOC(free, 1)
98 FREERDP_API
char* freerdp_certificate_get_issuer(const rdpCertificate* certificate);
100 WINPR_ATTR_MALLOC(free, 1)
101 FREERDP_API
char* freerdp_certificate_get_upn(const rdpCertificate* certificate);
103 WINPR_ATTR_MALLOC(free, 1)
104 FREERDP_API
char* freerdp_certificate_get_email(const rdpCertificate* certificate);
113 WINPR_ATTR_MALLOC(free, 1)
114 FREERDP_API
char* freerdp_certificate_get_validity(const rdpCertificate* certificate,
117 FREERDP_API WINPR_MD_TYPE freerdp_certificate_get_signature_alg(const rdpCertificate* cert);
119 WINPR_ATTR_MALLOC(free, 1)
120 FREERDP_API
char* freerdp_certificate_get_common_name(const rdpCertificate* cert,
123 WINPR_ATTR_MALLOC(free, 1)
124 FREERDP_API
char** freerdp_certificate_get_dns_names(const rdpCertificate* cert,
size_t* pcount,
126 FREERDP_API
void freerdp_certificate_free_dns_names(
size_t count,
size_t* lengths,
129 FREERDP_API BOOL freerdp_certificate_check_eku(const rdpCertificate* certificate,
int nid);
131 FREERDP_API BOOL freerdp_certificate_get_public_key(const rdpCertificate* cert,
132 BYTE** PublicKey, DWORD* PublicKeyLength);
134 FREERDP_API BOOL freerdp_certificate_verify(const rdpCertificate* cert,
135 const
char* certificate_store_path);
137 FREERDP_API BOOL freerdp_certificate_is_rdp_security_compatible(const rdpCertificate* cert);
139 WINPR_ATTR_MALLOC(free, 1)
140 FREERDP_API
char* freerdp_certificate_get_param(const rdpCertificate* cert,
141 enum FREERDP_CERT_PARAM what,
size_t* psize);