SA Blog --系统管理员的博客生涯

书写自己的系统管理博客生涯
posts(330) comments(254) trackbacks(0)
  • IT博客
  • 联系
  • RSS 2.0 Feed 聚合
  • 管理

常用链接

  • 我的随笔
  • 我的评论
  • 我参与的随笔

留言簿

  • 给我留言
  • 查看公开留言
  • 查看私人留言

随笔分类(395)

  • *UNIX系统(148)
  • Cloud(3)
  • Moive
  • Music(1)
  • OpenStack(7)
  • openstack
  • Wiki(1)
  • Windows系统(32)
  • 其他(33)
  • 娱乐
  • 存储相关(22)
  • 存储网络(10)
  • 常用工具下载(25)
  • 数据库应用技术(53)
  • 网络技术(41)
  • 英语
  • 虚拟化(19)

随笔档案(330)

  • 2020年9月 (1)
  • 2020年8月 (1)
  • 2020年7月 (8)
  • 2020年4月 (1)
  • 2020年2月 (1)
  • 2020年1月 (1)
  • 2019年9月 (2)
  • 2019年4月 (1)
  • 2016年1月 (1)
  • 2015年12月 (1)
  • 2015年7月 (4)
  • 2015年5月 (2)
  • 2014年3月 (2)
  • 2014年1月 (1)
  • 2013年12月 (1)
  • 2013年3月 (5)
  • 2013年2月 (4)
  • 2012年12月 (1)
  • 2012年11月 (2)
  • 2012年9月 (2)
  • 2012年8月 (1)
  • 2012年6月 (1)
  • 2012年5月 (1)
  • 2012年1月 (1)
  • 2011年12月 (2)
  • 2011年10月 (1)
  • 2011年9月 (3)
  • 2011年8月 (1)
  • 2011年7月 (5)
  • 2011年6月 (3)
  • 2011年5月 (5)
  • 2011年4月 (2)
  • 2011年3月 (2)
  • 2011年2月 (1)
  • 2011年1月 (5)
  • 2010年12月 (1)
  • 2010年11月 (4)
  • 2010年9月 (13)
  • 2010年8月 (4)
  • 2010年7月 (5)
  • 2010年6月 (5)
  • 2010年5月 (13)
  • 2010年4月 (10)
  • 2010年3月 (5)
  • 2010年2月 (1)
  • 2010年1月 (9)
  • 2009年12月 (5)
  • 2009年11月 (5)
  • 2009年10月 (1)
  • 2009年9月 (3)
  • 2009年8月 (2)
  • 2009年7月 (6)
  • 2009年6月 (3)
  • 2009年5月 (2)
  • 2009年4月 (1)
  • 2009年3月 (2)
  • 2009年2月 (3)
  • 2008年12月 (3)
  • 2008年11月 (1)
  • 2008年10月 (9)
  • 2008年9月 (5)
  • 2008年8月 (3)
  • 2008年7月 (1)
  • 2008年6月 (1)
  • 2008年5月 (2)
  • 2008年4月 (1)
  • 2008年3月 (1)
  • 2008年2月 (3)
  • 2008年1月 (1)
  • 2007年12月 (5)
  • 2007年11月 (1)
  • 2007年10月 (6)
  • 2007年9月 (4)
  • 2007年8月 (4)
  • 2007年7月 (34)
  • 2007年6月 (1)
  • 2007年4月 (2)
  • 2007年3月 (1)
  • 2007年2月 (1)
  • 2006年11月 (1)
  • 2006年9月 (4)
  • 2006年8月 (4)
  • 2006年7月 (1)
  • 2006年6月 (10)
  • 2006年5月 (3)
  • 2006年4月 (14)
  • 2006年2月 (6)
  • 2006年1月 (6)
  • 2005年12月 (12)

收藏夹(5)

  • Other(5)

IT技术

  • MSDN 库(中文)
  • 欢迎使用 MSDN 库(中文),MSDN 库为使用 Microsoft® 工具、产品、技术和服务的开发人员提供必不可少的信息资源。MSDN 库包含操作方法和参考文档、示例代码、技术文章和其他内容。请浏览目录或使用搜索功能来查找所需内容。

健康

  • 体检咨询
  • 北京体检 体检咨询
  • 足医生
  • 足医生

友情链接

  • TestLink中文论坛
  • Testlink 中文论坛
  • 备案专题
  • 备案专题
  • 微软大中华区安全博客
  • 微软大中华区安全博客

存储技术

  • doit存储
  • doit 存储,存储热门论坛
  • ITPUB
  • Oracle DBA 热门中文社区
  • TechTarget IT专家网
  • 蓝德科技

网络技术

  • ChinaUnix 中文社区
  • ChinaUnix 热门中文社区

搜索

  •  

最新评论

  • 1. re: 吐槽一下阿里系软件,就是天天的升级???
  • 评论内容较长,点击标题查看
  • --David
  • 2. re: Symantec Backup exec system recovery 2010(BESR 2010)故障汇总
  • 评论内容较长,点击标题查看
  • --112
  • 3. re: OpenStack安装部署管理中常见问题解决方法(OpenStack-Lite-FAQ)
  • /home/stack/devstack/tools/worlddump.py -d /home/stack/logs
    求救这是什么问题啊。
  • --陈晓龙
  • 4. re: nokia 手机密码忘记后破解
  • nokia 2630,密码不见,恳请帮忙,谢谢
    串号:355219037959407
    lipolipo@gmail.com
  • --沈同学
  • 5. re: chroot 工具 jailkit 限制用户 活动范围 和 权限 _ 笔记
  • 是一个很好的工具嘛。感谢分享。
  • --少林功夫好

阅读排行榜

评论排行榜

View Post

Windows cmd下的GNUgpg的使用方法

原创  Windows cmd下的GNUgpg的使用方法 收藏

生成自己的密钥对:

使 用GnuPG之前必须生成密钥对(公钥和私钥),参数选项”–gen-key”可以生成密钥对。可按如下步骤操作。

cygwin@imdba.cn /cygdrive/c/gnupg
$ gpg.exe –gen-key
gpg (GnuPG) 1.4.9; Copyright (C) 2008 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

gpg: WARNING: using insecure memory!
gpg: please see http://www.gnupg.org/faq.html for more information
gpg: directory `/home/Administrator/.gnupg’ created
gpg: new configuration file `/home/Administrator/.gnupg/gpg.conf’ created
gpg: WARNING: options in `/home/Administrator/.gnupg/gpg.conf’ are not yet active during this run
gpg: keyring `/home/Administrator/.gnupg/secring.gpg’ created
gpg: keyring `/home/Administrator/.gnupg/pubring.gpg’ created
Please select what kind of key you want:
(1) DSA and Elgamal (default)
(2) DSA (sign only)
(5) RSA (sign only)
Your selection?  [回车]
DSA keypair will have 1024 bits.
ELG-E keys may be between 1024 and 4096 bits long.
What keysize do you want? (2048) 2048
Requested keysize is 2048 bits
Please specify how long the key should be valid.
0 = key does not expire
<n>  = key expires in n days
<n>w = key expires in n weeks
<n>m = key expires in n months
<n>y = key expires in n years
Key is valid for? (0)
Key does not expire at all
Is this correct? (y/N) y

You need a user ID to identify your key; the software constructs the user ID
from the Real Name, Comment and Email Address in this form:
“Heinrich Heine (Der Dichter) <heinrichh@duesseldorf.de>”

Real name: Nova
Name must be at least 5 characters long
Real name: xinxing
Email address: imdba@imdba.cn
Comment: imdba.cn
You selected this USER-ID:
“xinxing (imdba.cn) <imdba@imdba.cn>”

Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? o
You need a Passphrase to protect your secret key.

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.
.++++++++++.++++++++++++++++++++.++++++++++++++++++++++++++++++.+++++.++++++++++                                                                             ++++++++++.++++++++++.+++++.++++++++++++++++++++++++++++++>++++++++++………..                                                                             ..>+++++..<+++++……………………+++++
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: /home/Administrator/.gnupg/trustdb.gpg: trustdb created
gpg: key C2839106 marked as ultimately trusted
public and secret key created and signed.
gpg: checking the trustdb
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u
pub   1024D/C2839106 2009-10-24
Key fingerprint = 3851 295C D23C 2FC1 FFC7  9B9B E65C 6392 C283 9106
uid                  xinxing (imdba.cn) <imdba@imdba.cn>
sub   2048g/8F1EB3E9 2009-10-24

导出公钥,提供给他人加密文件传输用

cygwin@imdba.cn /cygdrive/c/gnupg
$ gpg –output pubring.gpg –export –armor> xinxing.asc

cygwin@imdba.cn /cygdrive/c/gnupg
$ gpg –output imdba.cn.asc –export –armor> xinxing.asc
cygwin@imdba.cn /cygdrive/c/gnupg

导入别人提供给自己的公钥

cygwin@imdba.cn /cygdrive/c/gnupg
$ gpg –import xinxingcyou.asc

列出自己拥有的用户的公钥列表

$ gpg.exe –list-keys
gpg: WARNING: using insecure memory!
gpg: please see http://www.gnupg.org/faq.html for more information
/home/Administrator/.gnupg/pubring.gpg
————————————–
pub   1024D/C2839106 2009-10-24
uid                  xinxing (imdba.cn) <imdba@imdba.cn>
sub   2048g/8F1EB3E9 2009-10-24

pub   1024D/294862C4 2009-06-24
uid                  xinxing <xinxing@cyou.com>
sub   2048g/A895F53A 2009-06-24

cygwin@imdba.cn /cygdrive/c/gnupg
$ gpg –fingerprint 294862C4
gpg: WARNING: using insecure memory!
gpg: please see http://www.gnupg.org/faq.html for more information
pub   1024D/ 294862C4 2009-06-24
Key fingerprint = C006 D074 3152 A938 42AD  4DE3 489A 8741 2948 62C4
uid                  xinxing <xinxing@cyou.com>
sub   2048g/A895F53A 2009-06-24

导入密钥之后,可以使用 –sign-key 选项进行签名,签名的目的是证明您完全信任这个xinxing_cyou.asc证书的合法性。

cygwin@imdba.cn /cygdrive/c/gnupg
$ gpg –sign-key 294862C4
gpg: WARNING: using insecure memory!
gpg: please see http://www.gnupg.org/faq.html for more information

pub  1024D/294862C4  created: 2009-06-24  expires: never       usage: SC
trust: unknown       validity: unknown
sub  2048g/A895F53A  created: 2009-06-24  expires: never       usage: E
[ unknown] (1). xinxing <xinxing@cyou.com>

pub  1024D/294862C4  created: 2009-06-24  expires: never       usage: SC
trust: unknown       validity: unknown
Primary key fingerprint: C006 D074 3152 A938 42AD  4DE3 489A 8741 2948 62C4

xinxing <xinxing@cyou.com>

Are you sure that you want to sign this key with your
key “xinxing (imdba.cn) <imdba@imdba.cn>” (C2839106)

Really sign? (y/N) y

You need a passphrase to unlock the secret key for
user: “xinxing (imdba.cn) <imdba@imdba.cn>”
1024-bit DSA key, ID C2839106, created 2009-10-24

对文件加密过程:首先列出对可用加密的用户列表
cygwin@imdba.cn /cygdrive/c/gnupg
$ gpg.exe –list-keys
gpg: WARNING: using insecure memory!
gpg: please see http://www.gnupg.org/faq.html for more information
/home/Administrator/.gnupg/pubring.gpg
————————————–
pub   1024D/C2839106 2009-10-24
uid                  xinxing (imdba.cn) <imdba@imdba.cn>
sub   2048g/8F1EB3E9 2009-10-24

pub   1024D/294862C4 2009-06-24
uid                  xinxing <xinxing@cyou.com>
sub   2048g/A895F53A 2009-06-24

对文件check_mysqlpr.sh进行加密

cygwin@imdba.cn /cygdrive/c/gnupg
$ gpg –sign –encrypt check_mysqlpr.sh
gpg: WARNING: using insecure memory!
gpg: please see http://www.gnupg.org/faq.html for more information

You need a passphrase to unlock the secret key for
user: “xinxing (imdba.cn) <imdba@imdba.cn>”
1024-bit DSA key, ID C2839106, created 2009-10-24
You did not specify a user ID. (you may use “-r”)
Current recipients:
Enter the user ID.  End with an empty line: C2839106
Current recipients:
2048g/8F1EB3E9 2009-10-24 “xinxing (imdba.cn) <imdba@imdba.cn>”
Enter the user ID.  End with an empty line: 294862C4
Current recipients:
2048g/A895F53A 2009-06-24 “xinxing <xinxing@cyou.com>”
2048g/8F1EB3E9 2009-10-24 “xinxing (imdba.cn) <imdba@imdba.cn>”
Enter the user ID.  End with an empty line: 输入空格才会结束

对文件进行解密过程:

cygwin@imdba.cn /cygdrive/c/gnupg
$ gpg -d check_mysqlpr.sh.gpg >check_mysqlpr.sh
gpg: WARNING: using insecure memory!
gpg: please see http://www.gnupg.org/faq.html for more information

You need a passphrase to unlock the secret key for 输入密码
user: “xinxing (imdba.cn) <imdba@imdba.cn>”
2048-bit ELG-E key, ID 8F1EB3E9, created 2009-10-24 (main key ID C2839106)

gpg: encrypted with 2048-bit ELG-E key, ID A895F53A, created 2009-06-24
“xinxing <xinxing@cyou.com>”
gpg: encrypted with 2048-bit ELG-E key, ID 8F1EB3E9, created 2009-10-24
“xinxing (imdba.cn) <imdba@imdba.cn>”
gpg: Signature made Sat Oct 24 12:26:20 2009     using DSA key ID C2839106
gpg: Good signature from “xinxing (imdba.cn) <imdba@imdba.cn>”
cygwin@imdba.cn /cygdrive/c/gnupg
$

参考文章: http://www.gnupg.org/faq.html
http://www.imdba.cn/2009/10/24/windows-cmd-gnugpg-manul/


posted on 2010-05-31 00:24 David 阅读(2401) 评论(1)  编辑 收藏 引用 所属分类: *UNIX系统

只有注册用户登录后才能发表评论。
 
Powered by:
IT博客
Copyright © David