diff options
author | bojie <bojie@dexon.org> | 2018-12-28 13:15:06 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-04-09 21:32:55 +0800 |
commit | 9ca2a528ef0f3819b4921a33a3a2110d291707e0 (patch) | |
tree | 5520bb35b6de0ee1844f52f53a55c7b716955f49 /build/utils.go | |
parent | fe239cd01509d340d3450e0275f60f0536ec5455 (diff) | |
download | go-tangerine-9ca2a528ef0f3819b4921a33a3a2110d291707e0.tar go-tangerine-9ca2a528ef0f3819b4921a33a3a2110d291707e0.tar.gz go-tangerine-9ca2a528ef0f3819b4921a33a3a2110d291707e0.tar.bz2 go-tangerine-9ca2a528ef0f3819b4921a33a3a2110d291707e0.tar.lz go-tangerine-9ca2a528ef0f3819b4921a33a3a2110d291707e0.tar.xz go-tangerine-9ca2a528ef0f3819b4921a33a3a2110d291707e0.tar.zst go-tangerine-9ca2a528ef0f3819b4921a33a3a2110d291707e0.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 +} |