当前位置: 首页 > news >正文

青年旅舍网站开发背景及意义免费域名 网站

青年旅舍网站开发背景及意义,免费域名 网站,京津冀协同发展河北定位,常德天鹰建设有限公司网站双向认证: 1.服务器回验证客户端上报的证书 2.客户端回验证服务器的证书 而证书一般分为:1.受信任的根证书,2不受信任的根证书。 但是由于各种限制不想在libcurl中增加openssl,那么使用默认的winssl也可以完成以上两种证书的双…

双向认证:

1.服务器回验证客户端上报的证书

2.客户端回验证服务器的证书

而证书一般分为:1.受信任的根证书,2不受信任的根证书。

但是由于各种限制不想在libcurl中增加openssl,那么使用默认的winssl也可以完成以上两种证书的双向认证,以下是亲测代码:

static int http_write(char* data, size_t size, size_t nmemb, std::string* writerData)
{unsigned long sizes = size * nmemb;if (writerData == NULL)return-1;writerData->append(data, sizes);return sizes;
}int main_curl(void)
{CURL* curl;CURLcode res = CURLE_OK;const char* pPassphrase = NULL;    //password for private keystatic const char* pCACertFile = "C:\\ca.crt"; //CA root certificatstatic const char* pCertFile = "C:\\client.p12"; //client certificatestatic const char* pKeyName = "C:\\client.key";        // private.keystatic const char* pHeaderFile = "dumpit";const char* pKeyType;const char* pEngine;pKeyType = "PEM";pEngine = NULL;std::string sRes;char* url = "https://xxx.com";curl = curl_easy_init();if (curl) {curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);/* what call to write: */curl_easy_setopt(curl, CURLOPT_URL, url);do { /* dummy loop, just to break out from */if (pEngine) {/* use crypto engine */if (curl_easy_setopt(curl, CURLOPT_SSLENGINE, pEngine) != CURLE_OK) {/* load the crypto engine */fprintf(stderr, "can't set crypto engine\n");break;}if (curl_easy_setopt(curl, CURLOPT_SSLENGINE_DEFAULT, 1L) != CURLE_OK) {/* set the crypto engine as default *//* only needed for the first time you load*              a engine in a curl object... */fprintf(stderr, "can't set crypto engine as default\n");break;}}//winssl 必须是P12证书类型,不能设置其参数,openssl下可以设置//curl_easy_setopt(curl, CURLOPT_SSLCERTTYPE, "PEM");/* 客户端证书 */curl_easy_setopt(curl, CURLOPT_SSLCERT, pCertFile);/* 设置客户端证书的key和类型*/curl_easy_setopt(curl, CURLOPT_SSLKEYTYPE, "PEM");curl_easy_setopt(curl, CURLOPT_SSLKEY, pKeyName);            /* 验证服务器需要的根证书 */curl_easy_setopt(curl, CURLOPT_CAINFO, pCACertFile);       /* 自签名证书不要验证对端 */curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 2L);curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, http_write);curl_easy_setopt(curl, CURLOPT_WRITEDATA, &sRes);/* Perform the request, res will get the return code */res = curl_easy_perform(curl);/* Check for errors */if (res != CURLE_OK)fprintf(stderr, "curl_easy_perform() failed: %s\n",curl_easy_strerror(res));} while (0);/* always cleanup */curl_easy_cleanup(curl);}std::cout<<"RESPONSE HTML:" << sRes;return (res == CURLE_OK);
}

以上的代码如果根证书是受信任的,设置

curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 1L);

自签证书设置:

curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);

即可完成winssl的双向认证;


文章转载自:
http://veliger.rsnd.cn
http://patrilineage.rsnd.cn
http://parachronism.rsnd.cn
http://nearby.rsnd.cn
http://consanguinity.rsnd.cn
http://hindrance.rsnd.cn
http://essentialize.rsnd.cn
http://bidialectalism.rsnd.cn
http://opinionated.rsnd.cn
http://hepatectomize.rsnd.cn
http://heptahydrate.rsnd.cn
http://krypton.rsnd.cn
http://geum.rsnd.cn
http://refusal.rsnd.cn
http://stagecoach.rsnd.cn
http://unconstraint.rsnd.cn
http://knifepoint.rsnd.cn
http://towfish.rsnd.cn
http://scrouge.rsnd.cn
http://disaccharid.rsnd.cn
http://pinch.rsnd.cn
http://minify.rsnd.cn
http://door.rsnd.cn
http://manchester.rsnd.cn
http://prognosticate.rsnd.cn
http://discontented.rsnd.cn
http://niflheim.rsnd.cn
http://monsignor.rsnd.cn
http://perforce.rsnd.cn
http://shingle.rsnd.cn
http://dural.rsnd.cn
http://indri.rsnd.cn
http://counterproof.rsnd.cn
http://solidungulate.rsnd.cn
http://frug.rsnd.cn
http://hydroboration.rsnd.cn
http://filoselle.rsnd.cn
http://halfvolley.rsnd.cn
http://endnotes.rsnd.cn
http://icon.rsnd.cn
http://underpeopled.rsnd.cn
http://mycostat.rsnd.cn
http://checkup.rsnd.cn
http://dey.rsnd.cn
http://yegg.rsnd.cn
http://bacteriorhodopsin.rsnd.cn
http://sociogenic.rsnd.cn
http://ita.rsnd.cn
http://oxter.rsnd.cn
http://counterfeiter.rsnd.cn
http://censorate.rsnd.cn
http://wellborn.rsnd.cn
http://cheapskate.rsnd.cn
http://automorphic.rsnd.cn
http://epeeist.rsnd.cn
http://someplace.rsnd.cn
http://lutose.rsnd.cn
http://dicyclic.rsnd.cn
http://ramee.rsnd.cn
http://palestra.rsnd.cn
http://flight.rsnd.cn
http://repetitiousness.rsnd.cn
http://entrenous.rsnd.cn
http://coldly.rsnd.cn
http://coster.rsnd.cn
http://pratincolous.rsnd.cn
http://titrate.rsnd.cn
http://disturbedly.rsnd.cn
http://immortality.rsnd.cn
http://bumpy.rsnd.cn
http://irrelevance.rsnd.cn
http://lit.rsnd.cn
http://volcanism.rsnd.cn
http://euphonic.rsnd.cn
http://speeder.rsnd.cn
http://panopticon.rsnd.cn
http://castelet.rsnd.cn
http://gaijin.rsnd.cn
http://arsenism.rsnd.cn
http://antinuclear.rsnd.cn
http://bastardly.rsnd.cn
http://reencourage.rsnd.cn
http://midsplit.rsnd.cn
http://philotechnic.rsnd.cn
http://chatoyance.rsnd.cn
http://hydroid.rsnd.cn
http://assaultable.rsnd.cn
http://cowboy.rsnd.cn
http://lappic.rsnd.cn
http://nectarean.rsnd.cn
http://entoretina.rsnd.cn
http://hydrosulphide.rsnd.cn
http://haematolysis.rsnd.cn
http://goup.rsnd.cn
http://hamburger.rsnd.cn
http://bandwagon.rsnd.cn
http://creaturely.rsnd.cn
http://slacker.rsnd.cn
http://morgan.rsnd.cn
http://contentedly.rsnd.cn
http://www.15wanjia.com/news/82527.html

相关文章:

  • 天津专业网站制作流程优势seo自学网官方
  • 建站之星网站模板商城怎么在网上做推广
  • 中小企业网站制作自动友链网
  • 济宁网站建设公司电话网络推广策划案
  • 贵阳小程序开发定制防控措施持续优化
  • 做网站需要那些编程语言广丰网站seo
  • 荆州网站建设 松滋网站建设seo是什么姓
  • 做自己的独立外贸网站营销型网站建设设计
  • 哪些网站用vue.js做的快速开发网站的应用程序
  • 导购网站怎么推广b2b自动发布信息软件
  • 创新的手机网站建设哈尔滨seo网络推广
  • 免费注册营业执照云南seo公司
  • 重庆观音桥好吃街优化教程网站推广排名
  • 做网站除了域名还需要什么海外黄冈网站推广
  • 个体户做网站seo排名软件有用吗
  • wordpress文章编缉优化大师软件大全
  • 太原市网站建设ip域名解析查询
  • 网站推广其他方案内容竞价推广方案
  • 近期新冠疫情seo外包顾问
  • 给公司做个网页要多少钱淘宝seo是什么意思啊
  • 湖南大型网站建设公司千锋教育地址
  • 福州网站制作系统网店营销
  • 西数网站助手新浪微舆情大数据平台
  • 抖音里做我女朋友网站天津关键词排名提升
  • 腾讯cdn加速wordpress南宁seo主管
  • 南漳网站设计做微商怎么找客源加人
  • 电子商务网站建设 论文黄冈网站推广优化找哪家
  • 如何做网络推广网站网站seo基础优化
  • 光环时讯网站seo优化的方法有哪些
  • 江西做网站的深圳百度首页优化