#define byte _byte #define int64 _int64 #define uint _uint #define set _set #include #if defined(__WIN32__) #include #endif #undef byte #undef int64 #undef uint #undef set import "ecere" /* static char * pass = "password"; static int password_cb(char *buf) //,int num, int rwflag,void *userdata) { // if(num 0; /* if(result) { if(!(SSL_CTX_use_certificate_chain_file(ctx, "client.pem"))) printf("Can't read certificate file"); SSL_CTX_set_default_passwd_cb(ctx, password_cb); if(!(SSL_CTX_use_PrivateKey_file(ctx, "client.pem", SSL_FILETYPE_PEM))) printf("Can't read key file"); if(!(SSL_CTX_load_verify_locations(ctx, "root.pem", 0))) printf("Can't read CA list"); if(SSL_get_verify_result(ssl)!=X509_V_OK) printf("Certificate doesn't verify"); peer=SSL_get_peer_certificate(ssl); X509_NAME_get_text_by_NID(X509_get_subject_name(peer), NID_commonName, peer_CN, 256); if(strcasecmp(peer_CN, host)) printf("Common name doesn't match host name"); } */ return result; } bool OnEstablishConnection(int s) { this.s = s; if(autoEstablish) return EstablishConnection(); else return true; } ~SSLSocket() { /*if(sbio) BIO_free(sbio); if(ssl) SSL_free(ssl);*/ if(ctx) SSL_CTX_free(ctx); } }