https://www.cyberciti.biz/tips/linux-how-to-encrypt-and-decrypt-files-with-a-password.html

Encrypting a file in Linux or Unix

To encrypt a single file, use command gpg as follows:
$ gpg -c filename
To encrypt myfinancial.info.txt file, type the command:
$ gpg -c myfinancial.info.txt
Sample output:

Enter passphrase:<YOUR-PASSWORD>
Repeat passphrase:<YOUR-PASSWORD>

This will create a myfinancial.info.txt.gpg file:
$ ls -l myfinancial.info.txt*
Sample outputs:

-rw-rw-r-- 1 vivek vivek  23 Jan 13 15:01 myfinancial.info.txt
-rw-rw-r-- 1 vivek vivek 113 Jan 13 15:01 myfinancial.info.txt.gpg

Where,

  • -c : Encrypt with a symmetric cipher using a passphrase. The default symmetric cipher used is AES128, but may be chosen with the --cipher-algo option.

You can delete myfinancial.info.txt file:
$ rm myfinancial.info.txt
Please note that if you ever forgot your password (passphrase), you cannot recover the data as it use very strong encryption.

Decrypt a file in Linux or Unix-like system

To decrypt file use the gpg command as follow:
$ gpg myfinancial.info.txt.gpg
OR
$ gpg -d myfinancial.info.txt.gpg
OR
$ gpg --decrypt myfinancial.info.txt.gpg
Sample outputs:

gpg myfinancial.info.txt.gpg
gpg: CAST5 encrypted data
Enter passphrase:<YOUR-PASSWORD>

To view your file, type:
$ ls -l myfinancial.info.txt
$ cat myfinancial.info.txt
$ vi myfinancial.info.txt

Decrypt file and write output to file vivek.info.txt you can run command:
$ gpg myfinancial.info.gpg -o vivek.info.txt
OR
$ gpg -d myfinancial.info.gpg --output vivek.info.txt
Also note that if file extension is .asc, it is a ASCII encrypted file
and if file extension is .gpg, it is a binary encrypted file.

The windows tool is provided

https://gnupg.org/download/

encrypt and decrypt data的更多相关文章

  1. js读取cookie,并利用encrypt和decrypt加密和解密方法

    以下为支持encrypt和decrypt加密和解密方法 eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a ...

  2. oracle加密encrypt,解密decrypt

    目录 oracle加密encrypt,解密decrypt 加密 解密 oracle加密encrypt,解密decrypt 有的oracle版本没有加解密函数,以下操作可以手动添加 oracle数据使用 ...

  3. C# 加密(Encrypt) 解密(Decrypt) 操作类 java与 C# 可以相互加密解密

    public sealed class EncryptUtils { #region Base64加密解密 /// <summary> /// Base64加密 /// </summ ...

  4. /encrypt和/decrypt端点来进行加密和解密的功能

  5. Fedora 22中的RPM软件包管理工具

    Introduction The RPM Package Manager (RPM) is an open packaging system that runs on Fedora as well a ...

  6. ssl 握手过程【收藏】

    收藏几篇关于ssl handshake的好文 http://www.slashroot.in/comment/1242 SSL protocol, does its fantastic job of ...

  7. https那些事儿

    (一)SSL/TLS协议运行机制的概述 一.作用 不使用SSL/TLS的HTTP通信,就是不加密的通信.所有信息明文传播,带来了三大风险. (1) 窃听风险(eavesdropping):第三方可以获 ...

  8. 关于ssh的一篇很好的文章

    源地址:http://www.w3hacker.com/?p=156   ssh-agent的manual写得倒是挺详细,可看了好几次都没怎么搞明白.08年在网上找到了非常好的一篇文章,An Illu ...

  9. netty Architectural Overview --reference

    reference from:http://docs.jboss.org/netty/3.1/guide/html/architecture.html 2.1. Rich Buffer Data St ...

随机推荐

  1. 第三篇 功能实现(2) (Android学习笔记)

    第三篇 功能实现(2) ●Activity的四种启动模式 Activity的启动模式有四种,分别是standard.singleTop.singleTask和singleInstance. 在Andr ...

  2. 在MATLAB中安装MinGW-w64 C/C++ 编译器的方法

    reference:http://blog.sina.com.cn/s/blog_167bbdec10102x113.html 在MATLAB中编译C/C++ 文件时出现以下情况: 说明缺少MinGW ...

  3. socket-重叠模型(overlap)

    socket-重叠模型(overlap) 重叠模型的基本设计原理便是让应用程序使用一个重叠的数据结构,一次投递一个或多个Winsock I/O请求.针对那些提交的请求,在它们完成之后,应用程序可为它们 ...

  4. Linux可重入函数和线程安全的区别与联系(转)

    *****可重入函数 函数被不同的控制流程调用,有可能在第一次调用还没返回时就再次进入该函数,这称为重入. 当程序运行到某一个函数的时候,可能因为硬件中断或者异常而使得在用户正在执行的代码暂时终端转而 ...

  5. github咋用昂

    github-trend:https://github.com/trending github-usingway:https://zhuanlan.zhihu.com/p/41899093 githu ...

  6. 相册 垂直居中; 水平居中. 1)宽度 大于高度, 宽度 100%; 2) 高度 大于 宽度 , 高度100%; getimagesize , list --->line-height , text-align, vertical-align, max-height, max-width

    一: 效果: 1) 黑色 部分是 相框. 2) 图片 要实现 水平居中, 垂直居中 3) 如果 宽度 大于 高度 ,那么 宽度 100% ,如图1 , 高度 自适应 ,同时不能超过黑色相框的 高度 ; ...

  7. jetty404web界面服务器信息隐藏

    jetty服务器报以上的404错误时,为了信息安全必须隐藏信息错误提示 在jetty的配置文件jetty.xml添加以下内容: 重启一下jetty服务器就OK了,在验证时是这样的:

  8. embedding与word2vec

    embedding是指将目标向量化,常用于自然语言处理(如:Word2Vec).这种思想的意义在于,可以将语义问题转换为数值计算问题,从而使计算机能够便捷处理自然语言问题.如果采用传统的One-hot ...

  9. python day05 作业答案

    1. b.不可以 c.tu=("alex",[11,22,{"k1":"v1","k2":["age" ...

  10. zookeeper和dubbo中出现的问题

    报错出现timeout关键字 解决:在服务发布时,添加timeout字段 <!-- 5.服务发布 --> <dubbo:service interface="com.sxt ...