openssl编程.pdf

时间:2014-01-11 08:44:07
【文件属性】:

文件名称:openssl编程.pdf

文件大小:1.21MB

文件格式:PDF

更新时间:2014-01-11 08:44:07

Openssl 编程

第一章基础知识.....................................................................................................................10 1.1 对称算法.....................................................................................................................10 1.2 摘要算法.....................................................................................................................10 1.3 公钥算法.....................................................................................................................11 1.4 回调函数.....................................................................................................................13 第二章 openssl 简介................................................................................................................15 2.1 openssl 简介................................................................................................................15 2.2 openssl 安装................................................................................................................15 2.2.1 linux 下的安装................................................................................................15 2.2.2 windows 编译与安装.....................................................................................15 2.3 openssl 源代码............................................................................................................16 2.4 openssl 学习方法........................................................................................................18 第三章堆栈.............................................................................................................................19 3.1 openssl 堆栈................................................................................................................19 3.2 数据结构.....................................................................................................................19 3.3 源码.............................................................................................................................19 3.4 定义用户自己的堆栈函数.........................................................................................20 3.5 编程示例.....................................................................................................................21 第四章哈希表.........................................................................................................................23 4.1 哈希表.........................................................................................................................23 4.2 哈希表数据结构.........................................................................................................23 4.3 函数说明.....................................................................................................................24 4.4 编程示例.....................................................................................................................26 第五章内存分配.....................................................................................................................29 5.1 openssl 内存分配........................................................................................................29 5.2 内存数据结构.............................................................................................................29 5.3 主要函数.....................................................................................................................30 5.4 编程示例.....................................................................................................................30 第六章动态模块加载.............................................................................................................32 6.1 动态库加载.................................................................................................................32 6.2 DSO 概述....................................................................................................................32 6.3 数据结构.....................................................................................................................32 6.4 编程示例.....................................................................................................................33 第七章抽象 IO .......................................................................................................................36 7.1 openssl 抽象IO ..........................................................................................................36 7.2 数据结构.....................................................................................................................36 7.3 BIO 函数....................................................................................................................37 7.4 编程示例.....................................................................................................................38 7.4.1 mem bio...........................................................................................................38 7.4.2 file bio .............................................................................................................38 7.4.3 socket bio ........................................................................................................39 7.4.4 md BIO............................................................................................................41 7.4.5 cipher BIO.......................................................................................................41 7.4.6 ssl BIO.............................................................................................................42 5 7.4.7 其他示例.........................................................................................................44 第八章配置文件.....................................................................................................................45 8.1 概述.............................................................................................................................45 8.2 openssl 配置文件读取................................................................................................45 8.3 主要函数.....................................................................................................................45 8.4 编程示例.....................................................................................................................46 第九章随机数.........................................................................................................................48 9.1 随机数.........................................................................................................................48 9.2 openssl 随机数数据结构与源码................................................................................48 9.3 主要函数.....................................................................................................................49 9.4 编程示例.....................................................................................................................50 第十章文本数据库.................................................................................................................52 10.1 概述.........................................................................................................................52 10.2 数据结构.................................................................................................................52 10.3 函数说明.................................................................................................................53 10.4 编程示例.................................................................................................................53 第十一章大数.........................................................................................................................56 11.1 介绍.............................................................................................................................56 11.2 openssl 大数表示........................................................................................................56 11.3 大数函数.....................................................................................................................56 11.4 使用示例.....................................................................................................................59 第十二章 BASE64 编解码.....................................................................................................66 12.1 BASE64 编码介绍.....................................................................................................66 12.2 BASE64 编解码原理..................................................................................................66 12.3 主要函数.................................................................................................................67 12.4 编程示例.................................................................................................................67 第十三章 ASN1 库..................................................................................................................70 13.1 ASN1 简介..................................................................................................................70 13.2 DER 编码....................................................................................................................71 13.3 ASN1 基本类型示例..................................................................................................71 13.4 openssl 的ASN.1 库..................................................................................................74 13.5 用openssl 的ASN.1 库DER 编解码....................................................................75 13.6 Openssl 的ASN.1 宏..................................................................................................76 13.7 ASN1 常用函数..........................................................................................................77 13.8 属性证书编码...........................................................................................................90 第十四章错误处理.................................................................................................................95 14.1 概述.........................................................................................................................95 14.2 数据结构.................................................................................................................95 14.3 主要函数.................................................................................................................97 14.4 编程示例.................................................................................................................99 第十五章摘要与 HMAC......................................................................................................102 15.1 概述.......................................................................................................................102 15.2 openssl 摘要实现......................................................................................................102 15.3 函数说明...............................................................................................................102 6 15.4 编程示例...............................................................................................................103 15.5 HMAC.......................................................................................................................104 第十六章数据压缩...............................................................................................................106 16.1 简介.......................................................................................................................106 16.2 数据结构...............................................................................................................106 16.3 函数说明...............................................................................................................107 16.4 openssl 中压缩算法协商..........................................................................................107 16.5 编程示例...............................................................................................................108 第十七章 RSA.......................................................................................................................109 17.1 RSA 介绍...................................................................................................................109 17.2 openssl 的RSA 实现................................................................................................109 17.3 RSA 签名与验证过程..............................................................................................110 17.4 数据结构...............................................................................................................110 17.4.1 RSA_METHOD.................................................................................................110 17.4.2 RSA............................................................................................................... 111 17.5 主要函数...............................................................................................................112 17.6 编程示例.......................................................................................................................113 17.6.1 密钥生成............................................................................................................113 17.6.2 RSA 加解密运算..........................................................................................115 17.6.3 签名与验证........................................................................................................118 第十八章 DSA.......................................................................................................................121 18.1 DSA 简介..............................................................................................................121 18.2 openssl 的DSA 实现................................................................................................121 18.3 DSA 数据结构..........................................................................................................122 18.4 主要函数...............................................................................................................123 18.5 编程示例...............................................................................................................124 18.5.1 密钥生成............................................................................................................124 18.5.2 签名与验证........................................................................................................125 第十九章DH...............................................................................................................................128 19.1 DH 算法介绍............................................................................................................128 19.2 openssl 的DH 实现..................................................................................................128 19.3 数据结构.......................................................................................................................129 19.4 主要函数...............................................................................................................130 19.5 编程示例...............................................................................................................131 第二十章椭圆曲线...............................................................................................................134 20.1 ECC 介绍..................................................................................................................134 20.2 openssl 的ECC 实现................................................................................................134 20.3 主要函数...............................................................................................................135 20.4 编程示例...............................................................................................................135 第二十一章 EVP...................................................................................................................139 21.1 EVP 简介......................................................................................................................139 21.2 数据结构......................................................................................................................139 21.2.1 EVP_PKEY...................................................................................................139 21.2.2 EVP_MD.......................................................................................................140 7 21.2.3 EVP_CIPHER...............................................................................................141 21.2.4 EVP_CIPHER_CTX.....................................................................................142 21.3 源码结构......................................................................................................................142 21.4 摘要函数......................................................................................................................143 21.5 对称加解密函数..........................................................................................................143 21.6 非对称函数..................................................................................................................144 21.7 BASE64 编解码函数................................................................................................145 21.8 其他函数.......................................................................................................................145 21.9 对称加密过程............................................................................................................147 21.10 编程示例...............................................................................................................148 第二十二章 PEM 格式.........................................................................................................155 22.1 PEM 概述.................................................................................................................155 22.2 openssl 的PEM 实现................................................................................................155 22.3 PEM 函数.................................................................................................................156 22.4 编程示例...............................................................................................................157 第二十三章 Engine ...............................................................................................................161 23.1 Engine 概述..............................................................................................................161 23.2 Engine 支持的原理..................................................................................................161 23.3 Engine 数据结构......................................................................................................161 23.4 openssl 的Engine 源码...........................................................................................162 23.5 Engine 函数..............................................................................................................163 23.6 实现Engine 示例.................................................................................................164 第二十四章通用数据结构...................................................................................................178 24.1 通用数据结构...............................................................................................................178 24.2 X509_ALGOR..........................................................................................................178 24.3 X509_VAL................................................................................................................179 24.4 X509_SIG .................................................................................................................181 24.5 X509_NAME_ENTRY.............................................................................................182 24.6 X509_NAME............................................................................................................182 24.7 X509_EXTENSION .................................................................................................188 24.8 X509_ATTRIBUTE..................................................................................................194 24.9 GENERAL_NAME ..................................................................................................195 第二十五章证书申请...........................................................................................................199 25.1 证书申请介绍.......................................................................................................199 25.2 数据结构...............................................................................................................199 25.3 主要函数...............................................................................................................200 25.4 编程示例...............................................................................................................202 25.4.1 生成证书请求文件............................................................................................202 25.4.2 解码证书请求文件.......................................................................................204 第二十六章 X509 数字证书.................................................................................................206 26.1 X509 数字证书.........................................................................................................206 26.2 opessl 实现................................................................................................................206 26.3 X509 数据结构.........................................................................................................206 26.4 X509_TRUST 与X509_CERT_AUX......................................................................209 8 26.5 X509_PURPOSE ......................................................................................................211 26.6 主要函数...............................................................................................................214 26.7 证书验证...............................................................................................................217 26.7.1 证书验证项........................................................................................................217 26.7.2 Openssl 中的证书验证.................................................................................217 第二十七章 OCSP.................................................................................................................218 27.1 概述.......................................................................................................................218 27.2 openssl 实现..............................................................................................................218 27.3 主要函数...............................................................................................................218 27.4 编程示例.......................................................................................................................223 第二十八章 CRL...................................................................................................................224 28.1 CRL 介绍..................................................................................................................224 28.2 数据结构...............................................................................................................224 28.3 CRL 函数..................................................................................................................225 28.4 编程示例...............................................................................................................226 第二十九章 PKCS7...............................................................................................................229 29.1 概述...............................................................................................................................229 29.2 数据结构...............................................................................................................229 29.3 函数.......................................................................................................................230 29.4 消息编解码.............................................................................................................230 29.4.1 data ..............................................................................................................231 29.4.2 signed data...................................................................................................231 29.4.3 enveloped ....................................................................................................232 29.4.4 signed_and_enveloped ................................................................................233 29.4.5 digest ...........................................................................................................234 29.4.6 encrypted.....................................................................................................234 29.4.7 读取PEM .....................................................................................................235 29.4.8 解码pkcs7 ....................................................................................................236 第三十章 PKCS12...............................................................................................................237 30.1 概述.......................................................................................................................237 30.2 openss 实现...............................................................................................................237 30.3 数据结构.......................................................................................................................237 30.4 函数...............................................................................................................................238 30.5 编程示例...............................................................................................................240 第三十一章 SSL 实现...........................................................................................................250 31.1 概述...............................................................................................................................250 31.2 openssl 实现..............................................................................................................250 31.3 建立SSL 测试环境..............................................................................................250 31.4 数据结构...............................................................................................................251 31.5 加密套件...............................................................................................................252 31.6 密钥信息...............................................................................................................253 31.7 SESSION ..................................................................................................................253 31.8 多线程支持...........................................................................................................254 31.9 编程示例...............................................................................................................254 9 31.10 函数.......................................................................................................................265 第三十二章 Openssl 命令.....................................................................................................268 32.1 概述...............................................................................................................................268 32.2 asn1parse...................................................................................................................268 32.3 dgst...........................................................................................................................270 32.4 gendh.........................................................................................................................271 32.5 passwd.......................................................................................................................271 32.6 rand ...........................................................................................................................272 32.7 genrsa ........................................................................................................................273 32.8 req .............................................................................................................................273 32.9 x509...........................................................................................................................276 32.10 version...................................................................................................................279 32.11 speed......................................................................................................................279 32.12 sess_id .................................................................................................................280 32.13 s_server ...............................................................................................................280 32.14 s_client ................................................................................................................282 32.15 rsa........................................................................................................................284 32.16 pkcs7 ...................................................................................................................285 32.17 dsaparam .............................................................................................................285 32.18 gendsa..................................................................................................................286 32.19 enc .......................................................................................................................287 32.20 ciphers .................................................................................................................288 32.21 CA.......................................................................................................................288 32.22 verify ...................................................................................................................292 32.23 rsatul....................................................................................................................293 32.24 crl ..........................................................................................................................294 32.25 crl2pkcs7 ...........................................................................................................295 32.26 errstr ..................................................................................................................296 32.27 ocsp .............................................................................................................................296 32.28 pkcs12 .................................................................................................................299 32.29 pkcs8 ...................................................................................................................301 32.30 s_time ..................................................................................................................302 32.31 dhparam 和dh.............................................................................................................303 32.32 ecparam.................................................................................................................305 32.33 ec .........................................................................................................................306 32.34 dsa .......................................................................................................................307 32.35 nseq .....................................................................................................................308 32.36 prime ...................................................................................................................308 32.37 smime ..................................................................................................................309


网友评论

  • 有资料比没资料强,3Q
  • openssl的资料比较少,终于找到了!十分感谢
  • 不错的,挺有用
  • 正需要,入门很不错。
  • 正需要相关知识,谢谢。基本的中文知识。
  • 入门信息还是不错的
  • 对编程有一定帮助,没有完整的接口说明,但有少量示例代码可参考,但说明不足