summaryrefslogtreecommitdiff
path: root/go/src
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2021-07-09 02:21:50 +0200
committercyBerta <cyberta@riseup.net>2021-07-21 22:02:24 +0200
commit768fc328d2af734681894e760aad3ab69ceaf5f6 (patch)
treec701ca6e899116be9ac0b2ae7f9c73a2e8e364c8 /go/src
parent7919dfabc1a42c2dfdcf0ded326afad352096a06 (diff)
remove go directory
Diffstat (limited to 'go/src')
m---------go/src/github.com/willscott/goturn0
-rw-r--r--go/src/se.leap.bitmaskclient/pgpverify/pgpverify.go45
2 files changed, 0 insertions, 45 deletions
diff --git a/go/src/github.com/willscott/goturn b/go/src/github.com/willscott/goturn
deleted file mode 160000
-Subproject 19f41278d0c9251d64e0ee29f37d51e87a24a97
diff --git a/go/src/se.leap.bitmaskclient/pgpverify/pgpverify.go b/go/src/se.leap.bitmaskclient/pgpverify/pgpverify.go
deleted file mode 100644
index 1388a33c..00000000
--- a/go/src/se.leap.bitmaskclient/pgpverify/pgpverify.go
+++ /dev/null
@@ -1,45 +0,0 @@
-package pgpverify
-
-import (
- "os"
- "strings"
-
- "golang.org/x/crypto/openpgp"
-)
-
-// PgpVerifier - exported struct used for file verification
-type PgpVerifier struct {
- Logger Logger
-}
-
-// Logger - logging interface
-type Logger interface {
- Log(msg string)
-}
-
-// Verify checks if a file was signed with the correct pgp key
-// using a PEM formatted signature and a corresponding public key
-func (pgpv *PgpVerifier) Verify(signature string, publicKey string, targetPath string) bool {
- keyRingReader := strings.NewReader(publicKey)
- signatureReader := strings.NewReader(signature)
-
- verificationTarget, err := os.Open(targetPath)
- if err != nil {
- pgpv.Logger.Log("Open verification target: " + err.Error())
- return false
- }
-
- keyring, err := openpgp.ReadArmoredKeyRing(keyRingReader)
- if err != nil {
- pgpv.Logger.Log("Read Armored Key Ring: " + err.Error())
- return false
- }
- _, err = openpgp.CheckArmoredDetachedSignature(keyring, verificationTarget, signatureReader)
- if err != nil {
- pgpv.Logger.Log("Verification failed: " + err.Error())
- return false
- }
- pgpv.Logger.Log("Successfully verified: entity.Identities")
- return true
-}
-