接上面一篇blog 发现openssl 生成server.crt 时有问题. 找了一个网站处理了一下:

http://blog.sina.com.cn/s/blog_49f8dc400100tznt.html

OpenSSL生成证书对

(2011-09-29 11:28:34)

标签:

杂谈

分类: Freebsd

OpenSSL具体安装及使用此文中不再累赘,请参考网上相关文档。

  1. 首先生成X509格式的CA自签名证书 
    $openssl req -new -x509 -keyout myca.key -out myca.crt –days  90
  2. 生成SSL客户端的私钥(key文件)及csr文件 
    $openssl genrsa -des3 -out SSL.key 1024 –days 90
    $openssl req -new -key SSL.key -out SSL.csr –days 90
  3. 用生成的CA的证书为刚才生成的SSL.csr文件签名 
    $openssl ca -in SSL.csr -out SSL.crt -cert myca.crt -keyfile myca.key –days 90
  4. 生成p12格式证书 
    $openssl pkcs12 -export -inkey SSL.key -in SSL.crt -out SSL.pfx

完成以上操作后在当前目录下会有六个文件,分别是myca.crt,myca.key,SSL.crt,SSL.csr,SSL.key,SSL.pfx。其中CA的公钥myca.crt 和用户的私钥 SSL.pfx是我们需要的文件。

如果在这步出现错误信息:
[weigw@TEST bin]$ openssl ca -in client.csr -out client.crt -cert ca.crt -keyfile ca.key 
Using configuration from /usr/share/ssl/openssl.cnf I am unable to access the ./demoCA/newcerts directory ./demoCA/newcerts: No such file or directory 
[weigw@TEST bin]$ 
自己手动创建一个CA目录结构:
[weigw@TEST bin]$ mkdir ./demoCA
[weigw@TEST bin]$ mkdir demoCA/newcerts
创建个空文件:
[weigw@TEST bin]$ vi demoCA/index.txt

创建文件:
[weigw@TEST bin]$ vi demoCA/serial

向文件中写入01

并且第二行空一行

[转帖] ./demoCA/newcerts: No such file or directory openssl 生成证书时问题的解决.的更多相关文章

  1. oracle 库文件解决的方法 bad ELF interpreter: No such file or directory

    今天是2014-05-27,今天遇到一个lib问题,再次记录一下.这是一个案例,更是一种解决该问题的方法过程. 当我们在使用sqlplus 登陆unix数据库的时候,有可能出现类似:xxxxxx ba ...

  2. /usr/bin/env: node: no such file or directory

    今天在安装gulp的之后,运行gulp命令出现了如下报错: /usr/bin/env: node: no such file or directory 网上找了好久,终于解决了,所以记录一下,便于下次 ...

  3. plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file or directory

    装一台新服务器环境的时候,装uwsgi报错: plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file or di ...

  4. mininet *** Error: RTNETLINK answers: No such file or directory 问题及解决方法

    一.问题 按照mininet官网中从源码安装步骤进行安装后,运行命令sudo mn --link tc,bw=10,提示说*** Error: RTNETLINK answers: No such f ...

  5. No such file or directory 8356:error:02001003:system library:fopen:No such process:crypto\bio\bss_file.c:7 4:fopen

    使用OpenSSL生成证书,构建根证书前,需要构建随机数文件(.rand),命令如下: openssl rand - 报错如下: OpenSSL> rand - Can't open priva ...

  6. Git异常:fatal: could not create work tree dir 'XXX': No such file or directory

    GitHub实战系列汇总:http://www.cnblogs.com/dunitian/p/5038719.html ———————————————————————————————————————— ...

  7. Warning: mysql_connect(): No such file or directory 解决方案总结(操作系统: Mac)

    说明: 本文主要内容参考: Mac下PHP连接MySQL报错"No such file or directory"的解决办法, 并进行个人补充 1. 运行环境: Mac OS X 10.11.4 (M ...

  8. python3: error while loading shared libraries: libpython3.5m.so.1.0: cannot open shared object file: No such file or directory

    安装python3遇到报错: wget https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz ./configure --prefix=/u ...

  9. Mac 配置 php-fpm 时出现'/private/etc/php-fpm.conf': No such file or directory (2)

    https://github.com/musicode/test/issues/5 Mac 自带 php-fpm,在终端执行 php-fpm,会报如下错误: ERROR: failed to open ...

随机推荐

  1. 019_linuxC++之_函数模板引入

    (一)首先我们来看非模板程序,函数只是输入不一样的变量就需要构件很多个不一样的函数,那么这样很麻烦,则引入函数模板 int& max(int& a, int& b) { ret ...

  2. BZOJ 4070: [Apio2015]雅加达的摩天楼 根号分治+spfa

    此题卡Dijkstra... Code: #include <bits/stdc++.h> #define N 30005 #define M 4000000 #define ll lon ...

  3. CDialog::DoModal()问题和_WIN32_WINNT

    1.从CDialogEx派生自己的CMyDialog,到DoModal()时总提示 error C2039: "DoModal": 不是"CMyDialog"的 ...

  4. linux系统nginx下反向代理解析二级目录泛目录教程

    解析规则1:     location /目录名 {           proxy_pass http://ip/目录名;           } 解析规则2:  location /目录名{    ...

  5. python 鼠标输入

    import win32con import win32api import time win32api.SetCursorPos([,]) # 设置鼠标位置 time.sleep(0.1) #win ...

  6. Ranorex连接Android

    开始在Android上进行移动测试 只需按照下面的步骤开始使用Android进行移动测试. 1.连接设备(USB/Wi-Fi) 2.在Ranorex中添加设备 3.将设备名称设置为参数值 4.运行示例 ...

  7. 20.包含min函数的栈 Java

    题目描述 定义栈的数据结构,请在该类型中实现一个能够得到栈中所含最小元素的min函数(时间复杂度应为O(1)). 思路 借助辅助栈实现: 压栈时:若辅助栈为空,则将节点压入辅助栈.否则,当当前节点小于 ...

  8. Leetcode题目160.相交链表(简单)

    题目描述 编写一个程序,找到两个单链表相交的起始节点. 如下面的两个链表: 在节点 c1 开始相交. 输入:intersectVal = 8, listA = [4,1,8,4,5], listB = ...

  9. Linux设备驱动程序 之 Makefile

    典型的模块Makefile如下所示: ifneq ($(KERNELRELEASE),) obj-m := hello.o else KERNELDIR ?=/lib/modules/$(shell ...

  10. mysql主从复制原理及步骤

    原理: 1master开启bin-log功能,日志文件用于记录数据库的读写增删2需要开启3个线程,master IO线程,slave开启 IO线程 SQL线程,3Slave 通过IO线程连接maste ...