02.07.2013 Views

openssl 编程入门(含完整示例)

openssl 编程入门(含完整示例)

openssl 编程入门(含完整示例)

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

7. 客户端编写步骤<br />

开 始<br />

S S L _library_init ( )<br />

SSL 库 初 始 化<br />

O penSSL_a d d _a ll_algorithms<br />

载 入 所 有 SSL 算 法<br />

S S L _lo a d _error_strings ( )<br />

载 入 所 有 SSL 错 误 消 息<br />

S S L _C T X _n e w (S S L v 2 3 _server<br />

_m e thod ( ) )<br />

产 生 一 个 S S L _C T X<br />

sockfd = socket((AF_I N E T ,<br />

S O C K _S T R E A M , 0))<br />

<strong>openssl</strong> 编程入门<br />

茶 色 为 普 通 socket 操 作 ,其 它 为 s ss s l ll增<br />

加 的 操 作<br />

8. 相关头文件<br />

8.1. 8.1. socket 头文件<br />

#include <br />

#include <br />

#include <br />

#include <br />

S S L _r e a d(s s l , buffer,<br />

MA X BU F)<br />

接 收 服 务 器 来 的 消 息<br />

S S L _connect(s s l)<br />

建 立 SSL 连 接<br />

S S L _se t_f d (s s l , new f d)<br />

socket 加 入 到 S S L<br />

S S L _n e w (c t x )<br />

产 生 一 个 新 的 S S L<br />

connect (soc kf d )<br />

S S L _w r ite(s s l , buffer,<br />

str le n(buffer) )<br />

发 消 息 给 服 务 器<br />

S S L _shutdow n (s s l)<br />

关 闭 SSL 连 接<br />

S S L _f r e e(s s l )<br />

释 放 S S L<br />

c lose (soc kf d )<br />

S L _C T X _f r e e(c t x )<br />

释 放 S S L<br />

结 束<br />

4

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!