22#ifndef FREERDP_LIB_CORE_CERTIFICATE_H 
   23#define FREERDP_LIB_CORE_CERTIFICATE_H 
   25#include <freerdp/crypto/crypto.h> 
   26#include <freerdp/crypto/certificate.h> 
   28#include <openssl/x509.h> 
   31#define CERT_CHAIN_VERSION_1 0x00000001 
   32#define CERT_CHAIN_VERSION_2 0x00000002 
   33#define CERT_CHAIN_VERSION_MASK 0x7FFFFFFF 
   34#define CERT_PERMANENTLY_ISSUED 0x00000000 
   35#define CERT_TEMPORARILY_ISSUED 0x80000000 
   37#define SIGNATURE_ALG_RSA 0x00000001 
   38#define KEY_EXCHANGE_ALG_RSA 0x00000001 
   40#define BB_RSA_KEY_BLOB 6 
   41#define BB_RSA_SIGNATURE_BLOB 8 
   43WINPR_ATTR_MALLOC(freerdp_certificate_free, 1)
 
   44FREERDP_LOCAL rdpCertificate* freerdp_certificate_new_from_x509(const X509* xcert,
 
   45                                                                const STACK_OF(X509) * chain);
 
   47FREERDP_LOCAL BOOL freerdp_certificate_read_server_cert(rdpCertificate* certificate,
 
   48                                                        const BYTE* server_cert, 
size_t length);
 
   49FREERDP_LOCAL SSIZE_T freerdp_certificate_write_server_cert(const rdpCertificate* certificate,
 
   52WINPR_ATTR_MALLOC(freerdp_certificate_free, 1)
 
   53FREERDP_LOCAL rdpCertificate* freerdp_certificate_clone(const rdpCertificate* certificate);
 
   55FREERDP_LOCAL const rdpCertInfo* freerdp_certificate_get_info(const rdpCertificate* certificate);
 
   60FREERDP_LOCAL X509* freerdp_certificate_get_x509(rdpCertificate* certificate);
 
   62FREERDP_LOCAL 
size_t freerdp_certificate_get_chain_len(rdpCertificate* certificate);
 
   63FREERDP_LOCAL X509* freerdp_certificate_get_chain_at(rdpCertificate* certificate, 
size_t offset);
 
   65FREERDP_LOCAL BOOL freerdp_certificate_publickey_encrypt(const rdpCertificate* cert,
 
   66                                                         const BYTE* input, 
size_t cbInput,
 
   67                                                         BYTE** poutput, 
size_t* pcbOutput);