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网站,我们需要申请一个世界范 ...
随机推荐
- Java基础复习--java.util.Timer定时任务
在java中,Timer类主要用于定时性.周期性任务 的触发,这个类中有两个方法比较难理解,那就是schedule和scheduleAtFixedRate方法,在这里就用实例分析一下. (1)sche ...
- 转:android service总结2
转载请注明出处:http://blog.csdn.net/guolin_blog/article/details/11952435 相信大多数朋友对Service这个名词都不会陌生,没错,一个老练的A ...
- java IO的字节流和字符流及其区别
1. 字节流和字符流的概念 1.1 字节流继承于InputStream OutputStream, 1.2 字符流继承于InputStreamReader OutputStre ...
- 基于CSOCKET的Client简单实例(转)
原文转自 http://blog.csdn.net/badagougou/article/details/78410382 第一步:创建一个基类为CSOCKET类的新类,Cclient,并在主对话框类 ...
- css之其它技巧和经验列表
其它技巧和经验列表(*以下实例默认运行环境都为Standard mode): 如何让层在falsh上显示? 方法: ``` 设置flash的wmode值为transparent或opaque ``` ...
- Mina框架的学习笔记——Android客户端的实现
Apache MINA(Multipurpose Infrastructure for Network Applications) 是 Apache 组织一个较新的项目,它为开发高性能和高可用性的网络 ...
- AC日记——The Meeting Place Cannot Be Changed codeforces 780b
780B - The Meeting Place Cannot Be Changed 思路: 二分答案: 代码: #include <cstdio> #include <cstrin ...
- AC日记——[WC2013]糖果公园 cogs 1817
[WC2013]糖果公园 思路: 带修改树上莫队(模板): 来,上代码: #include <cmath> #include <cstdio> #include <cst ...
- [thinkphp] 如何解析ajaxReturn返回的json字符串
success: function(data){ var dataObj=eval("("+data+")");//转换为json对象 alert(dataOb ...
- 【微信】根据appid, secret, code获取用户基本信息
function getUserInfo(){ $appid = "yourappid"; $secret = "yoursecret"; $code = $_ ...