Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/crypto/openpgp: How to decrypt message when ReadMessage method received interface KeyRing #41640

Closed
jirawat-opn opened this issue Sep 26, 2020 · 1 comment

Comments

@jirawat-opn
Copy link

What version of Go are you using (go version)?

$ go version
go version go1.15 darwin/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN="/Users/ntsd/git/go/bin"
GOCACHE="/Users/ntsd/Library/Caches/go-build"
GOENV="/Users/ntsd/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/ntsd/git/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/ntsd/git/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/ntsd/git/go/src/github.com/omiselabs/s3-sftp-lambda/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/y2/qwk84xfn4vj35h_7100sr6540000gp/T/go-build030774959=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I want to use the ReadMessage method

https://github.com/golang/crypto/blob/530e935923ad688be97c15eeb8e5ee42ebf2b54a/openpgp/read.go#L86

I found that receive the KeyRing interface as a parameter

https://github.com/golang/crypto/blob/e1dfcc566284e143ba8f9afbb3fa563f2a0d212b/openpgp/keys.go#L61

What did you expect to see?

I can't find anything to return the KeyRing interface and implement it with the KeyRing interface. I don't know how to use the ReadMessage method to Decrypt message with my GPG private key.

What did you see instead?

I don't know how to create KeyRing. I see the other example and tutorial over the internet they can use *[]EntityList that returns from ReadKeyRing and ReadArmoredKeyRing

https://github.com/golang/crypto/blob/e1dfcc566284e143ba8f9afbb3fa563f2a0d212b/openpgp/keys.go#L253

@gopherbot gopherbot added this to the Unreleased milestone Sep 26, 2020
@jirawat-opn
Copy link
Author

Sorry I saw that EntityList can use it as the KeyRing interface.

@golang golang locked and limited conversation to collaborators Sep 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants