您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ BIO_set_conn_hostname函数代码示例

51自学网 2021-06-01 19:50:17
  C++
这篇教程C++ BIO_set_conn_hostname函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中BIO_set_conn_hostname函数的典型用法代码示例。如果您正苦于以下问题:C++ BIO_set_conn_hostname函数的具体用法?C++ BIO_set_conn_hostname怎么用?C++ BIO_set_conn_hostname使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了BIO_set_conn_hostname函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: snprintf

BIO *Connect_SSL(char *hostname, int port){	//BIO *bio = NULL;	char bio_addr[BUF_MAX] = { 0 };		snprintf(bio_addr, sizeof(bio_addr), "%s:%d", hostname, port);		SSL_library_init();		SSL_CTX *ctx = SSL_CTX_new(SSLv23_client_method());	SSL *ssl = NULL;		bio = BIO_new_ssl_connect(ctx);	if (bio == NULL)	{		Error("BIO_new_ssl_connect");	}		BIO_get_ssl(bio, &ssl);	SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY);	BIO_set_conn_hostname(bio, bio_addr);		if (BIO_do_connect(bio) <= 0)	{		Error("SSL Unable to connect");	}	return bio;}
开发者ID:haxworx,项目名称:NodeInTheWhole,代码行数:29,


示例2: connect_encrypted

BIO* connect_encrypted(char* host_and_port, char* store_path, char store_type, SSL_CTX** ctx, SSL** ssl) {  BIO* bio = NULL;  int r = 0;  *ctx = SSL_CTX_new(SSLv23_client_method());  *ssl = NULL;  if (store_type == 'f')    r = SSL_CTX_load_verify_locations(*ctx, store_path, NULL);  else    r = SSL_CTX_load_verify_locations(*ctx, NULL, store_path);  if (r == 0) {    return NULL;  }  bio = BIO_new_ssl_connect(*ctx);  BIO_get_ssl(bio, ssl);  if (!(*ssl)) {    return NULL;  }  SSL_set_mode(*ssl, SSL_MODE_AUTO_RETRY);  BIO_set_conn_hostname(bio, host_and_port);  if (BIO_do_connect(bio) < 1) {    return NULL;  }  return bio;}
开发者ID:GitMirar,项目名称:heartbleed_exploit,代码行数:30,


示例3: opensslconnect

static Pfd*opensslconnect(char *host){	Pfd *pfd;	BIO *sbio;	SSL_CTX *ctx;	SSL *ssl;	static int didinit;	char buf[1024];	if(!didinit){		httpsinit();		didinit = 1;	}	ctx = SSL_CTX_new(SSLv23_client_method());	sbio = BIO_new_ssl_connect(ctx);	BIO_get_ssl(sbio, &ssl);	SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY);		snprint(buf, sizeof buf, "%s:https", host);	BIO_set_conn_hostname(sbio, buf);		if(BIO_do_connect(sbio) <= 0 || BIO_do_handshake(sbio) <= 0){		ERR_error_string_n(ERR_get_error(), buf, sizeof buf);		BIO_free_all(sbio);		werrstr("openssl: %s", buf);		return nil;	}	pfd = emalloc(sizeof *pfd);	pfd->sbio = sbio;	return pfd;}
开发者ID:00001,项目名称:plan9port,代码行数:34,


示例4: main

int main() {    SSL_load_error_strings();    ERR_load_BIO_strings();    OpenSSL_add_all_algorithms();        SSL_CTX *ctx = SSL_CTX_new(SSLv23_client_method());    if (ctx == NULL) {        printf("SSL_CTX_new err func:%s/n reaseon:%s", ERR_func_error_string(ERR_get_error()),               ERR_reason_error_string(ERR_get_error()));        exit(1);    }    //加载可信任证书库    if (0 == SSL_CTX_load_verify_locations(ctx, "./push_cer.pem", NULL)) {        printf("err func:%s/n reaseon:%s", ERR_func_error_string(ERR_get_error()),               ERR_reason_error_string(ERR_get_error()));        ERR_print_errors_fp(stdout);        exit(1);    }    //set BIO    BIO *bio = BIO_new_ssl_connect(ctx);    if (bio == NULL) {        printf("err func:%s/n", ERR_func_error_string(ERR_get_error()));        ERR_print_errors_fp(stdout);        exit(1);    }    SSL *ssl;    BIO_get_ssl(bio, &ssl);    SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY);    //open safe connect    BIO_set_conn_hostname(bio, "gateway.sandbox.push.apple.com:2195");    //verify connect ok    if (BIO_do_connect(bio) <= 0) {        ERR_print_errors_fp(stdout);        exit(1);    }    if (SSL_get_verify_result(ssl) != X509_V_OK) {        printf("SSL_get_verify_result not success/n");    }    char buf[MAXBUF];    char *json = "{/"aps/":{/"badge/":123}}";    sendPayload(bio, token, json, strlen(json));    int ret = BIO_read(bio, buf, MAXBUF);    if (ret <= 0) {        printf("BIO_read return 0/n");    }    SSL_CTX_free(ctx);    BIO_free_all(bio);    return 0;}
开发者ID:NEXUS1000,项目名称:Linux-learning,代码行数:58,


示例5: return

/*- * doConnection - make a connection * Args: *              scon    = earlier ssl connection for session id, or NULL * Returns: *              SSL *   = the connection pointer. */static SSL *doConnection(SSL *scon){    BIO *conn;    SSL *serverCon;    int width, i;    fd_set readfds;    if ((conn = BIO_new(BIO_s_connect())) == NULL)        return (NULL);/*      BIO_set_conn_port(conn,port);*/    BIO_set_conn_hostname(conn, host);    if (scon == NULL)        serverCon = SSL_new(tm_ctx);    else {        serverCon = scon;        SSL_set_connect_state(serverCon);    }    SSL_set_bio(serverCon, conn, conn);    /* ok, lets connect */    for (;;) {        i = SSL_connect(serverCon);        if (BIO_sock_should_retry(i)) {            BIO_printf(bio_err, "DELAY/n");            i = SSL_get_fd(serverCon);            width = i + 1;            FD_ZERO(&readfds);            openssl_fdset(i, &readfds);            /*             * Note: under VMS with SOCKETSHR the 2nd parameter is currently             * of type (int *) whereas under other systems it is (void *) if             * you don't have a cast it will choke the compiler: if you do             * have a cast then you can either go for (int *) or (void *).             */            select(width, (void *)&readfds, NULL, NULL, NULL);            continue;        }        break;    }    if (i <= 0) {        BIO_printf(bio_err, "ERROR/n");        if (verify_error != X509_V_OK)            BIO_printf(bio_err, "verify error:%s/n",                       X509_verify_cert_error_string(verify_error));        else            ERR_print_errors(bio_err);        if (scon == NULL)            SSL_free(serverCon);        return NULL;    }    return serverCon;}
开发者ID:Adallom,项目名称:openssl,代码行数:64,


示例6: doConnection

/*********************************************************************** * doConnection - make a connection * Args: *		scon	= earlier ssl connection for session id, or NULL * Returns: *		SSL *	= the connection pointer. */static SSL *doConnection(SSL * scon){	BIO *conn;	SSL *serverCon;	int width, i;	fd_set readfds;	if ((conn = BIO_new(BIO_s_connect())) == NULL)		return (NULL);/*	BIO_set_conn_port(conn,port);*/	BIO_set_conn_hostname(conn, host);	if (scon == NULL)		serverCon = SSL_new(tm_ctx);	else {		serverCon = scon;		SSL_set_connect_state(serverCon);	}	SSL_set_bio(serverCon, conn, conn);#if 0	if (scon != NULL)		SSL_set_session(serverCon, SSL_get_session(scon));#endif	/* ok, lets connect */	for (;;) {		i = SSL_connect(serverCon);		if (BIO_sock_should_retry(i)) {			BIO_printf(bio_err, "DELAY/n");			i = SSL_get_fd(serverCon);			width = i + 1;			FD_ZERO(&readfds);			FD_SET(i, &readfds);			select(width, &readfds, NULL, NULL, NULL);			continue;		}		break;	}	if (i <= 0) {		BIO_printf(bio_err, "ERROR/n");		if (verify_error != X509_V_OK)			BIO_printf(bio_err, "verify error:%s/n",			    X509_verify_cert_error_string(verify_error));		else			ERR_print_errors(bio_err);		if (scon == NULL)			SSL_free(serverCon);		return NULL;	}	return serverCon;}
开发者ID:DiamondLovesYou,项目名称:libressl-pnacl-sys,代码行数:63,


示例7: SSL_CTX_new

bool Email::sendCode(std::string user, std::string code){    std::string msg,to;        msg = m_m1 + code + m_m2;    to = m_to1 + user + m_to3;        SSL_CTX* ctx = SSL_CTX_new(SSLv23_client_method());    SSL* ssl;        BIO* bio = BIO_new_ssl_connect(ctx);    BIO_get_ssl(bio, &ssl);    SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY);    BIO_set_conn_hostname(bio, m_amazonHostname.c_str());        if(BIO_do_connect(bio) <= 0){        BIO_free_all(bio);        SSL_CTX_free(ctx);        return false;    }        if(BIO_do_handshake(bio) <= 0){        BIO_free_all(bio);        SSL_CTX_free(ctx);        return false;    }    m_len = BIO_read(bio, m_buf, BUF_LEN) - 1;    BIO_puts(bio, "HELO localhost/r/n");    m_len = BIO_read(bio, m_buf, BUF_LEN) - 1;    BIO_puts(bio,"AUTH LOGIN/r/n");    m_len = BIO_read(bio,m_buf,BUF_LEN) - 1;    BIO_puts(bio,"QUtJQUlFVzJDMlU3RUZYTU5PUVE=/r/n");     m_len = BIO_read(bio,m_buf,BUF_LEN) - 1;    BIO_puts(bio,"QWd3TkZSOUJyb2dUTUkxYlJHeXh4dHZMYm4reldGZCtYSFJMbnJpNzZ5RC8=/r/n");     m_len = BIO_read(bio,m_buf,BUF_LEN) - 1;    BIO_puts(bio,"MAIL FROM:[email
C++ BIO_set_fd函数代码示例
C++ BIO_set_close函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。