菜鸟学Linux 第044篇笔记 算法和私有CA
菜鸟学Linux 第044篇笔记 算法和私有CA
证书吊销列表CRL(Certificate Revocation List )
如何解决私钥丢失
PKI: Public Key Infrastructure
CA: Cretificate Authority
证书存储格式 x509, pkcs12
x509
公钥及其有效期限
证书的合法拥有者
证书该如何被使用
CA的信息
CA签名的校验码
PKI的实现架构
PKI: TLS/SSL:x509
PKI: OpenGPG
SSL (Secure Socket Layer)公司开发的
SSLv2, SSLv3
TLS (Transport Layer Security) v1=SSLv3 国际标准化组织ISO
对称加密算法
DES: Data Encryption Standard, 56bit
3DES: 上边的3次加密
AES:Advanced Encryption Standard
AES192, AES256, AES512 越长加密性越高,速度也越慢
Blowfish
实现对称加密的工具openssl gpg
单向加密
MD4
MD5 128bit
SHA1 160bit
SHA192, SHA256, SHA384
CRC-32不是加密算法,是一种校验码的计算机制,所以不提供任何安全性
非对称加密(公钥加密):
功能:
身份认证(数字签名)
数据加密
密钥交换
加密算法
RSA 加密、签名
DSA 只可签名
ElGamal
OpenSSL: SSL的开源实现(软件) www.openssl.org
libcrypto 通用加密库
libssl TLS/SSL的实现
基于会话、实现了身份认证、数据机密性和会话完整性的TLS/SSL库
openssl 多用途命令行工具
实现私有证书颁发机构
/etc/pki/tls/openssl.cnf 该配置文件是用来让openssl工作为私有CA的时候使用
子命令:(简单讲解)注意前边都得加父命令openssl
speed des3 用户测试加密数据所需要用的时间
(注意后边最好写一个具体的算法,不然每一种算法都会测试一次)、
enc
-ciphername
-in filename
the input filename, standard input by default.
-out filename
the output filename, standard output by default.
-salt
use a salt in the key derivation routines. This option should ALWAYS be
used unless compatibility with previous versions of OpenSSL or SSLeay is
required. This option is only present on OpenSSL versions 0.9.5 or above.
-e encrypt the input data: this is the default.
-d decrypt the input data.
e.g. 加密文件 openssl enc -des3 -in inittab -out inittab.enc -a -e
加密文件 openssl enc -des3 -in inittab.enc -out inittab.d -d -a
(注意如果加了salt解密时也需要加上salt)
dgst
(dgst, md5, md4, md2, sha1, sha, mdc2, ripemd160 - message digests)
format : openssl dgst -algorithm
e.g. openssl dgst -shal inittab
openssl dgst -md5 inittab
passwd
-crypt
Use the crypt algorithm (default).
-1 Use the MD5 based BSD password algorithm 1.
-salt string
Use the specified salt. When reading a password from the terminal, this
implies -noverify.
e.g. openssl passwd -1 输入一个密码即可制作出该密码的md5特征码
rand (random number generator)
openssl子命令帮助获取
首先先用whatis查询一下子命令,然后看提示再使用man
md5sum filename 计算文件的md5特征码
sha1sum filename 计算文件的sha1特征码
openssl实现私有CA:
1、先生成一对密钥
genrsa (generate an RSA private key)
numbits
the size of the private key to generate in bits. This must be the last
option specified. The default is 512.
rsa (RSA key processing tool)
-in filename
This specifies the input filename to read a key from or standard input if
this option is not specified. If the key is encrypted a pass phrase will
be prompted for.
-pubout
by default a private key is output: with this option a public key will be
output instead. This option is automatically set if the input is a public
key.
-out the same like before.
e.g. openssl genrsa 生成私钥
openssl genrsa 512 生成512位私钥
openssl genrsa > server.key 注意密钥的权限
(umask 077; openssl genrsa -out server1024.key 1024)修改密钥权限
openssl rsa -in server.key -pubout
2、生成自签署证书
req (PKCS#10 certificate request and certificate generating utility.)
-new
this option generates a new certificate request. It will prompt the
user for the relevant field values. The actual fields prompted for and
their maximum and minimum sizes are specified in the configuration
file and any requested extensions.
-x509
this option outputs a self signed certificate instead of a certificate
request. This is typically used to generate a test certificate or a
self signed root CA. The extensions added to the certificate (if any)
are specified in the configuration file. Unless specified using the
set_serial option 0 will be used for the serial number.
-key filename
This specifies the file to read the private key from. It also accepts
PKCS#8 format private keys for PEM format files.
-out filename
This specifies the output filename to write to or standard output by
default.
-days n
when the -x509 option is being used this specifies the number of days
to certify the certificate for. The default is 30 days.
生成自签署证书
openssl req -new -x509 -key server.key -out server.crt -days 365
x509 (Certificate display and signing utility)
-text
prints out the certificate in text form. Full details are output
including the public key, signature algorithms, issuer and subject
names, serial number any extensions present and any trust settings.
-in filename
This specifies the input filename to read a certificate from or stan-
dard input if this option is not specified.
查看自签署证书
openssl x509 -text -in server.crt
1.在/etc/pki/CA/private/目录下生成CA私钥命名为cakey.pem
在/etc/pki/CA/目录下生成CA的证书命名为cacert.pem
在/etc/pki/CA/创建目录certs crl newcerts
在/etc/pki/CA/创建文件index.txt serial并在serial输入序号01
2.模拟申请证书颁发请求
mkdir /etc/http
cd /etc/http
mkdir ssl
cd ssl
(umask 077; openssl genrsa -out httpd.key 1024) 生成私钥
openssl req -new -key httpd.key -out httpd.csr 生成证书请求
openssl ca -in httpd.csr -out httpd.crt 签署该证书请求,生成证书
脚本完成CA的建立,并生成自签证书(高手的话可以练习一下,目前我没做以后我会试试呵呵 )
转载于:https://blog.51cto.com/winthcloud/1881913
菜鸟学Linux 第044篇笔记 算法和私有CA相关推荐
- 菜鸟学Linux 第100篇笔记 tomcat 之 java
菜鸟学Linux 第100篇笔记 tomcat 之 java 内容总览 java概述 java 包含四个独立却又彼此相关的技术 四个独立的技术运作流程 JVM的实现方式 JVM的虚拟机软件 JAVA ...
- windows pxe 安装linux,菜鸟学Linux 第103篇笔记 pxe自动化安装linux
菜鸟学Linux 第103篇笔记 pxe自动化安装linux 内容总览 linux的系统安装 kickstart文件的组成部分 DHCP (Dynamic Host Configuration Pro ...
- 菜鸟学Linux 第050篇笔记 dhcp
菜鸟学Linux 第050篇笔记 dhcp DHCP (Dynamic Host Configuration Protocol) 早期bootp (boot protocol) lease Clien ...
- 菜鸟学Linux 第090篇笔记 corosync+drbd+mysql
菜鸟学Linux 第090篇笔记 corosync+drbd+mysql 内容总览 上节回顾 DRBD (Distributed Replicated Block Device) 分布式复制块设备 配 ...
- 菜鸟学Linux 第033篇笔记 bootloader,inittab
菜鸟学Linux 第033篇笔记 bootloader,inittab Linux 系统自启动流程 PC OS (Linux) POST-->BIOS(Boot Sequence)-->M ...
- 菜鸟学Linux 第052篇笔记 httpd-install and section2
菜鸟学Linux 第052篇笔记 httpd-install and section2 apache 17years NCSA, httpd A Patchey Server = Apache FS ...
- Linux 日志 klogd,菜鸟学Linux 第038篇笔记 日志系统 syslogd,klogd
菜鸟学Linux 第038篇笔记 日志系统 syslogd,klogd Linux上的日志系统 syslog开源 syslog-ng 商业版 日志系统 syslog syslog 服务 syslog ...
- 菜鸟学Linux 第034篇笔记 vmlinuz, initrd, modules, script
菜鸟学Linux 第034篇笔记 vmlinuz, initrd, modules, script 内核两部分 核心 /boot/vmlinuz-version 内核模块 /lib/modules/ ...
- 菜鸟学Linux 第031篇笔记 script,控制,while,function
菜鸟学Linux 第031篇笔记 script,控制,while,function 一.脚本需求: 说明:此脚本能于同一个repo文件中创建之个yum源的指向: 1.接受一个文件名作为参数,此文件存放 ...
最新文章
- sum 函数'int' object is not callable
- 如何在JavaScript中验证电子邮件地址
- 网络工程师常用英文简写
- layer.open 模态弹窗, 隐藏关闭按钮, 隐藏按钮组
- 阮一峰react demo代码研究的学习笔记 - demo7 debug - create ref element
- sqllite开发安卓项目_【兼职项目】预算3万开发无线温度电流传感,2万开发直流电机打磨机控制...
- C语言库函数大全及应用实例四
- 通过webbrowser实现js与winform的相互调用
- LeetCode 740. 删除与获得点数(排序+动态规划)
- springboot中日志配置
- JDK1.8版本,java并发框架支持锁包括
- 6月3号=》66页-70页
- 生产环境和开发环境_生产环境 VS 开发环境,关于Kubernetes的四大认识误区
- wi ndows防火墙,网吧的防火墙怎么关?四种方法关闭WINDOWS防火墙
- Visual Studio 2013各个版本下载地址
- 如何使用linux command line 利用Entrez Direct下载NCBI数据
- 实时交通仿真平台概要
- MPEG-4、MPEG-4/AVC、H.264之间的联系与区别
- 综合实验-基于RS485的多机评分系统
- 哲学生活中必背的哲学原理
热门文章
- 2021年2月程序员工资统计,又拖后腿了……
- 微信8.0内测更新!!!(附内测体验资格)
- 如何编写最佳的Dockerfile
- 从Servlet、Dubbo、Mybatis聊聊责任链究竟怎么用
- Spring Cloud微服务版本灰度发布新神器
- 为了让16岁的儿子从轮椅上站起来,这位机器人工程师父亲打造了一套外骨骼装置...
- 美多商城之商品(准备商品数据 )、Dockers容器和FastDFS存储
- soup.a.parents都有哪些
- ACMNO.22 C语言-公约公倍2 写两个函数,分别求两个整数的最大公约数和最小公倍数,用主函数调用这两个函数,并输出结果两个整数由键盘输入。 输入 两个数 输出 最大公约数 最小公倍数
- X射线图像中的目标检测