aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing
diff options
context:
space:
mode:
Diffstat (limited to 'plumbing')
-rw-r--r--plumbing/object/commit.go4
-rw-r--r--plumbing/object/commit_test.go69
-rw-r--r--plumbing/object/tag.go4
-rw-r--r--plumbing/object/tag_test.go59
4 files changed, 47 insertions, 89 deletions
diff --git a/plumbing/object/commit.go b/plumbing/object/commit.go
index 98664a1..7a1b8e5 100644
--- a/plumbing/object/commit.go
+++ b/plumbing/object/commit.go
@@ -9,7 +9,7 @@ import (
"io"
"strings"
- "golang.org/x/crypto/openpgp"
+ "github.com/ProtonMail/go-crypto/openpgp"
"github.com/go-git/go-git/v5/plumbing"
"github.com/go-git/go-git/v5/plumbing/storer"
@@ -374,7 +374,7 @@ func (c *Commit) Verify(armoredKeyRing string) (*openpgp.Entity, error) {
return nil, err
}
- return openpgp.CheckArmoredDetachedSignature(keyring, er, signature)
+ return openpgp.CheckArmoredDetachedSignature(keyring, er, signature, nil)
}
func indent(t string) string {
diff --git a/plumbing/object/commit_test.go b/plumbing/object/commit_test.go
index e260a7f..468a751 100644
--- a/plumbing/object/commit_test.go
+++ b/plumbing/object/commit_test.go
@@ -411,27 +411,23 @@ func (s *SuiteCommit) TestStat(c *C) {
}
func (s *SuiteCommit) TestVerify(c *C) {
- ts := time.Unix(1511197315, 0)
- loc, _ := time.LoadLocation("Asia/Kolkata")
+ ts := time.Unix(1617402711, 0)
+ loc, _ := time.LoadLocation("UTC")
commit := &Commit{
- Hash: plumbing.NewHash("8a9cea36fe052711fbc42b86e1f99a4fa0065deb"),
- Author: Signature{Name: "Sunny", Email: "me@darkowlzz.space", When: ts.In(loc)},
- Committer: Signature{Name: "Sunny", Email: "me@darkowlzz.space", When: ts.In(loc)},
- Message: `status: simplify template command selection
+ Hash: plumbing.NewHash("1eca38290a3131d0c90709496a9b2207a872631e"),
+ Author: Signature{Name: "go-git", Email: "go-git@example.com", When: ts.In(loc)},
+ Committer: Signature{Name: "go-git", Email: "go-git@example.com", When: ts.In(loc)},
+ Message: `test
`,
- TreeHash: plumbing.NewHash("6572ba6df4f1fb323c8aaa24ce07bca0648b161e"),
- ParentHashes: []plumbing.Hash{plumbing.NewHash("ede5f57ea1280a0065beec96d3e1a3453d010dbd")},
+ TreeHash: plumbing.NewHash("52a266a58f2c028ad7de4dfd3a72fdf76b0d4e24"),
+ ParentHashes: []plumbing.Hash{plumbing.NewHash("e4fbb611cd14149c7a78e9c08425f59f4b736a9a")},
PGPSignature: `
-----BEGIN PGP SIGNATURE-----
-iQFHBAABCAAxFiEEoRt6IzxHaZkkUslhQyLeMqcmyU4FAloTCrsTHG1lQGRhcmtv
-d2x6ei5zcGFjZQAKCRBDIt4ypybJTul5CADmVxB4kqlqRZ9fAcSU5LKva3GRXx0+
-leX6vbzoyQztSWYgl7zALh4kB3a3t2C9EnnM6uehlgaORNigyMArCSY1ivWVviCT
-BvldSVi8f8OvnqwbWX0I/5a8KmItthDf5WqZRFjhcRlY1AK5Bo2hUGVRq71euf8F
-rE6wNhDoyBCEpftXuXbq8duD7D6qJ7QiOS4m5+ej1UCssS2WQ60yta7q57odduHY
-+txqTKI8MQUpBgoTqh+V4lOkwQQxLiz7hIQ/ZYLUcnp6fan7/kY/G7YoLt9pOG1Y
-vLzAWdidLH2P+EUOqlNMuVScHYWD1FZB0/L5LJ8no5pTowQd2Z+Nggxl
-=0uC8
+iHUEABYKAB0WIQTMqU0ycQ3f6g3PMoWMmmmF4LuV8QUCYGebVwAKCRCMmmmF4LuV
+8VtyAP9LbuXAhtK6FQqOjKybBwlV70rLcXVP24ubDuz88VVwSgD+LuObsasWq6/U
+TssDKHUR2taa53bQYjkZQBpvvwOrLgc=
+=YQUf
-----END PGP SIGNATURE-----
`,
}
@@ -439,40 +435,23 @@ vLzAWdidLH2P+EUOqlNMuVScHYWD1FZB0/L5LJ8no5pTowQd2Z+Nggxl
armoredKeyRing := `
-----BEGIN PGP PUBLIC KEY BLOCK-----
-mQENBFmtHgABCADnfThM7q8D4pgUub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YKeByw3JugnlZ0U3V/R20bCwDglst5UQEAtkN2iZkHtkPly9xapsfNqnrt2gTt
+YIefGtzXfldDxg4=
+=Psht
-----END PGP PUBLIC KEY BLOCK-----
`
e, err := commit.Verify(armoredKeyRing)
- c.Assert(err, IsNil)
+ c.Assert(err, IsNil)
- _, ok := e.Identities["Sunny <me@darkowlzz.space>"]
+ _, ok := e.Identities["go-git test key"]
c.Assert(ok, Equals, true)
}
diff --git a/plumbing/object/tag.go b/plumbing/object/tag.go
index 4641658..216010d 100644
--- a/plumbing/object/tag.go
+++ b/plumbing/object/tag.go
@@ -8,7 +8,7 @@ import (
stdioutil "io/ioutil"
"strings"
- "golang.org/x/crypto/openpgp"
+ "github.com/ProtonMail/go-crypto/openpgp"
"github.com/go-git/go-git/v5/plumbing"
"github.com/go-git/go-git/v5/plumbing/storer"
@@ -304,7 +304,7 @@ func (t *Tag) Verify(armoredKeyRing string) (*openpgp.Entity, error) {
return nil, err
}
- return openpgp.CheckArmoredDetachedSignature(keyring, er, signature)
+ return openpgp.CheckArmoredDetachedSignature(keyring, er, signature, nil)
}
// TagIter provides an iterator for a set of tags.
diff --git a/plumbing/object/tag_test.go b/plumbing/object/tag_test.go
index e3f3dca..3dffc12 100644
--- a/plumbing/object/tag_test.go
+++ b/plumbing/object/tag_test.go
@@ -313,26 +313,22 @@ RUysgqjcpT8+iQM1PblGfHR4XAhuOqN5Fx06PSaFZhqvWFezJ28/CLyX5q+oIVk=
}
func (s *TagSuite) TestVerify(c *C) {
- ts := time.Unix(1511524851, 0)
- loc, _ := time.LoadLocation("Asia/Kolkata")
+ ts := time.Unix(1617403017, 0)
+ loc, _ := time.LoadLocation("UTC")
tag := &Tag{
Name: "v0.2",
- Tagger: Signature{Name: "Sunny", Email: "me@darkowlzz.space", When: ts.In(loc)},
+ Tagger: Signature{Name: "go-git", Email: "go-git@example.com", When: ts.In(loc)},
Message: `This is a signed tag
`,
TargetType: plumbing.CommitObject,
- Target: plumbing.NewHash("064f92fe00e70e6b64cb358a65039daa4b6ae8d2"),
+ Target: plumbing.NewHash("1eca38290a3131d0c90709496a9b2207a872631e"),
PGPSignature: `
-----BEGIN PGP SIGNATURE-----
-iQFHBAABCAAxFiEEoRt6IzxHaZkkUslhQyLeMqcmyU4FAloYCg8THG1lQGRhcmtv
-d2x6ei5zcGFjZQAKCRBDIt4ypybJTs0cCACjQZe2610t3gfbUPbgQiWDL9uvlCeb
-sNSeTC6hLAFSvHTMqLr/6RpiLlfQXyATD7TZUH0DUSLsERLheG82OgVxkOTzPCpy
-GL6iGKeZ4eZ1KiV+SBPjqizC9ShhGooPUw9oUSVdj4jsaHDdDHtY63Pjl0KvJmms
-OVi9SSxjeMbmaC81C8r0ZuOLTXJh/JRKh2BsehdcnK3736BK+16YRD7ugXLpkQ5d
-nsCFVbuYYoLMoJL5NmEun0pbUrpY+MI8VPK0f9HV5NeaC4NksC+ke/xYMT+P2lRL
-CN+9zcCIU+mXr2fCl1xOQcnQzwOElObDxpDcPcxVn0X+AhmPc+uj0mqD
-=l75D
+iHUEABYKAB0WIQTMqU0ycQ3f6g3PMoWMmmmF4LuV8QUCYGeciQAKCRCMmmmF4LuV
+8ZoDAP4j9msumYymfHgS3y7jpxPcSyiOMlXjipr2upspvXJ6ewD+K+OPC4pGW7Aq
+8UDK8r6qhaloxATcV/LUrvAW2yz4PwM=
+=PD+s
-----END PGP SIGNATURE-----
`,
}
@@ -340,40 +336,23 @@ CN+9zcCIU+mXr2fCl1xOQcnQzwOElObDxpDcPcxVn0X+AhmPc+uj0mqD
armoredKeyRing := `
-----BEGIN PGP PUBLIC KEY BLOCK-----
-mQENBFmtHgABCADnfThM7q8D4pgUub9jMppSpgFh3ev84g3Csc3yQUlszEOVgXmu
-YiSWP1oAiWFQ8ahCydh3LT8TnEB2QvoRNiExUI5XlXFwVfKW3cpDu8gdhtufs90Q
-NvpaHOgTqRf/texGEKwXi6fvS47fpyaQ9BKNdN52LeaaHzDDZkVsAFmroE+7MMvj
-P4Mq8qDn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]
+ _, ok := e.Identities["go-git test key"]
c.Assert(ok, Equals, true)
}