一、简介

pkcs12命令能生成和分析pkcs12文件

二、语法

openssl pkcs12 [-export] [-chain] [-inkey filename] [-certfile filename] [-CApath arg] [-CAfile arg]
[-name name] [-caname name] [-in filename] [-out filename] [-noout] [-nomacver] [-nocerts]
[-clcerts] [-cacerts] [-nokeys] [-info] [-noiter] [-maciter] [-nomaciter] [-nomac] [-twopass] [-descert]
[-certpbe alg] [-keypbe alg] [-macalg digest] [-keyex] [-keysig] [-password arg] [-passin arg] [-passout arg]
[-rand file(s)] [-LMK] [-CSP name][-engine e] [-des] [-des3] [-aes128] [-aes192] [-aes256] [-idea]
[-camellia128] [-camellia192] [-camellia256] [-nodes]

选项

-export       output PKCS12 file
-chain add certificate chain
-inkey file private key if not infile
-certfile f add all certs in f
-CApath arg - PEM format directory of CA's
-CAfile arg - PEM format file of CA's
-name "name" use name as friendly name
-caname "nm" use nm as CA friendly name (can be used more than once).
-in infile input filename
-out outfile output filename
-noout don't output anything, just verify.
-nomacver don't verify MAC.
-nocerts don't output certificates.
-clcerts only output client certificates.
-cacerts only output CA certificates.
-nokeys don't output private keys.
-info give info about PKCS# structure.
-des encrypt private keys with DES
-des3 encrypt private keys with triple DES (default)
-idea encrypt private keys with idea
-seed encrypt private keys with seed
-aes128, -aes192, -aes256
encrypt PEM output with cbc aes
-camellia128, -camellia192, -camellia256
encrypt PEM output with cbc camellia
-nodes don't encrypt private keys
-noiter don't use encryption iteration
-nomaciter don't use MAC iteration
-maciter use MAC iteration
-nomac don't generate MAC
-twopass separate MAC, encryption passwords
-descert encrypt PKCS# certificates with triple DES (default RC2-)
-certpbe alg specify certificate PBE algorithm (default RC2-)
-keypbe alg specify private key PBE algorithm (default 3DES)
-macalg alg digest algorithm used in MAC (default SHA1)
-keyex set MS key exchange type
-keysig set MS key signature type
-password p set import/export password source
-passin p input file pass phrase source
-passout p output file pass phrase source
-engine e use engine e, possibly a hardware device.
-rand file:file:...
load the file (or the files in the directory) into
the random number generator
-CSP name Microsoft CSP name
-LMK Add local machine keyset attribute to private key

三、实例

1、PKCS与PEM格式互转

1)PEM转成PKCS12文件(包含CA证书、不包含CA证书)

openssl pkcs12 -export -inkey serverprikey.pem -in server.pem -CAfile demoCA/cacert.pem -password pass:"" -out server.pfx
openssl pkcs12 -export -inkey serverprikey.pem -in server.pem -password pass:"123456" -out server_nocret.pfx

2)PKCS12转成PEM文件

openssl pkcs12 -in server_nocret.pfx -out server_nocret.pem -nodes -password pass:""

2、查看pkcs12信息

openssl pkcs12 -in server.pfx -password pass:"" -info -nocerts –nokeys

Openssl pkcs12命令的更多相关文章

  1. 那些证书相关的玩意儿(SSL,X.509,PEM,DER,CRT,CER,KEY,CSR,P12等)(使用OpenSSL的命令行)

    之前没接触过证书加密的话,对证书相关的这些概念真是感觉挺棘手的,因为一下子来了一大堆新名词,看起来像是另一个领域的东西,而不是我们所熟悉的编程领域的那些东西,起码我个人感觉如此,且很长时间都没怎么搞懂 ...

  2. openssl常用命令行汇总

    openssl常用命令行汇总 随机数 openssl rand -out rand.dat -base64 32 摘要 直接做摘要 openssl dgst -sha1 -out dgst.dat p ...

  3. (转)openssl 命令: openssl req 命令详解

                                      openssl req命令主要的功能有,生成证书请求文件, 查看验证证书请求文件,还有就是生成自签名证书.本文就主要记录一下open ...

  4. Openssl asn1parse命令

    一.简介 asn1parse命令是一种用来诊断ASN.1结构的工具,也能用于从ASN1.1数据中提取数据 二.语法 openssl asn1parse [-inform PEM|DER] [-in f ...

  5. Openssl pkcs7命令

    一.简介 pkcs7命令用于处理DER或者PEM格式的pkcs#7文件.   二.语法 openssl pkcs7 [-inform PEM|DER] [-outform PEM|DER] [-in ...

  6. Openssl crl2pkcs7命令

    一.简介 crl2pkcs命令用来根据CRL或证书来生成pkcs#7消息.   二.语法 openssl crl2pkcs7 [-inform PEM|DER ] [-outform PEM|DER ...

  7. Openssl verify命令

    一.简介 verify命令对证书的有效性进行验证,verify 指令会沿着证书链一直向上验证,直到一个自签名的CA 二.语法 openssl verify [-CApath directory] [- ...

  8. Openssl rsa命令

    一.简介 Rsa命令用于处理RSA密钥.格式转换和打印信息 二.语法 openssl rsa [-inform PEM|NET|DER] [-outform PEM|NET|DER] [-in fil ...

  9. Openssl pkeyutl命令

    一.简介 pkeyutl命令能够测试所支持的密钥算法的性能 二.语法 openssl rsautl [-in file] [-out file] [-sigfile file] [-inkey fil ...

随机推荐

  1. RK3288 双屏异显时,触摸屏(USB接口)无反应

    系统版本:RK3288 android 5.1 设备同时有两个lcd,主屏是mipi接口,带有触摸屏,触摸屏是usb接口,副屏是hdmi接口,没有触摸屏,正常情况下,两个lcd显示相同内容,触摸屏一切 ...

  2. java web----刷新页面的程序 (重复包括)

    <%@ page language="java" import="java.util.*" pageEncoding="gb2312" ...

  3. 汇编_指令_LEA和MOV的区别

    就是目标地址传送指令: 将一个近地址指针写入到指定的寄存器.格式: LEA reg16,mem16 其中reg16必须是一个16位通用寄存器,mem16必须是一个存储器,执行这个指令后,就将mem16 ...

  4. Java-Runoob-高级教程:Java 数据结构

    ylbtech-Java-Runoob-高级教程:Java 数据结构 1.返回顶部 1. Java 数据结构 Java工具包提供了强大的数据结构.在Java中的数据结构主要包括以下几种接口和类: 枚举 ...

  5. mongodb一些语法

    一.DB shell数据操作 shell命令操作语法和JavaScript很类似,其实控制台底层的查询语句都是用JavaScript脚本完成操作的. Ø 数据库   1.Help查看命令提示 help ...

  6. Windows下安装GCC

    1.GCC编译器的选择 Windows下最常见的安装GCC的方式有两种:Cygwin和MinGW.本文主要介绍MinGW的安装配置. 2.下载MinGW 下载地址:http://sourceforge ...

  7. Nginx压力测试工具之WebBench

    Nginx压力测试工具之WebBench   在Apache中有自带的ab命令可以测试服务的压力,而nginx没有自带的命令,必须要采用第三方软件来测试,今天就简单介绍一下webbench对nginx ...

  8. 03-24 Winform图表Chart

    图表主要分为以下几个部分: 1.Annotations--图形注解集合, 2.ChartAreas--图表区域集合, 3.Legends--图例集合, 4.Series--图表序列集合(即图表数据对象 ...

  9. leetcode572

    /** * Definition for a binary tree node. * public class TreeNode { * public int val; * public TreeNo ...

  10. Rust 初始配置

    学习 Rust 初始配置 运行环境:Window7 64bit,Rust nightly 1.23; 作者:乌龙哈里 2017-10-15 参考: Rust 中文教程 Rust 官方网站 Rust G ...