Matching short/long GPG key IDs. #71

This commit is contained in:
Andrey Smirnov
2015-03-19 00:25:54 +03:00
parent c53060d95a
commit c4692bec3d
2 changed files with 37 additions and 0 deletions
+17
View File
@@ -42,6 +42,23 @@ var (
// GpgKey is key in GPG representation
type GpgKey string
// Matches checks two keys for equality
func (key1 GpgKey) Matches(key2 GpgKey) bool {
if key1 == key2 {
return true
}
if len(key1) == 8 && len(key2) == 16 {
return key1 == key2[8:]
}
if len(key1) == 16 && len(key2) == 8 {
return key1[8:] == key2
}
return false
}
// GpgKeyInfo is response from signature verification
type GpgKeyInfo struct {
GoodKeys []GpgKey