OpenSSL 有关密钥的那些事儿(HOWTO keys)
<DRAFT!>
OpenSSL 有关密钥的那些事儿(HOWTO keys) 1. 介绍(Introduction) Keys are the basis of public key algorithms and PKI. Keys usually
come in pairs, with one half being the public key and the other half
being the private key. With OpenSSL, the private key contains the
public key information as well, so a public key doesn't need to be
generated separately. Public keys come in several flavors, using different cryptographic
algorithms. The most popular ones associated with certificates are
RSA and DSA, and this HOWTO will show how to generate each of them. 2. 生成 RSA 密钥(To generate a RSA key) A RSA key can be used both for encryption and for signing. Generating a key for the RSA algorithm is quite easy, all you have to
do is the following: openssl genrsa -des3 -out privkey.pem 2048 With this variant, you will be prompted for a protecting password. If
you don't want your key to be protected by a password, remove the flag
'-des3' from the command line above. NOTE: if you intend to use the key together with a server
certificate, it may be a good thing to avoid protecting it
with a password, since that would mean someone would have to
type in the password every time the server needs to access
the key. The number 2048 is the size of the key, in bits. Today, 2048 or
higher is recommended for RSA keys, as fewer amount of bits is
consider insecure or to be insecure pretty soon. 3. 生成 DSA 密钥(To generate a DSA key) A DSA key can be used for signing only. This is important to keep
in mind to know what kind of purposes a certificate request with a
DSA key can really be used for. Generating a key for the DSA algorithm is a two-step process. First,
you have to generate parameters from which to generate the key: openssl dsaparam -out dsaparam.pem 2048 The number 2048 is the size of the key, in bits. Today, 2048 or
higher is recommended for DSA keys, as fewer amount of bits is
consider insecure or to be insecure pretty soon. When that is done, you can generate a key using the parameters in
question (actually, several keys can be generated from the same
parameters): openssl gendsa -des3 -out privkey.pem dsaparam.pem With this variant, you will be prompted for a protecting password. If
you don't want your key to be protected by a password, remove the flag
'-des3' from the command line above. NOTE: if you intend to use the key together with a server
certificate, it may be a good thing to avoid protecting it
with a password, since that would mean someone would have to
type in the password every time the server needs to access
the key. --
Richard Levitte
OpenSSL 有关密钥的那些事儿(HOWTO keys)的更多相关文章
- php openssl 增加密钥
生成私钥:openssl genrsa 1024 > private.key (注意,1024是密钥的长度,如果密钥较长,相应加密后的密文也会较长) 生成公钥:openssl rsa -in ...
- 使用openssl生成密钥、加密和签名
openssl genrsa -out rsakey.pem 1024 //生成1024bit的RSA密钥,并保存到rsakey.pem,此处未对密钥进行加密 openssl genrsa -aes ...
- OpenSSL(1)密钥和证书管理
OpenSSL是一个开源项目,包括密码库和SSL/TLS工具集. 从项目的官方站点可以看到: OpenSSL项目是安全套接字层( secure sockets layer, SSL)和传输层安全( t ...
- openssl RSA密钥格式PKCS1和PKCS8相互转换
RSA私钥格式PKCS1和PKCS8相互转换 RSA公钥格式PKCS1和PKCS8相互转换 以下转换基于openssl命令的操作: 1. openssl 生成pkcs1格式的私钥,密钥长度1024位, ...
- openssl pem密钥文件rsa加密解密例子
准备工作 命令行加密解密,用与比对代码中的算法和命令行的算法是否一致 C:\openssl_test>openssl rsautl -encrypt -in data.txt -inkey pu ...
- 简单使用OpenSSL生成密钥
一.生成自签名证书 1.1.创建root CA私钥 openssl req -newkey rsa:4096 -nodes -sha256 -keyout ca.key -x509 -days 365 ...
- openssl生成密钥/证书
一.公钥/私钥/签名/验证签名/加密/解密/非对称加密 对称加密:用同一个密码 加密/解密 文件. 非对称加密:加密用的一个密码,解密用另外一组密码. 加密解密:公钥加密数据,然后私钥解密. 公钥 ...
- 基于OpenSSL的RSA加密应用(非算法)
基于OpenSSL的RSA加密应用(非算法) iOS开发中的小伙伴应该是经常用der和p12进行加密解密,而且在通常加密不止一种加密算法,还可以加点儿盐吧~本文章主要阐述的是在iOS中基于openSL ...
- 创建私有CA,我就用openSSL
目录 简介 搭建root CA 生成root CA 使用CRL 使用OSCP 总结 简介 一般情况下我们使用的证书都是由第三方权威机构来颁发的,如果我们有一个新的https网站,我们需要申请一个世界范 ...
随机推荐
- Codeforces 932.C Permutation Cycle
C. Permutation Cycle time limit per test 2 seconds memory limit per test 256 megabytes input standar ...
- VMware HA 特性
关键特性1.自动检测服务器故障.VMware HA 自动监控物理服务器的可用性.VMware HA 可检测物理服务器故障,并且无需人工干预即可重新启动资源池中其他物理服务器上的新虚拟机.2.自动检测操 ...
- AGC019-E Shuffle and Swap
给定两个长度为\(n\le 10^5\)的\(01\)串 \(A, B\), 满足 \(1\) 的数量相等 求通过下列方式将\(A\)变成\(B\)的概率 (mod意义下) 构造序列\(a,b\). ...
- 汕头市队赛 SRM14 T2 最长上升子序列
最长上升子序列 (tree.pas/c/cpp) 128MB 1s 有一个长度为n的序列a[i],其中1到n的整数各自在a[i]中出现恰好一次. 现在已知另一个等长的序列f[i],表示a[i]中以第i ...
- OpenGL入门学习(一)(转)--环境搭建
http://blog.chinaunix.net/uid-20622737-id-1912797.html 说起编程作图,大概还有很多人想起TC的#include <graphics.h> ...
- 理解python的super
def super(cls, inst): mro = inst.__class__.mro() return mro[mro.index(cls) + 1] super做了这些事 摘自:https: ...
- UCRT: VC 2015 Universal CRT, by Microsoft
https://blogs.msdn.microsoft.com/vcblog/2015/03/03/introducing-the-universal-crt/ App local UCRT DLL ...
- 简述web工程师的职责与学习
最近两年web突然很火,也有很多人涌入这一行,但这行实际上是进来的人很多,出去的人也很多. 在我眼里,Web前端开发工程师的职责有:1.Web前端表现层及与前后端交互的架构设计和开发2.配合后台开发人 ...
- HDU 6351暴力枚举 6354计算几何
Beautiful Now Time Limit: 5000/2500 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)T ...
- 洛谷—— P1680 奇怪的分组
https://www.luogu.org/problemnew/show/1680 题目背景 终于解出了dm同学的难题,dm同学同意帮v神联络.可dm同学有个习惯,就是联络同学的时候喜欢分组联络,而 ...