日期:2014-05-16  浏览次数:20626 次

linux下使用openssl加密文件

1.加密一个文件:

   [root@fxvsystem root]# openssl enc -des -e -a -in install.log -out install.log.des
   enter des-cbc encryption password:
   Verifying - enter des-cbc encryption password:

  输入密码之后,就会生成install.log.des文件,这个文件名是自己指定的,可以随意写。

  其中:
  enc表明你打算使用某个算法
  -des是具体使用的某个算法
  -e 表明要加密
  -a 同样是使用ASCII进行编码
  -in 要加密的文件名字
  -out 加密后的文件名字

2、解密文件
  把生成的文件传到另一台机器后,执行如下命令进行解密

   [root@fxvsystem gpg]# openssl enc -des -d -a -in install.log.des -out install.log
   enter des-cbc decryption password:输入口令后,就可以得到解密后的文件了。

  其中
  -d表明要进行解密。