GnuPG高级指导在其他电脑上启用“我的密钥”
Posted andypeker
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了GnuPG高级指导在其他电脑上启用“我的密钥”相关的知识,希望对你有一定的参考价值。
1 其他电脑上的密钥
[email protected]:~# gpg -K
/root/.gnupg/secring.gpg
------------------------
sec 1024D/D04D1A0B 2016-11-25 [expires: 2016-12-09]
uid debian8
ssb 2048g/C1845DA4 2016-11-25
sec 4096R/276856F7 2016-11-25 [expires: 2017-04-24]
uid FranklinYang (Encrypt RSA 4096) <[email protected]>
ssb 4096R/0A09DAC9 2016-11-25
可以删掉“临时”密钥 ------ debian8(或者不删也可以)
[email protected]:~# gpg --delete-secret-key D04D1A0B
gpg (GnuPG) 1.4.18; Copyright (C) 2014 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.
sec 1024D/D04D1A0B 2016-11-25 debian8
Delete this key from the keyring? (y/N) y
This is a secret key! - really delete? (y/N) y
[email protected]:~# gpg --delete-key D04D1A0B
gpg (GnuPG) 1.4.18; Copyright (C) 2014 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.
pub 1024D/D04D1A0B 2016-11-25 debian8
Delete this key from the keyring? (y/N) y
[email protected]:~# gpg -k
/root/.gnupg/pubring.gpg
------------------------
pub 4096R/276856F7 2016-11-25 [expires: 2017-04-24]
uid FranklinYang (Encrypt RSA 4096) <[email protected]>
sub 4096R/0A09DAC9 2016-11-25 [expires: 2017-04-24]
[email protected]:~# gpg -K
/root/.gnupg/secring.gpg
------------------------
sec# 4096R/276856F7 2016-11-25 [expires: 2017-04-24]
uid FranklinYang (Encrypt RSA 4096) <[email protected]>
ssb 4096R/0A09DAC9 2016-11-25
[[email protected] ~]#
[[email protected] ~]# gpg -K
/root/.gnupg/secring.gpg
------------------------
sec# 4096R/276856F7 2016-11-25 [expires: 2017-04-24]
uid FranklinYang (Encrypt RSA 4096) <[email protected]>
ssb 4096R/0A09DAC9 2016-11-25
[[email protected] ~]# gpg -k
/root/.gnupg/pubring.gpg
------------------------
pub 4096R/276856F7 2016-11-25 [expires: 2017-04-24]
uid FranklinYang (Encrypt RSA 4096) <[email protected]>
sub 4096R/0A09DAC9 2016-11-25 [expires: 2017-04-24]
[[email protected] ~]#
[[email protected] ~]#
2 加密在debian8解密
opensuse13:~ #
opensuse13:~ # vi temp_txt.log
opensuse13:~ # cat temp_txt.log
Try
decrypt
on
debian
8
with
new
secret
key
!
opensuse13:~ #
opensuse13:~ #
opensuse13:~ # gpg -u "FranklinYang" -r "FranklinYang" -a -o temp_txt.log.gpg -e temp_txt.log
opensuse13:~ # l temp_txt.log.gpg
-rw-r--r-- 1 root root 969 Nov 26 14:22 temp_txt.log.gpg
opensuse13:~ #
opensuse13:~ #
opensuse13:~ # scp temp_txt.log.gpg [email protected]:/home/franklin/
[email protected]‘s password:
temp_txt.log.gpg 100% 969 1.0KB/s 00:00
opensuse13:~ #
opensuse13:~ #
opensuse13:~ #
(在debian8上解密)
[email protected]:~# gpg -d temp_txt.log.gpg
You need a passphrase to unlock the secret key for
user: "FranklinYang (Encrypt RSA 4096) <[email protected]>"
4096-bit RSA key, ID 0A09DAC9, created 2016-11-25 (main key ID 276856F7)
gpg: encrypted with 4096-bit RSA key, ID 0A09DAC9, created 2016-11-25
"FranklinYang (Encrypt RSA 4096) <[email protected]>"
Try
decrypt
on
debian
8
with
new
secret
key
!
或者,在centos7上加密和签名,发给debian8:
[[email protected] ~]#
[[email protected] ~]#
[[email protected] ~]# cat temp.sig.log
Try
decrypt
on
debian
8
with
new
secret
key
!
encrypt
and
AND signature
on CENTOS7
!
sending
to
DEBIAN8
!
[[email protected] ~]#
[[email protected] ~]#
[[email protected] ~]#
[[email protected] ~]# gpg -a -o temp.sig.log.sig.CAST5.asc -u "FranklinYang" -r "FranklinYang" -se --cipher-algo CAST5 temp.sig.log
You need a passphrase to unlock the secret key for
user: "FranklinYang (Encrypt RSA 4096) <[email protected]>"
4096-bit RSA key, ID 276856F7, created 2016-11-25
[[email protected] ~]#
[[email protected] ~]#
[[email protected] ~]#
[[email protected] ~]# l temp.sig.log.sig.CAST5.asc
-rw-r--r--. 1 root root 1835 Nov 26 01:55 temp.sig.log.sig.CAST5.asc
[[email protected] ~]#
[[email protected] ~]#
[[email protected] ~]# scp temp.sig.log.sig.CAST5.asc [email protected]:/home/franklin/
[email protected]‘s password:
temp.sig.log.sig.CAST5.asc 100% 1835 1.8KB/s 00:00
[[email protected] ~]#
[[email protected] ~]#
(在debian8上解密并验证签名)
[email protected]:~# gpg -o temp.sig.log -d temp.sig.log.sig.CAST5.asc
You need a passphrase to unlock the secret key for
user: "FranklinYang (Encrypt RSA 4096) <[email protected]>"
4096-bit RSA key, ID 0A09DAC9, created 2016-11-25 (main key ID 276856F7)
gpg: encrypted with 4096-bit RSA key, ID 0A09DAC9, created 2016-11-25
"FranklinYang (Encrypt RSA 4096) <[email protected]>"
gpg: Signature made Mon 28 Nov 2016 11:25:08 PM CST using RSA key ID 276856F7
gpg: Good signature from "FranklinYang (Encrypt RSA 4096) <[email protected]>"
[email protected]:~# cat temp.sig.log
Try
decrypt
on
debian
8
with
new
secret
key
!
encrypt
and
AND signature
on CENTOS7
!
sending
to
DEBIAN8
!
以上是关于GnuPG高级指导在其他电脑上启用“我的密钥”的主要内容,如果未能解决你的问题,请参考以下文章