一键开启网站,北京有哪些不错的互联网公司,推广途径有哪些,网站建设一年多少2019独角兽企业重金招聘Python工程师标准 在当前目录下有一个pma目录的文件夹: 1、使用tar对文件压缩加密#xff1a; # tar -zcvf - pma|openssl des3 -salt -k password | dd ofpma.des3 完成将得到一个pma.des3的打包文件#xff0c;用你设置的密码替换pas… 2019独角兽企业重金招聘Python工程师标准 在当前目录下有一个pma目录的文件夹: 1、使用tar对文件压缩加密 # tar -zcvf - pma|openssl des3 -salt -k password | dd ofpma.des3 完成将得到一个pma.des3的打包文件用你设置的密码替换password。 2、使用tar对加密文件解压 # dd ifpma.des3 |openssl des3 -d -k password|tar zxf -注意命令最后有”-”它将释放所有的文件。其中-k password可以不使用这样执行完命令后会提示你输入密码加上-k参数表示在程序中自动验证密码。附OpenSSL加密算法详解 OpenSSL是一个开源的用以实现SSL协议的产品它主要包括了三个部分密码算法库、应用程序、SSL协议库。Openssl实现了SSL协议所需要的大多数算法。 下面介绍使用Openssl进行文件的对称加密操作。 一、Openssl支持的加密算法有 -aes-128-cbc -aes-128-cfb -aes-128-cfb1 -aes-128-cfb8 -aes-128-ecb -aes-128-ofb -aes-192-cbc -aes-192-cfb -aes-192-cfb1 -aes-192-cfb8 -aes-192-ecb -aes-192-ofb -aes-256-cbc -aes-256-cfb -aes-256-cfb1 -aes-256-cfb8 -aes-256-ecb -aes-256-ofb -aes128 -aes192 -aes256 -bf -bf-cbc -bf-cfb -bf-ecb -bf-ofb -blowfish -cast -cast-cbc -cast5-cbc -cast5-cfb -cast5-ecb -cast5-ofb -des -des-cbc -des-cfb -des-cfb1 -des-cfb8 -des-ecb -des-ede -des-ede-cbc -des-ede-cfb -des-ede-ofb -des-ede3 -des-ede3-cbc -des-ede3-cfb -des-ede3-ofb -des-ofb -des3 -desx -desx-cbc -rc2 -rc2-40-cbc -rc2-64-cbc -rc2-cbc -rc2-cfb -rc2-ecb -rc2-ofb -rc4 -rc4-40 二、OpenSSL加密指令语法 SYNOPSIS openssl enc -ciphername [-in filename] [-out filename] [-pass arg] [-e] [-d] [-a] [-A] [-k password] [-kfile filename] [-K key] [-iv IV] [-p] [-P] [-bufsize number] [-nopad] [-debug] 说明 -chipername选项加密算法Openssl支持的算法在上面已经列出了你只需选择其中一种算法即可实现文件加密功能。 -in选项输入文件对于加密来说输入的应该是明文文件对于解密来说输入的应该是加密的文件。该选项后面直接跟文件名。 -out选项输出文件对于加密来说输出的应该是加密后的文件名对于解密来说输出的应该是明文文件名。 -pass选项选择输入口令的方式输入源可以是标准输入设备命令行输入文件、变量等。 -e选项实现加密功能不使用-d选项的话默认是加密选项。 -d选项实现解密功能。 -a和-A选项对文件进行BASE64编解码操作。 -K选项手动输入加密密钥不使用该选项Openssl会使用口令自动提取加密密钥。 -IV选项输入初始变量不使用该选项Openssl会使用口令自动提取初始变量。 -salt选项是否使用盐值默认是使用的。 -p选项打印出加密算法使用的加密密钥。 三、用法举例 1、使用aes-128-cbc算法加密文件 openssl enc -aes-128-cbc -in install.log -out enc.log 注这里install.log是你想要加密的文件enc.log是加密后的文件回车后系统会提示你输入密码。 2、解密刚才加密的文件 openssl enc -d -aes-128-cbc -in enc.log -out install.log 注enc.log是刚才加密的文件install.log是解密后的文件-d选项实现解密功能。 3、加密文件后使用BASE64格式进行编码 openssl enc -aes-128-cbc -in install.log -out enc.log -a 4、使用多种口令输入方式加密 openssl enc -des-ede3-cbc -in install.log -out enc.log -pass pass:111111 这种方法的好处是你可以把它写入到脚本中自动完成加密功能不使用pass选项默认系统会提示输入密码并且确认是需要人工操作的。 实际工作中 加密把/root/dowanload目录通过密码加密到/root/test/download.des3 tar -zcvf - /root/download|openssl des3 -salt -k pengzztest | dd of/root/test/download.des3 解密把/root/test/download.des3 通过密码pengzztest解压到/root/test/target/ dd if/root/test/download.des3 |openssl des3 -d -k pengzztest|tar zxf - -C /root/test/target/ 转载于:https://my.oschina.net/china008/blog/309859