encrypt and decrypt data
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的更多相关文章
- js读取cookie,并利用encrypt和decrypt加密和解密方法
以下为支持encrypt和decrypt加密和解密方法 eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a ...
- oracle加密encrypt,解密decrypt
目录 oracle加密encrypt,解密decrypt 加密 解密 oracle加密encrypt,解密decrypt 有的oracle版本没有加解密函数,以下操作可以手动添加 oracle数据使用 ...
- C# 加密(Encrypt) 解密(Decrypt) 操作类 java与 C# 可以相互加密解密
public sealed class EncryptUtils { #region Base64加密解密 /// <summary> /// Base64加密 /// </summ ...
- /encrypt和/decrypt端点来进行加密和解密的功能
- Fedora 22中的RPM软件包管理工具
Introduction The RPM Package Manager (RPM) is an open packaging system that runs on Fedora as well a ...
- ssl 握手过程【收藏】
收藏几篇关于ssl handshake的好文 http://www.slashroot.in/comment/1242 SSL protocol, does its fantastic job of ...
- https那些事儿
(一)SSL/TLS协议运行机制的概述 一.作用 不使用SSL/TLS的HTTP通信,就是不加密的通信.所有信息明文传播,带来了三大风险. (1) 窃听风险(eavesdropping):第三方可以获 ...
- 关于ssh的一篇很好的文章
源地址:http://www.w3hacker.com/?p=156 ssh-agent的manual写得倒是挺详细,可看了好几次都没怎么搞明白.08年在网上找到了非常好的一篇文章,An Illu ...
- netty Architectural Overview --reference
reference from:http://docs.jboss.org/netty/3.1/guide/html/architecture.html 2.1. Rich Buffer Data St ...
随机推荐
- python笔记3-输出输入、字符串格式化
输入.输出 python怎么来接收用户输入呢,使用input函数,python2中使用raw_input,接收的是一个字符串,输出呢,第一个程序已经写的使用print,代码入下: 1 2 name=i ...
- HDU 2602 Bone Collectors(背包问题,模版)
Bone Collector Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)To ...
- Linux alias别名命令
首先介绍一下命令的别名,怎么查看的呢? 咱们使用which命令就可以查看的到它完整的命令是怎样的 [root@master ~]# which ls alias ls='ls --color=auto ...
- Spring学习四
1先导入 Asject的jar包 2配置文件加入标签 ,并加入 <aop:aspectj-autoproxy proxy-target-class="true">(如果 ...
- pytest 的 yield
前言:1.当 pytest.fixture(scope="module") 时,pytest的yieId 类似unittest的teartownclass 2.当 pytest.f ...
- Day6作业及默写
1.使⽤循环打印以下效果: 1: * ** *** **** ***** for num in range(1,6): print('*' * num) 2: ***** **** *** ** * ...
- js第一天学习内容
var a=12: var t=(- -a)-(a- -)+(a++)-(a++) console.log(a) t=-1: a=12: (- -a)=11-(a=11- -)=10+(a=10++) ...
- 前端笔记 (2.CSS)
知识点借鉴于慕课网,菜鸟教程和w3shool CSS方面: CSS全称为“层叠样式表”,它主要是用于定义HTML内容在浏览器内的显示样式,如文字大小.颜色.字体加粗等. 使用CSS样式的一个好处是通过 ...
- java连接操作数据库
Connection 类prepareStatement(String sql) 创建一个 PreparedStatement 对象来将参数化的 SQL 语句发送到数据库. PreparedState ...
- 常用文本编辑器 editor 的常用插件 —— CopyEdit
1. CopyEdit http://www.conyedit.com/, 跨平台的文本编辑器插件: 监控粘贴板以及支持命令解析 其官网上有其动图演示: