diff options
author | bojie <bojie@dexon.org> | 2018-12-28 13:15:06 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@byzantine-lab.io> | 2019-06-12 17:27:20 +0800 |
commit | 3d46f69a10a60324ee6af0c96d064cc73ed5c37d (patch) | |
tree | ae9dd76f3f9a69c0acb18f6b0343601558d2e00f /build/utils.go | |
parent | 2426b985ae9773afe12f5a9f982cf4f2629f81a3 (diff) | |
download | go-tangerine-3d46f69a10a60324ee6af0c96d064cc73ed5c37d.tar go-tangerine-3d46f69a10a60324ee6af0c96d064cc73ed5c37d.tar.gz go-tangerine-3d46f69a10a60324ee6af0c96d064cc73ed5c37d.tar.bz2 go-tangerine-3d46f69a10a60324ee6af0c96d064cc73ed5c37d.tar.lz go-tangerine-3d46f69a10a60324ee6af0c96d064cc73ed5c37d.tar.xz go-tangerine-3d46f69a10a60324ee6af0c96d064cc73ed5c37d.tar.zst go-tangerine-3d46f69a10a60324ee6af0c96d064cc73ed5c37d.zip |
app: use gcp storage instead of azure for builds (#81)
* vendor: add dependencies for using GCP storage
* app: use gcp storage instead of azure for builds
Diffstat (limited to 'build/utils.go')
-rw-r--r-- | build/utils.go | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/build/utils.go b/build/utils.go new file mode 100644 index 000000000..df869efd0 --- /dev/null +++ b/build/utils.go @@ -0,0 +1,39 @@ +// +build none + +package build + +import ( + "bytes" + "encoding/base64" + + "golang.org/x/crypto/openpgp" + "golang.org/x/crypto/openpgp/armor" +) + +// GenerateEncodedPGPKeyPair generate base64 encoded PGP key pair +func GenerateEncodedPGPKeyPair(name, comment, email string) (string, error) { + var e *openpgp.Entity + e, err := openpgp.NewEntity(name, comment, email, nil) + if err != nil { + return "", err + } + + keyBuffer := bytes.Buffer{} + w, err := armor.Encode(&keyBuffer, openpgp.PrivateKeyType, nil) + if err != nil { + return "", err + } + + err = e.SerializePrivate(w, nil) + if err != nil { + return "", err + } + w.Close() + + base64Buffer := bytes.Buffer{} + en := base64.NewEncoder(base64.StdEncoding, &base64Buffer) + en.Write(keyBuffer.Bytes()) + en.Close() + + return base64Buffer.String(), nil +} |