Openssl dgst命令
一、简介
消息摘要可以对任意长度的消息产生固定长度(16或20个字节)的信息摘要,理论基于单向HASH函数,根据消息摘要无法恢复出原文,所以是安全的;消息原文和消息摘要是一一对应的,所以又被称作指纹。
二、语法
openssl dgst[-md5|-md4|-md2|-sha1|-sha|-mdc2|-ripemd160|-dss1] [-c] [-d] [-hex] [-binary] [-out filename] [-sign filename] [-keyform arg] [-passin arg] [-verify filename] [-prverify filename] [-signature filename] [-hmac key] [file...]
选项
-c to output the digest with separating colons
-r to output the digest in coreutils format
-d to output debug info
-hex output as hex dump
-binary output in binary form
-sign file sign digest using private key in file
-verify file verify a signature using public key in file
-prverify file verify a signature using private key in file
-keyform arg key file format (PEM or ENGINE)
-out filename output to filename rather than stdout
-signature file signature to verify
-sigopt nm:v signature parameter
-hmac key create hashed MAC with key
-mac algorithm create MAC (not neccessarily HMAC)
-macopt nm:v MAC algorithm parameters or key
-engine e use engine e, possibly a hardware device.
-md4 to use the md4 message digest algorithm
-md5 to use the md5 message digest algorithm
-ripemd160 to use the ripemd160 message digest algorithm
-sha to use the sha message digest algorithm
-sha1 to use the sha1 message digest algorithm
-sha224 to use the sha224 message digest algorithm
-sha256 to use the sha256 message digest algorithm
-sha384 to use the sha384 message digest algorithm
-sha512 to use the sha512 message digest algorithm
-whirlpool to use the whirlpool message digest algorithm
三、实例
1、对文件进行消息摘要
openssl dgst -md5 test.txt
2、用私钥对消息摘要进行签名,并用公钥进行验签
openssl dgst -md5 -sign prikey.pem -out sign.binary test.txt
openssl dgst -md5 -verify pubkey.pem -signature sign.binary test.txt
3、消息认证码
openssl dgst -md5 -hmac "" test.txt
Openssl dgst命令的更多相关文章
- 5.openssl dgst
该伪命令用于生成文件的信息摘要,也可以进行数字签名,验证数字签名. 首先要明白,要进行数字签名,需要计算出特征码即数字摘要,然后使用私钥对数字摘要进行签名.特征码使用md5,sha等计算出. 对象只能 ...
- openssl dgst(生成和验证数字签名)
openssl系列文章:http://www.cnblogs.com/f-ck-need-u/p/7048359.html 该伪命令是单向加密工具,用于生成文件的摘要信息,也可以进行数字签名,验证数字 ...
- (7) openssl dgst(生成和验证数字签名)
该伪命令是单向加密工具,用于生成文件的摘要信息 也可以进行数字签名,及验证数字签名. 首先要明白的是,数字签名的过程是计算出摘要信息,然后使用私钥对摘要信息进行加密得 ...
- Openssl ca命令
一.简介 ca命令能够签发证书请求文件以及生成CRL列表 二.语法 openssl ca [-verbose] [-config filename] [-name section] [-gencrl] ...
- openssl常用命令行汇总
openssl常用命令行汇总 随机数 openssl rand -out rand.dat -base64 32 摘要 直接做摘要 openssl dgst -sha1 -out dgst.dat p ...
- Openssl x509命令
一.简介 x509指令是一个功能很丰富的证书处理工具.可以用来显示证书的内容,转换其格式,给CSR签名等 二.语法 openssl x509 [-inform DER|PEM|NET] [-outfo ...
- Openssl req命令
一.简介 req指令用来创建和处理PKCS#10格式的证书 二.语法 openssl req [-inform PEM|DER] [-outform PEM|DER] [-in filename] [ ...
- Openssl enc命令
一.简介 enc - 对称加密例程,使用对称密钥对数据进行加解密,特点是速度快,能对大量数据进行处理.算法有流算法和分组加密算法,流算法是逐字节加,由于其容易被破译,现在已很少使用:分组加密算法是将数 ...
- (转)openssl 命令: openssl req 命令详解
openssl req命令主要的功能有,生成证书请求文件, 查看验证证书请求文件,还有就是生成自签名证书.本文就主要记录一下open ...
随机推荐
- Julia 语言的一些尝试
前些天发现了Julia 这门编程语言后便决定对其进行一些尝试,便写了下面的小程序,也算是看看这门语言所谓的速度快到底是怎么快法. 整数累加: x= function fff() : global x ...
- c++ 读取所有图片
copyright by Jun Yang, SUN YAT-SEN UNIVERSITY //FileList.h ///////////////////////////////////////// ...
- linux 模拟生成 CAN 设备
/************************************************************************************** * linux 模拟生成 ...
- [QT]加快qt编译:设置默认多核编译qt
使用环境:win7 + QT Creator 4.2.1 + QT5.8 + MinGW5.3.0 32bit 设置默认多核编译qt 来源:http://stackoverflow.com/ques ...
- Python Logger使用
1. 单文件的logging配置 import logging logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(filen ...
- json-patch 了解
What is JSON Patch? JSON Patch is a format for describing changes to a JSON document. It can be used ...
- linux下nginx安装、配置实战
1什么是Nginx Nginx("enginex")是一个高性能的HTTP和反向代理服务器,也是一个IMAP/POP3/SMTP代理服务器,在高连接并发的情况下Nginx是Apac ...
- 【python】FTP客户端
Python中默认安装的ftplib模块定义了FTP类,其中函数有限,可用来实现简单的ftp客户端,用于上传或下载文件,函数列举如下 ftp登陆连接 from ftplib import FTP #加 ...
- Bootstrap-Plugin:折叠(Collapse)插件
ylbtech-Bootstrap-Plugin:折叠(Collapse)插件 1.返回顶部 1. Bootstrap 折叠(Collapse)插件 折叠(Collapse)插件可以很容易地让页面区域 ...
- alibaba fastjson的使用总结和心得
最初接触alibaba fastjson是由于其性能上的优势,对比原来采用codehause.jackson的解析,在hadoop平台上的手动转换对象有着将近1/3的性能提升,但随着开发应用越来越 ...