当前位置:   article > 正文

osx中安装gpg_macos 13安装gpg

macos 13安装gpg

首先使用brew install gpg安装gpg

然后试一下:
andy@AndyMacBookPro:/usr/local/webdata/andy/company/icbc$ gpg
gpg: 已创建目录‘/Users/andy/.gnupg’
gpg: 新的配置文件‘/Users/andy/.gnupg/gpg.conf’已建立
gpg: 警告:在‘/Users/andy/.gnupg/gpg.conf’里的选项于此次运行期间未被使用
gpg: 钥匙环‘/Users/andy/.gnupg/secring.gpg’已建立
gpg: 钥匙环‘/Users/andy/.gnupg/pubring.gpg’已建立
gpg: 请开始键入您的报文……

或者这样试一下:

andy@AndyMacBookPro:/usr/local/webdata/andy/fanli/icbcgpglistkeygpg:/Users/andy/.gnupg/trustdb.gpgandy@AndyMacBookPro:/usr/local/webdata/andy/fanli/icbc

然后我们导入一下私钥

andy@AndyMacBookPro:~/Downloads/icbc_gpg$ gpg –import wangdazhuang.asc
gpg: 密钥 9452313E:私钥已导入
gpg: 密钥 9452313E:公钥“wangdazhuang wangdazhuang_kzx@icbcbank.com”已导入
gpg: 合计被处理的数量:1
gpg: 已导入:1
gpg: 读取的私钥:1
gpg: 导入的私钥:1
andy@AndyMacBookPro:~/Downloads/icbc_gpg$

如果你想导入公钥,会得到这样的提示:

andy@AndyMacBookPro:~/Downloads/icbc_gpg$ gpg –import wangdazhuang_pub.asc
gpg: 密钥 9452313E:“wangdazhuang wangdazhuang_kzx@icbcbank.com”未改变
gpg: 合计被处理的数量:1
gpg: 未改变:1
andy@AndyMacBookPro:~/Downloads/icbc_gpggpgimportwangdazhuang.ascgpg:9452313Egpg:1gpg:1gpg:1andy@AndyMacBookPro: /Downloads/icbcgpg

然后我们对加密文件进行解密:

andy@AndyMacBookPro:~/Downloads/icbc_gpg$ gpg -o result.txt -d 2.txt.gpg

您需要输入密码,才能解开这个用户的私钥:“wangdazhuang wangdazhuang_kzx@icbcbank.com
2048 位的 ELG-E 密钥,钥匙号 3BCC8A2F,建立于 2015-05-15 (主钥匙号 9452313E)

gpg: 由 2048 位的 ELG-E 密钥加密,钥匙号为 3BCC8A2F、生成于 2015-05-15
“wangdazhuang wangdazhuang_kzx@icbcbank.com

如果我们想加密文件,就这样:

andy@AndyMacBookPro:~/Downloads/icbc_gpg$ gpg -e -r wangdazhuang result.txt
gpg: 3BCC8A2F:没有证据表明这把密钥真的属于它所声称的持有者

pub 2048g/3BCC8A2F 2015-05-15 wangdazhuang wangdazhuang_kzx@icbcbank.com
主钥指纹: 4053 8C02 CD5A AC83 4AB1 D6A7 E670 154F 9452 313E
子钥指纹: AFE8 FA23 7F71 C57C A204 2439 F937 04A6 3BCC 8A2F

这把密钥并不一定属于用户标识声称的那个人。如果您真的知道自
己在做什么,您可以在下一个问题回答 yes。

无论如何还是使用这把密钥吗?(y/N)y

如果你想删除公钥,让我们来试试:

andy@AndyMacBookPro:~/Downloads/icbc_gpg$ gpg –delete-key wangdazhuang
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.

gpg: 公钥“wangdazhuang”有对应的私钥!
gpg: 请先使用“–delete-secret-keys”选项来删除它。
andy@AndyMacBookPro:~/Downloads/icbc_gpg$

让你先删除掉私钥,所以我们就知道了首先要删除私钥。

andy@AndyMacBookPro:~/Downloads/icbc_gpg$ gpg –delete-secret-key wangdazhuang
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/9452313E 2015-05-15 wangdazhuang wangdazhuang_kzx@icbcbank.com

要从钥匙环里删除这把密钥吗?(y/N)y
这是一把私钥!――真的要删除吗?(y/N)y
andy@AndyMacBookPro:~/Downloads/icbc_gpg$

然后我们就可以去删除公钥了。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/笔触狂放9/article/detail/129245
推荐阅读
  

闽ICP备14008679号