一、简介

enc - 对称加密例程,使用对称密钥对数据进行加解密,特点是速度快,能对大量数据进行处理。算法有流算法和分组加密算法,流算法是逐字节加,由于其容易被破译,现在已很少使用;分组加密算法是将数据分成固定大小的组里,然后逐组进行加密,如DES。分组算法中又有ECB,CBC,CFB,OFB,CTR等工作模式,其中默认选CBC工作模式。

二、语法

openssl enc -ciphername[-in filename] [-out filename] [-pass arg] [-e] [-d] [-a/-base64] [-A] [-k password] [-kfile filename] [-K key] [-iv IV] [-S salt] [-salt] [-nosalt] [-z] [-md] [-p] [-P] [-bufsize number] [-nopad] [-debug] [-none] [-engine id]

选项

-in <file>     input file
-out <file> output file
-pass <arg> pass phrase source
-e encrypt
-d decrypt
-a/-base64 base64 encode/decode, depending on encryption flag
-k passphrase is the next argument
-kfile passphrase is the first line of the file argument
-md the next argument is the md to use to create a key
from a passphrase. See openssl dgst -h for list.
-S salt in hex is the next argument
-K/-iv key/iv in hex is the next argument
-[pP] print the iv/key (then exit if -P)
-bufsize <n> buffer size
-nopad disable standard block padding
-engine e use engine e, possibly a hardware device.

三、实例

1、使用des3算法对文件进行加密,并解密

openssl enc -p -des3 -pass pass: -in test.txt -out cipher.txt 
openssl enc -d -des3 -pass pass:123456 -in cipher.txt -out plain.txt

2、加密对数据进行base64编码,并在解密前对数据进行base64解码

openssl enc -p -des3 -a -pass pass: -in test.txt -out cipher.txt
openssl enc -d -des3 -a -pass pass: -in cipher.txt -out plain.txt

Openssl enc命令的更多相关文章

  1. openssl enc(对称加密)

    openssl系列文章:http://www.cnblogs.com/f-ck-need-u/p/7048359.html 对称加密工具.了解对称加密的原理后就很简单了,原理部分见下文. openss ...

  2. (9) openssl enc(对称加密)

    对称加密工具,了解对称加密的原理后就很简单了,原理部分见下文. openssl   enc  -ciphername   [-in filename]   [-out filename]   [-pa ...

  3. openssl 对称加密算法enc命令详解

    1.对称加密算法概述 openssl的加密算法库提供了丰富的对称加密算法,我们可以通过openssl提供的对称加密算法指令的方式使用,也可以通过调用openssl提供的API的方式使用. openss ...

  4. 7.openssl enc

    对称加密工具.了解对称加密的原理后就很简单了. [root@xuexi tmp]# man enc NAME enc - symmetric cipher routines SYNOPSIS open ...

  5. openssl enc 加解密

    国内私募机构九鼎控股打造APP,来就送 20元现金领取地址:http://jdb.jiudingcapital.com/phone.html内部邀请码:C8E245J (不写邀请码,没有现金送)国内私 ...

  6. 使用openssl在命令行加密

    对于需要在应用软件中进行加密编程的开发者,通过命令行把基本的加密操作做一遍是很有意义的.openssl支持在命令行进行各种基本加密算法的操作.这些操作过程无需编程,其命令参数与程序函数调用加密的参数有 ...

  7. openssl常用命令行汇总

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

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

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

  9. Openssl asn1parse命令

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

随机推荐

  1. foreach(PHP学习)

    先来看一个例子: $arr = array(0,1,2,3,4);让数组的每个值都变成原来的两倍,应该怎么来实现? 如果没有学习foreach之前,会想到用for循环 <?php $arr = ...

  2. C/S模式与B/S模式的详细介绍

    网络程序开发的两种计算模式--C/S模式与B/S模式.两种各有千秋,用于不同场合. C/S适用于专人使用,安全性要求较高的系统: B/S适用于交互性比较频繁的场合,容易被人们所接受,倍受用户和软件开发 ...

  3. 引用 LPSTR、LPCSTR、LPTSTR、LPCTSTR、LPWSTR及LPCWSTR的意义及区别

    1.ANSI(即MBCS):为多字节字符集,它是不定长表示世界文字的编码方式.ANSI表示英文字母时就和ASCII一样,但表示其他文字时就需要用多字节.   2.Unicode:用两个字节表示一个字符 ...

  4. SAX解析类:SaxHelper

    public class SaxHelper extends DefaultHandler { private Person person; private ArrayList<Person&g ...

  5. windows 安装redis

    git :https://github.com/ServiceStack/redis-windows 备份地址:https://gitee.com/liuq1991v/redis-for-window ...

  6. 同步机制之--java CyclicBarrier 循环栅栏

    CyclicBarrier介绍一个同步辅助类,它允许一组线程互相等待,直到到达某个公共屏障点 (common barrier point).在涉及一组固定大小的线程的程序中,这些线程必须不时地互相等待 ...

  7. SQL Server 2005/2008压缩数据库日志的方法

    适用于SQL Server 2005的方法 Backup Log DNName WITH no_log GO DUMP TRANSACTION DNName WITH no_log GO USE DN ...

  8. java.lang.ArrayIndexOutOfBoundsException异常分析及解决

    这是一个非常常见的异常,从名字上看是数组下标越界错误,解决方法就是查看为什么下标越界. 下面是一个错误示例: Exception in thread "main" java.lan ...

  9. css ! important 兼容性的一点测试

    css ! important 这个东西网上一堆内容,我只说我用到的一点地方和我的理解, 这个东西ie6不支持,ie高版本是支持的.其他浏览器也是支持.先理解这一点 .abc { width:100p ...

  10. Shift Operations on C

    The C standard doesn't precisely define which type of right shift should be used. For unsigned data, ...