https server with openssl 笔记

来源:互联网 发布:淘宝店铺首页全屏大图 编辑:程序博客网 时间:2024/06/10 05:04

服务端程序框架

OPENSSL_INIT();WSAStartup();bind();listen();fd = accept();meth = SSLv23_server_method();ctx = SSL_CTX_new (meth);SSL_CTX_use_certificate() | | CTX_use_certificate_file  加载证书SSL_CTX_use_PrivateKey() 使用秘钥ssl = SSL_new(ctx);SSL_set_fd(ssl,fd);SSL_read (ssl, buf, sizeof(buf));

客户端程序框架

meth = SSLv23_client_method();ctx = SSL_CTX_new (meth);ssl = SSL_new(ctx);fd = connect();SSL_set_fd(ssl,fd);SSL_connect(ssl);SSL_write();

// 大概的流程就是这样了

0 0
原创粉丝点击