aboutsummaryrefslogtreecommitdiffstats
path: root/entity
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2022-02-15 21:35:49 +0100
committerMichael Muré <batolettre@gmail.com>2022-02-15 21:35:49 +0100
commit44f61b66775e77fd8b42ba3ea57b2c323463b725 (patch)
tree8d611d4df0112c7ff20b6b834283fb459dd6e3d1 /entity
parent9ed515fd546a6ed5e82b2b87d12f0241727d3f89 (diff)
downloadgit-bug-44f61b66775e77fd8b42ba3ea57b2c323463b725.tar.gz
update keyring and migrate to github.com/ProtonMail/go-crypto
Diffstat (limited to 'entity')
-rw-r--r--entity/dag/operation_pack.go25
1 files changed, 15 insertions, 10 deletions
diff --git a/entity/dag/operation_pack.go b/entity/dag/operation_pack.go
index 72063c60..5d74e13f 100644
--- a/entity/dag/operation_pack.go
+++ b/entity/dag/operation_pack.go
@@ -6,8 +6,9 @@ import (
"strconv"
"strings"
+ "github.com/ProtonMail/go-crypto/openpgp"
+ "github.com/ProtonMail/go-crypto/openpgp/packet"
"github.com/pkg/errors"
- "golang.org/x/crypto/openpgp"
"github.com/MichaelMure/git-bug/entity"
"github.com/MichaelMure/git-bug/identity"
@@ -272,7 +273,7 @@ func readOperationPack(def Definition, repo repository.RepoData, resolver identi
keys := author.ValidKeysAtTime(fmt.Sprintf(editClockPattern, def.Namespace), editTime)
if len(keys) > 0 {
keyring := PGPKeyring(keys)
- _, err = openpgp.CheckDetachedSignature(keyring, commit.SignedData, commit.Signature)
+ _, err = openpgp.CheckDetachedSignature(keyring, commit.SignedData, commit.Signature, nil)
if err != nil {
return nil, fmt.Errorf("signature failure: %v", err)
}
@@ -335,6 +336,9 @@ func (pk PGPKeyring) KeysById(id uint64) []openpgp.Key {
result = append(result, openpgp.Key{
PublicKey: key.Public(),
PrivateKey: key.Private(),
+ SelfSignature: &packet.Signature{
+ IsPrimaryId: func() *bool { b := true; return &b }(),
+ },
})
}
}
@@ -347,12 +351,13 @@ func (pk PGPKeyring) KeysByIdUsage(id uint64, requiredUsage byte) []openpgp.Key
}
func (pk PGPKeyring) DecryptionKeys() []openpgp.Key {
- result := make([]openpgp.Key, len(pk))
- for i, key := range pk {
- result[i] = openpgp.Key{
- PublicKey: key.Public(),
- PrivateKey: key.Private(),
- }
- }
- return result
+ // result := make([]openpgp.Key, len(pk))
+ // for i, key := range pk {
+ // result[i] = openpgp.Key{
+ // PublicKey: key.Public(),
+ // PrivateKey: key.Private(),
+ // }
+ // }
+ // return result
+ return nil
}