个人认为,公钥私钥是两种不同的密码体制,而不是两个不同的应用或两个不同的密钥。因此在加密和签名应用中,公钥私钥均可以使用。
机器B:
A:# useradd bofeng
# passed bofeng --->>redhat
# su - bofeng
# gpg --gen-key
1 -- 1024 -- 0 -- y -- bobbob -- bob@bob.com -- redhatbob -- O -- xxxxx
B:# useradd alice
# passwd alice --->>redhat
# su - alice
# gpg --gen-key
1 -- 1024 -- 0 -- y -- alice -- alice@alice.com -- redhatalice -- O -- xxxxx
A:
# gpg --import /tmp/alice.pubkey (导入alice的公钥)
# vim mail.txt
xxxxxxxx
# gpg -sea mail.txt (会声称一个mail.txt.asc 的文件,将该文件拷给alice用户)
B:
# gpg mail.txt.asc (验证文件签名,会生成一个mail.txt文件)
# cat mail.txt
这里只是做了一个简单的试验,更复杂的试验还需要耐心的配置。