openssl

https的实现过程

  • client 从互联网下载CA的证书(公匙 ),用于验证server的身份
  • server 通过加密算法生成一对密匙,将公匙发给CA认证机构,做数字前面
  • CA通过自己的私匙加密server公匙并加上自己的数字签名后,将生成的数字证书发给server
  • client 与 server 通过TCP 的三次握手建立连接
  • client发出HTTP 的报文请求,并和server协商使用哪种算法加密
  • server 响应 报文并将证书(公匙)发给客户端
  • client通过CA的证书(公匙)解密,server发过的证书,得到server的公匙和数字签名,client 通过散列函数算出server公匙的数字签名与

          得到的数字签名对比,来验证server身份

  • client 生成随机对称密匙,并用服务器的公匙加密,然后传给服务器
  • server用私匙解密对称密钥,然后用其作为server和client 的 通话密码 加解密通信
  • server 处理请求,对访问相关资源做出相应报文

 

SSL 的 工具 openssl

1 安装openssl 默认已经安装

[[email protected] ~]# rpm -q openssl
openssl-1.0.1e-16.el6_5.7.x86_64

 

2 openssl 的软件组成

  • libcrpto  通用加密库
  • libssl        TLS/SSL的实现,基于会话 实现身份认证,数据机密性,完整性
  • openssl    多用途命令行工具

 

3 openssl 常用命令

   enc   加解密

[[email protected] ~]# openssl enc -des3 -in inittab -e -out inittab.des3
[[email protected] ~]# openssl enc -des3 -in inittab.des3 -d -out inittab

 

dgst   提取特征码

[[email protected] ~]# openssl dgst -md5 inittab
MD5(inittab)= 753a386bcd9ab0ca581056348463891e
[[email protected] ~]# md5sum inittab
753a386bcd9ab0ca581056348463891e  inittab

 

生成随机数    n*2

[[email protected] ~]# openssl rand -hex 8
ca502503cebd5d9a

 

4  openssl 实现私有CA具体步骤

一  创建CA机构

       修改配置文件

       生成一对秘钥

       生成自签证书

二   客户端

       生成一对秘钥

       生成证书颁发请求    .csr

       将请求发给CA

三   CA 机构

       签署此证书

        传送给客户端    

 

建立CA

cd  /etc/pki/CA
(umask 077;openssl genrsa -out private/cakey.pem 2048)
openssl req -new -x509 -key private/cakey.pem -out cacert.pem -days 3650
touch index.txt
echo "01" > serial

 

配置 httpd 使用证书

cd /etc/httpd
mkdir ssl
cd ssl
(umask 077;openssl genrsa -out http.key 1024) 生成密匙
openssl req -new -key httpd.key -out httpd.csr  证书请求文件 ,机构和其他名字必须和CA颁发机构的相同
openssl ca  -in httpd.csr -out httpd.crt -days  CA 签名

openssl,布布扣,bubuko.com

时间: 2024-08-25 08:35:29

openssl的相关文章

php7实现基于openssl的加密解密方法

还需要注意的是加密字符串长度问题,如果加密字符串长度太长需要进行分段加解密,如下代码: 加密:(公匙加密,私密一般用来解密) function encrypt($originalData){ $publicKeyFilePath = '/www/ceshi/rsa_public_key.pem'; extension_loaded('openssl') or die('php需要openssl扩展支持'); file_exists($publicKeyFilePath) or die('公钥的文

基于源码编译openssl

openssh依赖于openssl,由于ssl频繁曝出漏洞,牵扯到openssh.而自身也存在漏洞... 00.下载openssl https://www.openssl.org/source/ https://github.com/openssl/openssl/releases https://www.openssl.org/source/openssl-1.0.2l.tar.gz 01.准备工作 yum -y install perl perl-devel gcc gcc-c++ 02.编

openssl基础

OpenSSL 是一个安全套接字层密码库,囊括主要的密码算法.常用的密钥和证书封装管理功能及SSL协议,并提供丰富的应用程序供测试或其它目的使用. OpenSSL is an open source project that provides a robust, commercial-grade, and full-featured toolkit for the Transport Layer Security (TLS) and Secure Sockets Layer (SSL) prot

OpenSSL Heartbleed “心脏滴血”漏洞简单攻击示例

OpenSSL Heartbleed漏洞的公开和流行让许多人兴奋了一把,也让另一些人惊慌了一把. 单纯从攻击的角度讲,我已知道的,网上公开的扫描工具有: 1.  Nmap脚本ssl-heartbleed.nse: http://nmap.org/nsedoc/scripts/ssl-heartbleed.html 1 nmap -sV --script=ssl-heartbleed <target> 2. Jared Stafford的testssl.py: https://gist.gith

Centos7 httpd+openssl+ssh登录实现过程(爱你就给你写详细点)

上篇已经讲了LAMP的yum简易搭建 http://rexchow.blog.51cto.com/11619161/1885533 我们针对这套服务延伸openssl功能 原理就不多说了,谷X百X去 环境说明: server:CentOS7-192.168.230.202 client: win8.1-192.168.230.59 Apache/2.4.6 php Version 5.4.16 5.5.52-MariaDB 新增签发服务器:192.168.230.204 需要安装openssl

openssl、openssh升级

近期公司应用需要用到https协议:Centos6.5自带的的openssl 1.0.1e版本存在名为"心脏出血"的漏洞. 环境:CentOS6.5_x86_64 准备相关的包openssh下载地址:http://mirror.internode.on.net/pub/OpenBSD/OpenSSH/portable/openssl相关包下载:http://www.openssl.org/source/pam相关包下载:http://pkgs.org/centos-6/centos-x

Windows 一键安装OpenSSL

原理:OpenSSL在github上有开源项目,我们只需要把代码克隆到本地,在本地编译一下就好了 注意事项: 1->在github上获取源码,必须要安装git for windows,网址 https://git-for-windows.github.io 2->OpenSSL的配置文件需要Perl语言来解析,所以本地电脑需要安装Perl脚本运行环境 perl官网下载地址 : https://www.perl.org/get.html  我选择的是草莓版(Strawberry) ,下载后安装P

安全与加密(openssl)

一.安全及威胁 NIST(National Institute of Standard and Technology,美国国家标准与技术研究院)制定了安全的数据应该具备的安全属性: 1)保密性 即认为安全的数据是具有隐私性的 2)完整性:数据不可被篡改,包括: 数据完整性: 系统完整性. 3)可用性 加密过的数据可以被还原且继续被使用 威胁我们数据安全的主要有以下攻击方式:STRIDE 1)Spoofing(假冒),arp欺骗等 2)Tampering(篡改) 3)Repudiation(否认)

Openssl pkcs7命令

一.简介 pkcs7命令用于处理DER或者PEM格式的pkcs#7文件.   二.语法 openssl pkcs7 [-inform PEM|DER] [-outform PEM|DER] [-in filename] [-out filename] [-print] [-print_certs] [-text] [-noout] [-engine id] 选项 -inform arg input format - DER or PEM -outform arg output format -

openssl编译

官网:http://www.openssl.org/ 得到源码: git clone  https://github.com/openssl/openssl 一.用vc编译器编译: 1.下载nasm: http://www.nasm.us/ 2.下载perl: http://www.perl.org/ 3.配置: 运行 Configure . perl Configure VC-WIN32 --prefix=c:\openssl 如不成功会有明显提示. 4.创建Makefile文件. >ms/d