我如何使用Go的openpgp软件包? [英] How do I use Go's openpgp package?

查看:247
本文介绍了我如何使用Go的openpgp软件包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在浏览Go的 openpgp的文档 包,我想我必须缺少一些明显的观点。例如,有一个 ReadKeyRing 函数,但没有 WriteKeyRing 。另一方面,我可以, Serialize an Entity ,但我无法将其读回。这里发生了什么?有没有人真的使用这个软件包?

解决方案

实体代表公共+私人GPG密钥信息。 ReadKeyRing 功能允许您阅读GPG密钥列表。



Entity.Serialize函数文档指出:


Serialize将给定实体的公共部分写入w 。 (没有私钥材料会被输出)。

因为它只是实体的公共部分,所以你可以创建一个新的实体与序列化的数据作为公钥。

A WriteKeyRing 确实不存在。它会遍历实体列表并将公钥提取到数组中。


I've been looking through the documentation for Go's openpgp package, and I think I must be missing some obvious points. For example, there's a ReadKeyRing function, but no WriteKeyRing. I can, on the other hand, Serialize an Entity, but I have no way to read it back. What's going on here? Does anyone actually use this package?

解决方案

An entity represents public+private GPG key information. The ReadKeyRing function allows you to read a list of GPG keys.

The Entity.Serialize function documentation states:

Serialize writes the public part of the given Entity to w. (No private key material will be output).

As it is only the public part of the entity, you can create a new entity with the serialized data as the public key.

A WriteKeyRing does indeed not exist. It would go through the list of entities and extract the public keys into an array.

这篇关于我如何使用Go的openpgp软件包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆