背加法口诀表:gpg文件加密解密

来源:百度文库 编辑:九乡新闻网 时间:2024/04/28 13:38:17
随着网络与计算机技术的发展,数据存储与数据交换的安全性已经变得越来越重要,加密技术已经很早就用于数据存储和数据交换。为了确保网络数据交换时的双方身份的正确性,签证体系也已经成熟。GPG就是用来加密数据与制作证书的一套工具。  
GPG是一个完全免费、源代码公开,并且与PGP完全兼容的软件产品。GPG软件作为用于加密和数字签名的开放源码工具,许多Linux发行版本都自带了该软件。在默认安装的情况下,gpg会作为一个基本命令事先安装好。 
如果选用的Linux发行版默认没有安装GPG,可以通过tar包或RPM包进行安装,可从http://www.gnupg.org/download/下载安装包。 
判断是否安装有GPG的方法也很简单。直接在命令行下输入“gpg -h”命令,如果系统已经安装有GPG,就会显示关于GPG用法的信息。 
确定Linux系统中已经安装了GPG后,就可以开始下面加密和签名的工作了。 gpg文件加密解密步骤生成密钥输入用户信息Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O                >>确认OK
You need a Passphrase to protect your secret key.   Enter passphrase:                                           >>输入密码口令Repeat passphrase:  生成密钥过程 We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
+++++.++++++++++>.++++++++++...........................................................+++++
                                                                         >>生成密钥过程会出现连续的这种符号。
Not enough random bytes available. Please do some other work to give
the OS a chance to collect more entropy! (Need 215 more bytes)
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.            >>该信息提示用户在系统上创建一些随机的活动,这个时候您可以多做些琐事(像敲打键盘、移动
鼠标、读写硬盘之类的),这会让随机数字发生器有更好的机会获得足够的熵数。 gpg: /root/.gnupg/trustdb.gpg:trustdb created        >>密钥生成成功!public and secret key created and signed.
key marked as ultimately trusted.   查看.gnupg目录下的公钥文件,提取生成的公钥文件并导入到pubring.gpg中。创建test.log加密测试文件。对test.log文件进行加密。对test.log.asc文件进行解密。