How to use go openpgp package?

I looked through the documentation for the Go openpgp , and I think I should be missing out on some obvious points. For example, there is a ReadKeyRing function, but not WriteKeyRing . I can, on the other hand, Serialize a Entity , but I have no way to read it. What's going on here? Does anyone really use this package?

+6
source share
2 answers

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

The documentation for the Entity.Serialize function says:

Serialize writes the open part of this object to w. (Material with a private key will not be output).

Since this is only the public part of the object, you can create a new object with serialized data as the public key.

WriteKeyRing really does not exist. It would go through a list of objects and extract the public keys into an array.

+2
source

I also struggled a lot with this - in the end, I just recognized it using an example:

The idea of ​​this is not made for the user, but it seems to be very different from the real way of implementing pgp.

I would suggest generating the keys not through the package, but only using the pgp command line tool.

0
source

Source: https://habr.com/ru/post/899347/


All Articles