用gpg(Gnu 隐私卫士)来生成自己的密钥

回家折腾建立ubuntu本地源,这个很有用,特别是在上网算流量的学校用linux,方法主要参照这个wiki页面:

http://wiki.ubuntu.org.cn/使用apt-move创建软件库光盘

root@ubuntu:/mirrors/debian# gpg -bao dists/karmic/Release.gpg dists/karmic/Release
gpg: directory `/home/tun/.gnupg' created
gpg: new configuration file `/home/tun/.gnupg/gpg.conf' created
gpg: WARNING: options in `/home/tun/.gnupg/gpg.conf' are not yet active during this run
gpg: keyring `/home/tun/.gnupg/secring.gpg' created
gpg: keyring `/home/tun/.gnupg/pubring.gpg' created
gpg: no default secret key: secret key not available
gpg: signing failed: secret key not available

当执行以上蓝色字体的命令的时候出错了。这个命令功能是生成Release文件的gpg密钥。从字面意思来理解应该是gpg没有默认的gpg密钥, 参照这个minihowto: Gnu 隐私卫士 (GnuPG) 袖珍 HOWTO (中文版) 发现可以用gpg –gen-key来生成自己的密钥:(蓝色字体是我输入的)

root@ubuntu:/mirrors/debian# gpg –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.

Please select what kind of key you want:
(1) DSA and Elgamal (default)
(2) DSA (sign only)
(5) RSA (sign only)
Your selection? 1
DSA keypair will have 1024 bits.
ELG-E keys may be between 1024 and 4096 bits long.
What keysize do you want? (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: tunpishuang
Email address: tunpishuang@gmail.com
Comment: just 4 fun.
You selected this USER-ID:
"tunpishuang (just 4 fun.) <tunpishuang@gmail.com>"

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

gpg: gpg-agent is not available in this session
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.
++++++++++++++++++++++++++++++.+++++.++++++++++++++++++++++++++++++.++++++++++++++++++++++++++++++.+++++++++++++++++++++++++.+++++.+++++>+++++.+++++……………..>+++++…+++++
ds
Not enough random bytes available.  Please do some other work to give
the OS a chance to collect more entropy! (Need 283 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.
+++++…++++++++++..++++++++++.++++++++++..+++++++++++++++..+++++…++++++++++++++++++++.+++++++++++++++++++++++++.+++++..++++++++++++++++++++++++++++++…+++++..+++++>…++++++++++>+++++.>.+++++……<.+++++……………..<+++++>..+++++…………………………………………………………………………………………………………………………………………..<+++++…>+++++…………………………………..+++++^^^^^^^^^

(上面这一砣蓝字的主要意思是通过移动鼠标和写入/输出硬盘数据来生成随机数字,我一般使用du / 命令)
gpg: key EDA38ECC 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/EDA38ECC 2009-08-20
Key fingerprint = 8B43 BB97 2716 0124 83C5  D73B DEE3 732F EDA3 8ECC
uid                  tunpishuang (just 4 fun.) <tunpishuang@gmail.com>
sub   2048g/15197563 2009-08-20

root@ubuntu:/mirrors/debian# gpg –list-keys    (生成成功了)
/home/tun/.gnupg/pubring.gpg
—————————-
pub   1024D/EDA38ECC 2009-08-20
uid                  tunpishuang (just 4 fun.) <tunpishuang@gmail.com>
sub   2048g/15197563 2009-08-20

root@ubuntu:/mirrors/debian# apt-key list (通过这个我们发现改gpg的key和apt的key不是一个库的,但是可以通过gpg导入到apt-key中)
/etc/apt/trusted.gpg
——————–
pub   1024D/437D05B5 2004-09-12
uid                  Ubuntu Archive Automatic Signing Key <ftpmaster@ubuntu.com>
sub   2048g/79164387 2004-09-12

pub   1024D/FBB75451 2004-12-30
uid                  Ubuntu CD Image Automatic Signing Key <cdimage@ubuntu.com>

root@ubuntu:/mirrors/debian# gpg -bao dists/karmic/Release.gpg dists/karmic/Release (执行成功)

You need a passphrase to unlock the secret key for (这点输入私人密钥就ok)
user: "tunpishuang (just 4 fun.) <tunpishuang@gmail.com>"
1024-bit DSA key, ID EDA38ECC, created 2009-08-20

gpg: gpg-agent is not available in this session

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值