-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change values of Identity.Raw, add fingerprints (#1628)
* Change values of Identity.Raw, add fingerprints Raw now contains only PKIX public keys or DER encoded certificates. The keys are extracted from minisign, pgp, and TUF verifiers. Also added fingerprints for each verifier. Keys, certificates, and ed25519 keys from minisign are hex-encoded sha-256 digests of the raw key. SSH and PGP use their ecosystem-standard fingerprints. Signed-off-by: Hayden Blauzvern <[email protected]> * Fix lint Signed-off-by: Hayden Blauzvern <[email protected]> --------- Signed-off-by: Hayden Blauzvern <[email protected]>
- Loading branch information
1 parent
c1e6614
commit 3e1715a
Showing
13 changed files
with
221 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,6 @@ import ( | |
"sort" | ||
"testing" | ||
|
||
"github.com/sigstore/rekor/pkg/pki/identity" | ||
"go.uber.org/goleak" | ||
) | ||
|
||
|
@@ -348,17 +347,20 @@ func TestEmailAddresses(t *testing.T) { | |
caseDesc string | ||
inputFile string | ||
subjects []string | ||
// number of keys in key ring | ||
// verified with gpg, ignoring DSA/ElGamal keys | ||
keys int | ||
} | ||
|
||
var k PublicKey | ||
if len(k.Subjects()) != 0 { | ||
t.Errorf("Subjects for unitialized key should give empty slice") | ||
} | ||
tests := []test{ | ||
{caseDesc: "Valid armored public key", inputFile: "testdata/valid_armored_public.pgp", subjects: []string{}}, | ||
{caseDesc: "Valid armored public key with multiple subentries", inputFile: "testdata/valid_armored_complex_public.pgp", subjects: []string{"[email protected]", "[email protected]"}}, | ||
{caseDesc: "Valid binary public key", inputFile: "testdata/valid_binary_public.pgp", subjects: []string{}}, | ||
{caseDesc: "Valid binary public key with multiple subentries", inputFile: "testdata/valid_binary_complex_public.pgp", subjects: []string{"[email protected]", "[email protected]"}}, | ||
{caseDesc: "Valid armored public key", inputFile: "testdata/valid_armored_public.pgp", subjects: []string{}, keys: 2}, | ||
{caseDesc: "Valid armored public key with multiple subentries", inputFile: "testdata/valid_armored_complex_public.pgp", subjects: []string{"[email protected]", "[email protected]"}, keys: 4}, | ||
{caseDesc: "Valid binary public key", inputFile: "testdata/valid_binary_public.pgp", subjects: []string{}, keys: 2}, | ||
{caseDesc: "Valid binary public key with multiple subentries", inputFile: "testdata/valid_binary_complex_public.pgp", subjects: []string{"[email protected]", "[email protected]"}, keys: 4}, | ||
} | ||
|
||
for _, tc := range tests { | ||
|
@@ -388,14 +390,12 @@ func TestEmailAddresses(t *testing.T) { | |
t.Errorf("%v: Error getting subjects from keys length, got %v, expected %v", tc.caseDesc, len(subjects), len(tc.subjects)) | ||
} | ||
|
||
keyVal, _ := inputKey.CanonicalValue() | ||
expectedIDs := []identity.Identity{{Crypto: inputKey.key, Raw: keyVal}} | ||
ids, err := inputKey.Identities() | ||
if err != nil { | ||
t.Fatalf("unexpected error getting identities: %v", err) | ||
t.Fatalf("%v: unexpected error getting identities: %v", tc.caseDesc, err) | ||
} | ||
if !reflect.DeepEqual(ids, expectedIDs) { | ||
t.Errorf("identities are not equal") | ||
if len(ids) != tc.keys { | ||
t.Fatalf("%v: expected %d keys, got %d", tc.caseDesc, tc.keys, len(ids)) | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.