-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Hayden Blauzvern <[email protected]>
- Loading branch information
1 parent
1aeef18
commit 8684030
Showing
7 changed files
with
148 additions
and
19 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
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 |
---|---|---|
|
@@ -26,6 +26,7 @@ import ( | |
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
// TODO(issue#53): Add unit tests for online log verification and inclusion proofs | ||
func TestTlogVerifier(t *testing.T) { | ||
virtualSigstore, err := ca.NewVirtualSigstore() | ||
assert.NoError(t, err) | ||
|
@@ -34,8 +35,16 @@ func TestTlogVerifier(t *testing.T) { | |
entity, err := virtualSigstore.Attest("[email protected]", "issuer", statement) | ||
assert.NoError(t, err) | ||
|
||
_, err = verify.VerifyArtifactTransparencyLog(entity, virtualSigstore, 1, true, false) | ||
var ts []time.Time | ||
ts, err = verify.VerifyArtifactTransparencyLog(entity, virtualSigstore, 1, true, false) | ||
assert.NoError(t, err) | ||
// 1 verified timestamp | ||
assert.Len(t, ts, 1) | ||
|
||
ts, err = verify.VerifyArtifactTransparencyLog(entity, virtualSigstore, 1, false, false) | ||
assert.NoError(t, err) | ||
// 0 verified timestamps, since integrated timestamps are ignored | ||
assert.Len(t, ts, 0) | ||
|
||
virtualSigstore2, err := ca.NewVirtualSigstore() | ||
assert.NoError(t, err) | ||
|
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 |
---|---|---|
|
@@ -50,6 +50,29 @@ func TestTimestampAuthorityVerifier(t *testing.T) { | |
assert.Error(t, err) // only 1 trusted should not meet threshold of 2 | ||
} | ||
|
||
func TestTimestampAuthorityVerifierWithoutThreshold(t *testing.T) { | ||
virtualSigstore, err := ca.NewVirtualSigstore() | ||
assert.NoError(t, err) | ||
|
||
entity, err := virtualSigstore.Attest("[email protected]", "issuer", []byte("statement")) | ||
assert.NoError(t, err) | ||
|
||
virtualSigstore2, err := ca.NewVirtualSigstore() | ||
assert.NoError(t, err) | ||
|
||
var ts []time.Time | ||
|
||
// expect one verified timestamp | ||
ts, err = verify.VerifyTimestampAuthority(entity, virtualSigstore) | ||
assert.NoError(t, err) | ||
assert.Len(t, ts, 1) | ||
|
||
// no failure, but also no verified timestamps | ||
ts, err = verify.VerifyTimestampAuthority(entity, virtualSigstore2) | ||
assert.NoError(t, err) | ||
assert.Empty(t, ts) | ||
} | ||
|
||
type oneTrustedOneUntrustedTimestampEntity struct { | ||
*ca.TestEntity | ||
UntrustedTestEntity *ca.TestEntity | ||
|