diff --git a/client/client.go b/client/client.go index 67850969..42756f8a 100644 --- a/client/client.go +++ b/client/client.go @@ -106,49 +106,6 @@ func NewClient(local LocalStore, remote RemoteStore) *Client { } } -// Init initializes a local repository. -// -// The latest root.json is fetched from remote storage, verified using rootKeys -// and threshold, and then saved in local storage. It is expected that rootKeys -// were securely distributed with the software being updated. -// -// Deprecated: Use c.InitLocal and c.Update to initialize a local repository. -func (c *Client) Init(rootKeys []*data.PublicKey, threshold int) error { - if len(rootKeys) < threshold { - return ErrInsufficientKeys - } - rootJSON, err := c.downloadMetaUnsafe("root.json", defaultRootDownloadLimit) - if err != nil { - return err - } - - // create a new key database, and add all the public `rootKeys` to it. - c.db = verify.NewDB() - rootKeyIDs := make([]string, 0, len(rootKeys)) - for _, key := range rootKeys { - for _, id := range key.IDs() { - rootKeyIDs = append(rootKeyIDs, id) - if err := c.db.AddKey(id, key); err != nil { - return err - } - } - } - - // add a mock "root" role that trusts the passed in key ids. These keys - // will be used to verify the `root.json` we just fetched. - role := &data.Role{Threshold: threshold, KeyIDs: rootKeyIDs} - if err := c.db.AddRole("root", role); err != nil { - return err - } - - // verify that the new root is valid. - if err := c.decodeRoot(rootJSON); err != nil { - return err - } - - return c.local.SetMeta("root.json", rootJSON) -} - // InitLocal initializes a local repository from root metadata. // // The root's keys are extracted from the root and saved in local storage. diff --git a/client/client_test.go b/client/client_test.go index 2085dcd8..c23a9666 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -174,17 +174,18 @@ func (s *ClientSuite) addRemoteTarget(c *C, name string) { s.syncRemote(c) } -func (s *ClientSuite) rootKeys(c *C) []*data.PublicKey { - rootKeys, err := s.repo.RootKeys() +func (s *ClientSuite) rootMeta(c *C) []byte { + meta, err := s.repo.GetMeta() c.Assert(err, IsNil) - c.Assert(rootKeys, HasLen, 1) - return rootKeys + rootMeta, ok := meta["root.json"] + c.Assert(ok, Equals, true) + return rootMeta } func (s *ClientSuite) newClient(c *C) *Client { s.local = MemoryLocalStore() client := NewClient(s.local, s.remote) - c.Assert(client.Init(s.rootKeys(c), 1), IsNil) + c.Assert(client.InitLocal(s.rootMeta(c)), IsNil) return client } @@ -243,39 +244,21 @@ func (s *ClientSuite) assertErrExpired(c *C, err error, file string) { c.Assert(expiredErr.Expired.Unix(), Equals, s.expiredTime.Round(time.Second).Unix()) } -func (s *ClientSuite) TestInitRootTooLarge(c *C) { - client := NewClient(MemoryLocalStore(), s.remote) - s.remote.meta["root.json"] = newFakeFile(make([]byte, defaultRootDownloadLimit+1)) - c.Assert(client.Init(s.rootKeys(c), 0), Equals, ErrMetaTooLarge{"root.json", defaultRootDownloadLimit + 1, defaultRootDownloadLimit}) -} - -func (s *ClientSuite) TestInitRootExpired(c *C) { - s.genKeyExpired(c, "targets") - c.Assert(s.repo.Snapshot(), IsNil) - c.Assert(s.repo.Timestamp(), IsNil) - c.Assert(s.repo.Commit(), IsNil) - s.syncRemote(c) - client := NewClient(MemoryLocalStore(), s.remote) - s.withMetaExpired(func() { - s.assertErrExpired(c, client.Init(s.rootKeys(c), 1), "root.json") - }) -} - func (s *ClientSuite) TestInit(c *C) { client := NewClient(MemoryLocalStore(), s.remote) - // check Init() returns keys.ErrInvalidThreshold with an invalid threshold - c.Assert(client.Init(s.rootKeys(c), 0), Equals, verify.ErrInvalidThreshold) - - // check Init() returns signed.ErrRoleThreshold when not enough keys - c.Assert(client.Init(s.rootKeys(c), 2), Equals, ErrInsufficientKeys) + // check invalid json + c.Assert(client.InitLocal(make([]byte, 0)), NotNil) + rootJson := `{ "signatures": [], "signed": {"version": "wrongtype"}, "spec_version": "1.0.0", "version": 1}` + err := client.InitLocal([]byte(rootJson)) + c.Assert(err.Error(), Matches, "json: cannot unmarshal string.*") // check Update() returns ErrNoRootKeys when uninitialized - _, err := client.Update() + _, err = client.Update() c.Assert(err, Equals, ErrNoRootKeys) // check Update() does not return ErrNoRootKeys after initialization - c.Assert(client.Init(s.rootKeys(c), 1), IsNil) + c.Assert(client.InitLocal(s.rootMeta(c)), IsNil) _, err = client.Update() c.Assert(err, IsNil) } @@ -489,6 +472,8 @@ func (s *ClientSuite) TestUpdateRoots(c *C) { {"testdata/Published2Times_targets_keyrotated", nil, map[string]int64{"root": 2, "timestamp": 2, "snapshot": 2, "targets": 2}}, // timestamp role key rotation increase the timestamp. {"testdata/Published2Times_timestamp_keyrotated", nil, map[string]int64{"root": 2, "timestamp": 2, "snapshot": 1, "targets": 1}}, + //root file size > defaultRootDownloadLimit + {"testdata/Published2Times_roottoolarge", ErrMetaTooLarge{Name: "2.root.json", Size: defaultRootDownloadLimit + 1, MaxSize: defaultRootDownloadLimit}, map[string]int64{}}, } for _, test := range tests { @@ -1053,10 +1038,11 @@ func (s *ClientSuite) TestUpdateHTTP(c *C) { remote, err := HTTPRemoteStore(fmt.Sprintf("http://%s/%s/repository", addr, dir), nil, nil) c.Assert(err, IsNil) client := NewClient(MemoryLocalStore(), remote) - rootKeys, err := repo.RootKeys() + rootMeta, err := repo.SignedMeta("root.json") + c.Assert(err, IsNil) + rootJsonBytes, err := json.Marshal(rootMeta) c.Assert(err, IsNil) - c.Assert(rootKeys, HasLen, 1) - c.Assert(client.Init(rootKeys, 1), IsNil) + c.Assert(client.InitLocal(rootJsonBytes), IsNil) // check update is ok targets, err := client.Update() diff --git a/client/testdata/Published2Times_roottoolarge/client/metadata/current/1.root.json b/client/testdata/Published2Times_roottoolarge/client/metadata/current/1.root.json new file mode 100644 index 00000000..fff03947 --- /dev/null +++ b/client/testdata/Published2Times_roottoolarge/client/metadata/current/1.root.json @@ -0,0 +1,87 @@ +{ + "signatures": [ + { + "keyid": "d4dab4b4d68b91665a6d0dac5b4e64677aa6d853fc787669168b4b4ba9822129", + "sig": "481a1bd10fedbe33e88e5f586a8726f558a5ec426bf65d2ba1c449fd1f69148da6af40f1ae18a5be63539dfbf076019db8b28f3f644f7fd4f003b7d06a4c2e09" + } + ], + "signed": { + "_type": "root", + "consistent_snapshot": true, + "expires": "2031-09-09T23:13:37Z", + "keys": { + "3a05831328273e4b821c3bbe1fed0c5332749d8e071675879af26a401a5c85ae": { + "keyid_hash_algorithms": [ + "sha256", + "sha512" + ], + "keytype": "ed25519", + "keyval": { + "public": "6bac59b8d9e1aae02fae6fba6e7fe3fc9fe5b4a9fe98c3fca255d8c8ec3e5b35" + }, + "scheme": "ed25519" + }, + "77dfdca206c0fe1b8e55d67d21dd0e195a0998a9d2b56c6d3ee8f68d04c21e93": { + "keyid_hash_algorithms": [ + "sha256", + "sha512" + ], + "keytype": "ed25519", + "keyval": { + "public": "6400d770c7c1bce4b3d59ce0079ed686e843b6500bbea77d869a1ae7df4565a1" + }, + "scheme": "ed25519" + }, + "d4dab4b4d68b91665a6d0dac5b4e64677aa6d853fc787669168b4b4ba9822129": { + "keyid_hash_algorithms": [ + "sha256", + "sha512" + ], + "keytype": "ed25519", + "keyval": { + "public": "28bf74baa87ed923f8fa27e3292684f8ec4730ce0bdc65150ed58199206ce089" + }, + "scheme": "ed25519" + }, + "e4dae3872d28d29f7624a702bfd25f68453544d597229ee9e0a8569d1f940cf4": { + "keyid_hash_algorithms": [ + "sha256", + "sha512" + ], + "keytype": "ed25519", + "keyval": { + "public": "e6ae9d3b67d7b3ce274130291dd90287f32b8fd72bfb4ac5430859ebd1c28a46" + }, + "scheme": "ed25519" + } + }, + "roles": { + "root": { + "keyids": [ + "d4dab4b4d68b91665a6d0dac5b4e64677aa6d853fc787669168b4b4ba9822129" + ], + "threshold": 1 + }, + "snapshot": { + "keyids": [ + "77dfdca206c0fe1b8e55d67d21dd0e195a0998a9d2b56c6d3ee8f68d04c21e93" + ], + "threshold": 1 + }, + "targets": { + "keyids": [ + "e4dae3872d28d29f7624a702bfd25f68453544d597229ee9e0a8569d1f940cf4" + ], + "threshold": 1 + }, + "timestamp": { + "keyids": [ + "3a05831328273e4b821c3bbe1fed0c5332749d8e071675879af26a401a5c85ae" + ], + "threshold": 1 + } + }, + "spec_version": "1.0.0", + "version": 1 + } +} \ No newline at end of file diff --git a/client/testdata/Published2Times_roottoolarge/client/metadata/current/1.snapshot.json b/client/testdata/Published2Times_roottoolarge/client/metadata/current/1.snapshot.json new file mode 100644 index 00000000..42d8aae0 --- /dev/null +++ b/client/testdata/Published2Times_roottoolarge/client/metadata/current/1.snapshot.json @@ -0,0 +1,19 @@ +{ + "signatures": [ + { + "keyid": "77dfdca206c0fe1b8e55d67d21dd0e195a0998a9d2b56c6d3ee8f68d04c21e93", + "sig": "ecf4d79a88873efb223361e550b8fc35813ad7bf31d9769908d9495cfb930e03db889dc7419897031cadf39437c9f49b085f384fe1c18be3961704062365db0c" + } + ], + "signed": { + "_type": "snapshot", + "expires": "2031-09-09T23:13:37Z", + "meta": { + "targets.json": { + "version": 1 + } + }, + "spec_version": "1.0.0", + "version": 1 + } +} \ No newline at end of file diff --git a/client/testdata/Published2Times_roottoolarge/client/metadata/current/1.targets.json b/client/testdata/Published2Times_roottoolarge/client/metadata/current/1.targets.json new file mode 100644 index 00000000..65bfd77c --- /dev/null +++ b/client/testdata/Published2Times_roottoolarge/client/metadata/current/1.targets.json @@ -0,0 +1,19 @@ +{ + "signatures": [ + { + "keyid": "e4dae3872d28d29f7624a702bfd25f68453544d597229ee9e0a8569d1f940cf4", + "sig": "f2cee9e31bda3f88b25b0153bb48a6cb21237e4c41a34bbae95f152b56975085bc04c4978eed6be76a3ead23ff76a1259ff07e7b45b04fb51865c9601713c905" + } + ], + "signed": { + "_type": "targets", + "delegations": { + "keys": {}, + "roles": [] + }, + "expires": "2031-09-09T23:13:37Z", + "spec_version": "1.0.0", + "targets": {}, + "version": 1 + } +} \ No newline at end of file diff --git a/client/testdata/Published2Times_roottoolarge/client/metadata/current/1.timestamp.json b/client/testdata/Published2Times_roottoolarge/client/metadata/current/1.timestamp.json new file mode 100644 index 00000000..9a03f46a --- /dev/null +++ b/client/testdata/Published2Times_roottoolarge/client/metadata/current/1.timestamp.json @@ -0,0 +1,24 @@ +{ + "signatures": [ + { + "keyid": "3a05831328273e4b821c3bbe1fed0c5332749d8e071675879af26a401a5c85ae", + "sig": "35d1087c4874221bc772c8276bd77415d9366833aad4efc3926a8eda1de053843d2c114ac7448f08e3cfd802857c2ab2569d8be186b3cc36e65e458905f0e10e" + } + ], + "signed": { + "_type": "timestamp", + "expires": "2031-09-09T23:13:37Z", + "meta": { + "snapshot.json": { + "hashes": { + "sha256": "d62f650c8097fd4de9e3c8874ef15f7e10fdcc4c32f7a1818e972e8984b8da8a", + "sha512": "d9d0c38df27bc2ccc9523cb8d27623cb40b264053233e5e3261d83e2921c790b21accf9d427e36aa4c1939ddbccaaa5e006267f1cdd451606c514135d178dca5" + }, + "length": 431, + "version": 1 + } + }, + "spec_version": "1.0.0", + "version": 1 + } +} \ No newline at end of file diff --git a/client/testdata/Published2Times_roottoolarge/client/metadata/current/root.json b/client/testdata/Published2Times_roottoolarge/client/metadata/current/root.json new file mode 100644 index 00000000..fff03947 --- /dev/null +++ b/client/testdata/Published2Times_roottoolarge/client/metadata/current/root.json @@ -0,0 +1,87 @@ +{ + "signatures": [ + { + "keyid": "d4dab4b4d68b91665a6d0dac5b4e64677aa6d853fc787669168b4b4ba9822129", + "sig": "481a1bd10fedbe33e88e5f586a8726f558a5ec426bf65d2ba1c449fd1f69148da6af40f1ae18a5be63539dfbf076019db8b28f3f644f7fd4f003b7d06a4c2e09" + } + ], + "signed": { + "_type": "root", + "consistent_snapshot": true, + "expires": "2031-09-09T23:13:37Z", + "keys": { + "3a05831328273e4b821c3bbe1fed0c5332749d8e071675879af26a401a5c85ae": { + "keyid_hash_algorithms": [ + "sha256", + "sha512" + ], + "keytype": "ed25519", + "keyval": { + "public": "6bac59b8d9e1aae02fae6fba6e7fe3fc9fe5b4a9fe98c3fca255d8c8ec3e5b35" + }, + "scheme": "ed25519" + }, + "77dfdca206c0fe1b8e55d67d21dd0e195a0998a9d2b56c6d3ee8f68d04c21e93": { + "keyid_hash_algorithms": [ + "sha256", + "sha512" + ], + "keytype": "ed25519", + "keyval": { + "public": "6400d770c7c1bce4b3d59ce0079ed686e843b6500bbea77d869a1ae7df4565a1" + }, + "scheme": "ed25519" + }, + "d4dab4b4d68b91665a6d0dac5b4e64677aa6d853fc787669168b4b4ba9822129": { + "keyid_hash_algorithms": [ + "sha256", + "sha512" + ], + "keytype": "ed25519", + "keyval": { + "public": "28bf74baa87ed923f8fa27e3292684f8ec4730ce0bdc65150ed58199206ce089" + }, + "scheme": "ed25519" + }, + "e4dae3872d28d29f7624a702bfd25f68453544d597229ee9e0a8569d1f940cf4": { + "keyid_hash_algorithms": [ + "sha256", + "sha512" + ], + "keytype": "ed25519", + "keyval": { + "public": "e6ae9d3b67d7b3ce274130291dd90287f32b8fd72bfb4ac5430859ebd1c28a46" + }, + "scheme": "ed25519" + } + }, + "roles": { + "root": { + "keyids": [ + "d4dab4b4d68b91665a6d0dac5b4e64677aa6d853fc787669168b4b4ba9822129" + ], + "threshold": 1 + }, + "snapshot": { + "keyids": [ + "77dfdca206c0fe1b8e55d67d21dd0e195a0998a9d2b56c6d3ee8f68d04c21e93" + ], + "threshold": 1 + }, + "targets": { + "keyids": [ + "e4dae3872d28d29f7624a702bfd25f68453544d597229ee9e0a8569d1f940cf4" + ], + "threshold": 1 + }, + "timestamp": { + "keyids": [ + "3a05831328273e4b821c3bbe1fed0c5332749d8e071675879af26a401a5c85ae" + ], + "threshold": 1 + } + }, + "spec_version": "1.0.0", + "version": 1 + } +} \ No newline at end of file diff --git a/client/testdata/Published2Times_roottoolarge/client/metadata/current/snapshot.json b/client/testdata/Published2Times_roottoolarge/client/metadata/current/snapshot.json new file mode 100644 index 00000000..42d8aae0 --- /dev/null +++ b/client/testdata/Published2Times_roottoolarge/client/metadata/current/snapshot.json @@ -0,0 +1,19 @@ +{ + "signatures": [ + { + "keyid": "77dfdca206c0fe1b8e55d67d21dd0e195a0998a9d2b56c6d3ee8f68d04c21e93", + "sig": "ecf4d79a88873efb223361e550b8fc35813ad7bf31d9769908d9495cfb930e03db889dc7419897031cadf39437c9f49b085f384fe1c18be3961704062365db0c" + } + ], + "signed": { + "_type": "snapshot", + "expires": "2031-09-09T23:13:37Z", + "meta": { + "targets.json": { + "version": 1 + } + }, + "spec_version": "1.0.0", + "version": 1 + } +} \ No newline at end of file diff --git a/client/testdata/Published2Times_roottoolarge/client/metadata/current/targets.json b/client/testdata/Published2Times_roottoolarge/client/metadata/current/targets.json new file mode 100644 index 00000000..65bfd77c --- /dev/null +++ b/client/testdata/Published2Times_roottoolarge/client/metadata/current/targets.json @@ -0,0 +1,19 @@ +{ + "signatures": [ + { + "keyid": "e4dae3872d28d29f7624a702bfd25f68453544d597229ee9e0a8569d1f940cf4", + "sig": "f2cee9e31bda3f88b25b0153bb48a6cb21237e4c41a34bbae95f152b56975085bc04c4978eed6be76a3ead23ff76a1259ff07e7b45b04fb51865c9601713c905" + } + ], + "signed": { + "_type": "targets", + "delegations": { + "keys": {}, + "roles": [] + }, + "expires": "2031-09-09T23:13:37Z", + "spec_version": "1.0.0", + "targets": {}, + "version": 1 + } +} \ No newline at end of file diff --git a/client/testdata/Published2Times_roottoolarge/client/metadata/current/timestamp.json b/client/testdata/Published2Times_roottoolarge/client/metadata/current/timestamp.json new file mode 100644 index 00000000..9a03f46a --- /dev/null +++ b/client/testdata/Published2Times_roottoolarge/client/metadata/current/timestamp.json @@ -0,0 +1,24 @@ +{ + "signatures": [ + { + "keyid": "3a05831328273e4b821c3bbe1fed0c5332749d8e071675879af26a401a5c85ae", + "sig": "35d1087c4874221bc772c8276bd77415d9366833aad4efc3926a8eda1de053843d2c114ac7448f08e3cfd802857c2ab2569d8be186b3cc36e65e458905f0e10e" + } + ], + "signed": { + "_type": "timestamp", + "expires": "2031-09-09T23:13:37Z", + "meta": { + "snapshot.json": { + "hashes": { + "sha256": "d62f650c8097fd4de9e3c8874ef15f7e10fdcc4c32f7a1818e972e8984b8da8a", + "sha512": "d9d0c38df27bc2ccc9523cb8d27623cb40b264053233e5e3261d83e2921c790b21accf9d427e36aa4c1939ddbccaaa5e006267f1cdd451606c514135d178dca5" + }, + "length": 431, + "version": 1 + } + }, + "spec_version": "1.0.0", + "version": 1 + } +} \ No newline at end of file diff --git a/client/testdata/Published2Times_roottoolarge/client/metadata/previous/1.root.json b/client/testdata/Published2Times_roottoolarge/client/metadata/previous/1.root.json new file mode 100644 index 00000000..fff03947 --- /dev/null +++ b/client/testdata/Published2Times_roottoolarge/client/metadata/previous/1.root.json @@ -0,0 +1,87 @@ +{ + "signatures": [ + { + "keyid": "d4dab4b4d68b91665a6d0dac5b4e64677aa6d853fc787669168b4b4ba9822129", + "sig": "481a1bd10fedbe33e88e5f586a8726f558a5ec426bf65d2ba1c449fd1f69148da6af40f1ae18a5be63539dfbf076019db8b28f3f644f7fd4f003b7d06a4c2e09" + } + ], + "signed": { + "_type": "root", + "consistent_snapshot": true, + "expires": "2031-09-09T23:13:37Z", + "keys": { + "3a05831328273e4b821c3bbe1fed0c5332749d8e071675879af26a401a5c85ae": { + "keyid_hash_algorithms": [ + "sha256", + "sha512" + ], + "keytype": "ed25519", + "keyval": { + "public": "6bac59b8d9e1aae02fae6fba6e7fe3fc9fe5b4a9fe98c3fca255d8c8ec3e5b35" + }, + "scheme": "ed25519" + }, + "77dfdca206c0fe1b8e55d67d21dd0e195a0998a9d2b56c6d3ee8f68d04c21e93": { + "keyid_hash_algorithms": [ + "sha256", + "sha512" + ], + "keytype": "ed25519", + "keyval": { + "public": "6400d770c7c1bce4b3d59ce0079ed686e843b6500bbea77d869a1ae7df4565a1" + }, + "scheme": "ed25519" + }, + "d4dab4b4d68b91665a6d0dac5b4e64677aa6d853fc787669168b4b4ba9822129": { + "keyid_hash_algorithms": [ + "sha256", + "sha512" + ], + "keytype": "ed25519", + "keyval": { + "public": "28bf74baa87ed923f8fa27e3292684f8ec4730ce0bdc65150ed58199206ce089" + }, + "scheme": "ed25519" + }, + "e4dae3872d28d29f7624a702bfd25f68453544d597229ee9e0a8569d1f940cf4": { + "keyid_hash_algorithms": [ + "sha256", + "sha512" + ], + "keytype": "ed25519", + "keyval": { + "public": "e6ae9d3b67d7b3ce274130291dd90287f32b8fd72bfb4ac5430859ebd1c28a46" + }, + "scheme": "ed25519" + } + }, + "roles": { + "root": { + "keyids": [ + "d4dab4b4d68b91665a6d0dac5b4e64677aa6d853fc787669168b4b4ba9822129" + ], + "threshold": 1 + }, + "snapshot": { + "keyids": [ + "77dfdca206c0fe1b8e55d67d21dd0e195a0998a9d2b56c6d3ee8f68d04c21e93" + ], + "threshold": 1 + }, + "targets": { + "keyids": [ + "e4dae3872d28d29f7624a702bfd25f68453544d597229ee9e0a8569d1f940cf4" + ], + "threshold": 1 + }, + "timestamp": { + "keyids": [ + "3a05831328273e4b821c3bbe1fed0c5332749d8e071675879af26a401a5c85ae" + ], + "threshold": 1 + } + }, + "spec_version": "1.0.0", + "version": 1 + } +} \ No newline at end of file diff --git a/client/testdata/Published2Times_roottoolarge/client/metadata/previous/1.snapshot.json b/client/testdata/Published2Times_roottoolarge/client/metadata/previous/1.snapshot.json new file mode 100644 index 00000000..42d8aae0 --- /dev/null +++ b/client/testdata/Published2Times_roottoolarge/client/metadata/previous/1.snapshot.json @@ -0,0 +1,19 @@ +{ + "signatures": [ + { + "keyid": "77dfdca206c0fe1b8e55d67d21dd0e195a0998a9d2b56c6d3ee8f68d04c21e93", + "sig": "ecf4d79a88873efb223361e550b8fc35813ad7bf31d9769908d9495cfb930e03db889dc7419897031cadf39437c9f49b085f384fe1c18be3961704062365db0c" + } + ], + "signed": { + "_type": "snapshot", + "expires": "2031-09-09T23:13:37Z", + "meta": { + "targets.json": { + "version": 1 + } + }, + "spec_version": "1.0.0", + "version": 1 + } +} \ No newline at end of file diff --git a/client/testdata/Published2Times_roottoolarge/client/metadata/previous/1.targets.json b/client/testdata/Published2Times_roottoolarge/client/metadata/previous/1.targets.json new file mode 100644 index 00000000..65bfd77c --- /dev/null +++ b/client/testdata/Published2Times_roottoolarge/client/metadata/previous/1.targets.json @@ -0,0 +1,19 @@ +{ + "signatures": [ + { + "keyid": "e4dae3872d28d29f7624a702bfd25f68453544d597229ee9e0a8569d1f940cf4", + "sig": "f2cee9e31bda3f88b25b0153bb48a6cb21237e4c41a34bbae95f152b56975085bc04c4978eed6be76a3ead23ff76a1259ff07e7b45b04fb51865c9601713c905" + } + ], + "signed": { + "_type": "targets", + "delegations": { + "keys": {}, + "roles": [] + }, + "expires": "2031-09-09T23:13:37Z", + "spec_version": "1.0.0", + "targets": {}, + "version": 1 + } +} \ No newline at end of file diff --git a/client/testdata/Published2Times_roottoolarge/client/metadata/previous/1.timestamp.json b/client/testdata/Published2Times_roottoolarge/client/metadata/previous/1.timestamp.json new file mode 100644 index 00000000..9a03f46a --- /dev/null +++ b/client/testdata/Published2Times_roottoolarge/client/metadata/previous/1.timestamp.json @@ -0,0 +1,24 @@ +{ + "signatures": [ + { + "keyid": "3a05831328273e4b821c3bbe1fed0c5332749d8e071675879af26a401a5c85ae", + "sig": "35d1087c4874221bc772c8276bd77415d9366833aad4efc3926a8eda1de053843d2c114ac7448f08e3cfd802857c2ab2569d8be186b3cc36e65e458905f0e10e" + } + ], + "signed": { + "_type": "timestamp", + "expires": "2031-09-09T23:13:37Z", + "meta": { + "snapshot.json": { + "hashes": { + "sha256": "d62f650c8097fd4de9e3c8874ef15f7e10fdcc4c32f7a1818e972e8984b8da8a", + "sha512": "d9d0c38df27bc2ccc9523cb8d27623cb40b264053233e5e3261d83e2921c790b21accf9d427e36aa4c1939ddbccaaa5e006267f1cdd451606c514135d178dca5" + }, + "length": 431, + "version": 1 + } + }, + "spec_version": "1.0.0", + "version": 1 + } +} \ No newline at end of file diff --git a/client/testdata/Published2Times_roottoolarge/client/metadata/previous/root.json b/client/testdata/Published2Times_roottoolarge/client/metadata/previous/root.json new file mode 100644 index 00000000..fff03947 --- /dev/null +++ b/client/testdata/Published2Times_roottoolarge/client/metadata/previous/root.json @@ -0,0 +1,87 @@ +{ + "signatures": [ + { + "keyid": "d4dab4b4d68b91665a6d0dac5b4e64677aa6d853fc787669168b4b4ba9822129", + "sig": "481a1bd10fedbe33e88e5f586a8726f558a5ec426bf65d2ba1c449fd1f69148da6af40f1ae18a5be63539dfbf076019db8b28f3f644f7fd4f003b7d06a4c2e09" + } + ], + "signed": { + "_type": "root", + "consistent_snapshot": true, + "expires": "2031-09-09T23:13:37Z", + "keys": { + "3a05831328273e4b821c3bbe1fed0c5332749d8e071675879af26a401a5c85ae": { + "keyid_hash_algorithms": [ + "sha256", + "sha512" + ], + "keytype": "ed25519", + "keyval": { + "public": "6bac59b8d9e1aae02fae6fba6e7fe3fc9fe5b4a9fe98c3fca255d8c8ec3e5b35" + }, + "scheme": "ed25519" + }, + "77dfdca206c0fe1b8e55d67d21dd0e195a0998a9d2b56c6d3ee8f68d04c21e93": { + "keyid_hash_algorithms": [ + "sha256", + "sha512" + ], + "keytype": "ed25519", + "keyval": { + "public": "6400d770c7c1bce4b3d59ce0079ed686e843b6500bbea77d869a1ae7df4565a1" + }, + "scheme": "ed25519" + }, + "d4dab4b4d68b91665a6d0dac5b4e64677aa6d853fc787669168b4b4ba9822129": { + "keyid_hash_algorithms": [ + "sha256", + "sha512" + ], + "keytype": "ed25519", + "keyval": { + "public": "28bf74baa87ed923f8fa27e3292684f8ec4730ce0bdc65150ed58199206ce089" + }, + "scheme": "ed25519" + }, + "e4dae3872d28d29f7624a702bfd25f68453544d597229ee9e0a8569d1f940cf4": { + "keyid_hash_algorithms": [ + "sha256", + "sha512" + ], + "keytype": "ed25519", + "keyval": { + "public": "e6ae9d3b67d7b3ce274130291dd90287f32b8fd72bfb4ac5430859ebd1c28a46" + }, + "scheme": "ed25519" + } + }, + "roles": { + "root": { + "keyids": [ + "d4dab4b4d68b91665a6d0dac5b4e64677aa6d853fc787669168b4b4ba9822129" + ], + "threshold": 1 + }, + "snapshot": { + "keyids": [ + "77dfdca206c0fe1b8e55d67d21dd0e195a0998a9d2b56c6d3ee8f68d04c21e93" + ], + "threshold": 1 + }, + "targets": { + "keyids": [ + "e4dae3872d28d29f7624a702bfd25f68453544d597229ee9e0a8569d1f940cf4" + ], + "threshold": 1 + }, + "timestamp": { + "keyids": [ + "3a05831328273e4b821c3bbe1fed0c5332749d8e071675879af26a401a5c85ae" + ], + "threshold": 1 + } + }, + "spec_version": "1.0.0", + "version": 1 + } +} \ No newline at end of file diff --git a/client/testdata/Published2Times_roottoolarge/client/metadata/previous/snapshot.json b/client/testdata/Published2Times_roottoolarge/client/metadata/previous/snapshot.json new file mode 100644 index 00000000..42d8aae0 --- /dev/null +++ b/client/testdata/Published2Times_roottoolarge/client/metadata/previous/snapshot.json @@ -0,0 +1,19 @@ +{ + "signatures": [ + { + "keyid": "77dfdca206c0fe1b8e55d67d21dd0e195a0998a9d2b56c6d3ee8f68d04c21e93", + "sig": "ecf4d79a88873efb223361e550b8fc35813ad7bf31d9769908d9495cfb930e03db889dc7419897031cadf39437c9f49b085f384fe1c18be3961704062365db0c" + } + ], + "signed": { + "_type": "snapshot", + "expires": "2031-09-09T23:13:37Z", + "meta": { + "targets.json": { + "version": 1 + } + }, + "spec_version": "1.0.0", + "version": 1 + } +} \ No newline at end of file diff --git a/client/testdata/Published2Times_roottoolarge/client/metadata/previous/targets.json b/client/testdata/Published2Times_roottoolarge/client/metadata/previous/targets.json new file mode 100644 index 00000000..65bfd77c --- /dev/null +++ b/client/testdata/Published2Times_roottoolarge/client/metadata/previous/targets.json @@ -0,0 +1,19 @@ +{ + "signatures": [ + { + "keyid": "e4dae3872d28d29f7624a702bfd25f68453544d597229ee9e0a8569d1f940cf4", + "sig": "f2cee9e31bda3f88b25b0153bb48a6cb21237e4c41a34bbae95f152b56975085bc04c4978eed6be76a3ead23ff76a1259ff07e7b45b04fb51865c9601713c905" + } + ], + "signed": { + "_type": "targets", + "delegations": { + "keys": {}, + "roles": [] + }, + "expires": "2031-09-09T23:13:37Z", + "spec_version": "1.0.0", + "targets": {}, + "version": 1 + } +} \ No newline at end of file diff --git a/client/testdata/Published2Times_roottoolarge/client/metadata/previous/timestamp.json b/client/testdata/Published2Times_roottoolarge/client/metadata/previous/timestamp.json new file mode 100644 index 00000000..9a03f46a --- /dev/null +++ b/client/testdata/Published2Times_roottoolarge/client/metadata/previous/timestamp.json @@ -0,0 +1,24 @@ +{ + "signatures": [ + { + "keyid": "3a05831328273e4b821c3bbe1fed0c5332749d8e071675879af26a401a5c85ae", + "sig": "35d1087c4874221bc772c8276bd77415d9366833aad4efc3926a8eda1de053843d2c114ac7448f08e3cfd802857c2ab2569d8be186b3cc36e65e458905f0e10e" + } + ], + "signed": { + "_type": "timestamp", + "expires": "2031-09-09T23:13:37Z", + "meta": { + "snapshot.json": { + "hashes": { + "sha256": "d62f650c8097fd4de9e3c8874ef15f7e10fdcc4c32f7a1818e972e8984b8da8a", + "sha512": "d9d0c38df27bc2ccc9523cb8d27623cb40b264053233e5e3261d83e2921c790b21accf9d427e36aa4c1939ddbccaaa5e006267f1cdd451606c514135d178dca5" + }, + "length": 431, + "version": 1 + } + }, + "spec_version": "1.0.0", + "version": 1 + } +} \ No newline at end of file diff --git a/client/testdata/Published2Times_roottoolarge/hash.txt b/client/testdata/Published2Times_roottoolarge/hash.txt new file mode 100644 index 00000000..94732d5c --- /dev/null +++ b/client/testdata/Published2Times_roottoolarge/hash.txt @@ -0,0 +1 @@ +46183e42ee757c6704e7a122ab225ca633157738809243e8bc3cd92c67699dab \ No newline at end of file diff --git a/client/testdata/Published2Times_roottoolarge/server/metadata.staged/1.root.json b/client/testdata/Published2Times_roottoolarge/server/metadata.staged/1.root.json new file mode 100644 index 00000000..fff03947 --- /dev/null +++ b/client/testdata/Published2Times_roottoolarge/server/metadata.staged/1.root.json @@ -0,0 +1,87 @@ +{ + "signatures": [ + { + "keyid": "d4dab4b4d68b91665a6d0dac5b4e64677aa6d853fc787669168b4b4ba9822129", + "sig": "481a1bd10fedbe33e88e5f586a8726f558a5ec426bf65d2ba1c449fd1f69148da6af40f1ae18a5be63539dfbf076019db8b28f3f644f7fd4f003b7d06a4c2e09" + } + ], + "signed": { + "_type": "root", + "consistent_snapshot": true, + "expires": "2031-09-09T23:13:37Z", + "keys": { + "3a05831328273e4b821c3bbe1fed0c5332749d8e071675879af26a401a5c85ae": { + "keyid_hash_algorithms": [ + "sha256", + "sha512" + ], + "keytype": "ed25519", + "keyval": { + "public": "6bac59b8d9e1aae02fae6fba6e7fe3fc9fe5b4a9fe98c3fca255d8c8ec3e5b35" + }, + "scheme": "ed25519" + }, + "77dfdca206c0fe1b8e55d67d21dd0e195a0998a9d2b56c6d3ee8f68d04c21e93": { + "keyid_hash_algorithms": [ + "sha256", + "sha512" + ], + "keytype": "ed25519", + "keyval": { + "public": "6400d770c7c1bce4b3d59ce0079ed686e843b6500bbea77d869a1ae7df4565a1" + }, + "scheme": "ed25519" + }, + "d4dab4b4d68b91665a6d0dac5b4e64677aa6d853fc787669168b4b4ba9822129": { + "keyid_hash_algorithms": [ + "sha256", + "sha512" + ], + "keytype": "ed25519", + "keyval": { + "public": "28bf74baa87ed923f8fa27e3292684f8ec4730ce0bdc65150ed58199206ce089" + }, + "scheme": "ed25519" + }, + "e4dae3872d28d29f7624a702bfd25f68453544d597229ee9e0a8569d1f940cf4": { + "keyid_hash_algorithms": [ + "sha256", + "sha512" + ], + "keytype": "ed25519", + "keyval": { + "public": "e6ae9d3b67d7b3ce274130291dd90287f32b8fd72bfb4ac5430859ebd1c28a46" + }, + "scheme": "ed25519" + } + }, + "roles": { + "root": { + "keyids": [ + "d4dab4b4d68b91665a6d0dac5b4e64677aa6d853fc787669168b4b4ba9822129" + ], + "threshold": 1 + }, + "snapshot": { + "keyids": [ + "77dfdca206c0fe1b8e55d67d21dd0e195a0998a9d2b56c6d3ee8f68d04c21e93" + ], + "threshold": 1 + }, + "targets": { + "keyids": [ + "e4dae3872d28d29f7624a702bfd25f68453544d597229ee9e0a8569d1f940cf4" + ], + "threshold": 1 + }, + "timestamp": { + "keyids": [ + "3a05831328273e4b821c3bbe1fed0c5332749d8e071675879af26a401a5c85ae" + ], + "threshold": 1 + } + }, + "spec_version": "1.0.0", + "version": 1 + } +} \ No newline at end of file diff --git a/client/testdata/Published2Times_roottoolarge/server/metadata.staged/1.snapshot.json b/client/testdata/Published2Times_roottoolarge/server/metadata.staged/1.snapshot.json new file mode 100644 index 00000000..42d8aae0 --- /dev/null +++ b/client/testdata/Published2Times_roottoolarge/server/metadata.staged/1.snapshot.json @@ -0,0 +1,19 @@ +{ + "signatures": [ + { + "keyid": "77dfdca206c0fe1b8e55d67d21dd0e195a0998a9d2b56c6d3ee8f68d04c21e93", + "sig": "ecf4d79a88873efb223361e550b8fc35813ad7bf31d9769908d9495cfb930e03db889dc7419897031cadf39437c9f49b085f384fe1c18be3961704062365db0c" + } + ], + "signed": { + "_type": "snapshot", + "expires": "2031-09-09T23:13:37Z", + "meta": { + "targets.json": { + "version": 1 + } + }, + "spec_version": "1.0.0", + "version": 1 + } +} \ No newline at end of file diff --git a/client/testdata/Published2Times_roottoolarge/server/metadata.staged/1.targets.json b/client/testdata/Published2Times_roottoolarge/server/metadata.staged/1.targets.json new file mode 100644 index 00000000..65bfd77c --- /dev/null +++ b/client/testdata/Published2Times_roottoolarge/server/metadata.staged/1.targets.json @@ -0,0 +1,19 @@ +{ + "signatures": [ + { + "keyid": "e4dae3872d28d29f7624a702bfd25f68453544d597229ee9e0a8569d1f940cf4", + "sig": "f2cee9e31bda3f88b25b0153bb48a6cb21237e4c41a34bbae95f152b56975085bc04c4978eed6be76a3ead23ff76a1259ff07e7b45b04fb51865c9601713c905" + } + ], + "signed": { + "_type": "targets", + "delegations": { + "keys": {}, + "roles": [] + }, + "expires": "2031-09-09T23:13:37Z", + "spec_version": "1.0.0", + "targets": {}, + "version": 1 + } +} \ No newline at end of file diff --git a/client/testdata/Published2Times_roottoolarge/server/metadata.staged/1.timestamp.json b/client/testdata/Published2Times_roottoolarge/server/metadata.staged/1.timestamp.json new file mode 100644 index 00000000..9a03f46a --- /dev/null +++ b/client/testdata/Published2Times_roottoolarge/server/metadata.staged/1.timestamp.json @@ -0,0 +1,24 @@ +{ + "signatures": [ + { + "keyid": "3a05831328273e4b821c3bbe1fed0c5332749d8e071675879af26a401a5c85ae", + "sig": "35d1087c4874221bc772c8276bd77415d9366833aad4efc3926a8eda1de053843d2c114ac7448f08e3cfd802857c2ab2569d8be186b3cc36e65e458905f0e10e" + } + ], + "signed": { + "_type": "timestamp", + "expires": "2031-09-09T23:13:37Z", + "meta": { + "snapshot.json": { + "hashes": { + "sha256": "d62f650c8097fd4de9e3c8874ef15f7e10fdcc4c32f7a1818e972e8984b8da8a", + "sha512": "d9d0c38df27bc2ccc9523cb8d27623cb40b264053233e5e3261d83e2921c790b21accf9d427e36aa4c1939ddbccaaa5e006267f1cdd451606c514135d178dca5" + }, + "length": 431, + "version": 1 + } + }, + "spec_version": "1.0.0", + "version": 1 + } +} \ No newline at end of file diff --git a/client/testdata/Published2Times_roottoolarge/server/metadata.staged/2.root.json b/client/testdata/Published2Times_roottoolarge/server/metadata.staged/2.root.json new file mode 100644 index 00000000..21d082c8 --- /dev/null +++ b/client/testdata/Published2Times_roottoolarge/server/metadata.staged/2.root.json @@ -0,0 +1,103 @@ +{ + "signatures": [ + { + "keyid": "05e17c1501d627b2597322f80d33aacec6f30a507552d3326a88913422b0e30b", + "sig": "122b322d6f212fcc22ec9062e6948baf694ec4ecf366e4a3cd5cf4c738aa39706b3420aeacd6d8e0e54f0af0168644e905696b397974dadfd3d2a578be06fd08" + }, + { + "keyid": "d4dab4b4d68b91665a6d0dac5b4e64677aa6d853fc787669168b4b4ba9822129", + "sig": "c5e5a542c368d32a8bb1884ffcc850f8902c96537b2b827be3608c44dbdd24ff0cd3b0c326e03869474091e21073f87a57237f2909300a2c43a41ca90c22020c" + } + ], + "signed": { + "_type": "root", + "consistent_snapshot": true, + "expires": "2031-09-09T23:13:37Z", + "keys": { + "05e17c1501d627b2597322f80d33aacec6f30a507552d3326a88913422b0e30b": { + "keyid_hash_algorithms": [ + "sha256", + "sha512" + ], + "keytype": "ed25519", + "keyval": { + "public": "f758af464295e62a1da4d3267be6d13f4aba9c7d52166d01b6bd5b4559496c9d" + }, + "scheme": "ed25519" + }, + "3a05831328273e4b821c3bbe1fed0c5332749d8e071675879af26a401a5c85ae": { + "keyid_hash_algorithms": [ + "sha256", + "sha512" + ], + "keytype": "ed25519", + "keyval": { + "public": "6bac59b8d9e1aae02fae6fba6e7fe3fc9fe5b4a9fe98c3fca255d8c8ec3e5b35" + }, + "scheme": "ed25519" + }, + "77dfdca206c0fe1b8e55d67d21dd0e195a0998a9d2b56c6d3ee8f68d04c21e93": { + "keyid_hash_algorithms": [ + "sha256", + "sha512" + ], + "keytype": "ed25519", + "keyval": { + "public": "6400d770c7c1bce4b3d59ce0079ed686e843b6500bbea77d869a1ae7df4565a1" + }, + "scheme": "ed25519" + }, + "d4dab4b4d68b91665a6d0dac5b4e64677aa6d853fc787669168b4b4ba9822129": { + "keyid_hash_algorithms": [ + "sha256", + "sha512" + ], + "keytype": "ed25519", + "keyval": { + "public": "28bf74baa87ed923f8fa27e3292684f8ec4730ce0bdc65150ed58199206ce089" + }, + "scheme": "ed25519" + }, + "e4dae3872d28d29f7624a702bfd25f68453544d597229ee9e0a8569d1f940cf4": { + "keyid_hash_algorithms": [ + "sha256", + "sha512" + ], + "keytype": "ed25519", + "keyval": { + "public": "e6ae9d3b67d7b3ce274130291dd90287f32b8fd72bfb4ac5430859ebd1c28a46" + }, + "scheme": "ed25519" + } + }, + "roles": { + "root": { + "keyids": [ + "d4dab4b4d68b91665a6d0dac5b4e64677aa6d853fc787669168b4b4ba9822129", + "05e17c1501d627b2597322f80d33aacec6f30a507552d3326a88913422b0e30b" + ], + "threshold": 1 + }, + "snapshot": { + "keyids": [ + "77dfdca206c0fe1b8e55d67d21dd0e195a0998a9d2b56c6d3ee8f68d04c21e93" + ], + "threshold": 1 + }, + "targets": { + "keyids": [ + "e4dae3872d28d29f7624a702bfd25f68453544d597229ee9e0a8569d1f940cf4" + ], + "threshold": 1 + }, + "timestamp": { + "keyids": [ + "3a05831328273e4b821c3bbe1fed0c5332749d8e071675879af26a401a5c85ae" + ], + "threshold": 1 + } + }, + "spec_version": "1.0.0", + "version": 2 + } +} \ No newline at end of file diff --git a/client/testdata/Published2Times_roottoolarge/server/metadata.staged/root.json b/client/testdata/Published2Times_roottoolarge/server/metadata.staged/root.json new file mode 100644 index 00000000..21d082c8 --- /dev/null +++ b/client/testdata/Published2Times_roottoolarge/server/metadata.staged/root.json @@ -0,0 +1,103 @@ +{ + "signatures": [ + { + "keyid": "05e17c1501d627b2597322f80d33aacec6f30a507552d3326a88913422b0e30b", + "sig": "122b322d6f212fcc22ec9062e6948baf694ec4ecf366e4a3cd5cf4c738aa39706b3420aeacd6d8e0e54f0af0168644e905696b397974dadfd3d2a578be06fd08" + }, + { + "keyid": "d4dab4b4d68b91665a6d0dac5b4e64677aa6d853fc787669168b4b4ba9822129", + "sig": "c5e5a542c368d32a8bb1884ffcc850f8902c96537b2b827be3608c44dbdd24ff0cd3b0c326e03869474091e21073f87a57237f2909300a2c43a41ca90c22020c" + } + ], + "signed": { + "_type": "root", + "consistent_snapshot": true, + "expires": "2031-09-09T23:13:37Z", + "keys": { + "05e17c1501d627b2597322f80d33aacec6f30a507552d3326a88913422b0e30b": { + "keyid_hash_algorithms": [ + "sha256", + "sha512" + ], + "keytype": "ed25519", + "keyval": { + "public": "f758af464295e62a1da4d3267be6d13f4aba9c7d52166d01b6bd5b4559496c9d" + }, + "scheme": "ed25519" + }, + "3a05831328273e4b821c3bbe1fed0c5332749d8e071675879af26a401a5c85ae": { + "keyid_hash_algorithms": [ + "sha256", + "sha512" + ], + "keytype": "ed25519", + "keyval": { + "public": "6bac59b8d9e1aae02fae6fba6e7fe3fc9fe5b4a9fe98c3fca255d8c8ec3e5b35" + }, + "scheme": "ed25519" + }, + "77dfdca206c0fe1b8e55d67d21dd0e195a0998a9d2b56c6d3ee8f68d04c21e93": { + "keyid_hash_algorithms": [ + "sha256", + "sha512" + ], + "keytype": "ed25519", + "keyval": { + "public": "6400d770c7c1bce4b3d59ce0079ed686e843b6500bbea77d869a1ae7df4565a1" + }, + "scheme": "ed25519" + }, + "d4dab4b4d68b91665a6d0dac5b4e64677aa6d853fc787669168b4b4ba9822129": { + "keyid_hash_algorithms": [ + "sha256", + "sha512" + ], + "keytype": "ed25519", + "keyval": { + "public": "28bf74baa87ed923f8fa27e3292684f8ec4730ce0bdc65150ed58199206ce089" + }, + "scheme": "ed25519" + }, + "e4dae3872d28d29f7624a702bfd25f68453544d597229ee9e0a8569d1f940cf4": { + "keyid_hash_algorithms": [ + "sha256", + "sha512" + ], + "keytype": "ed25519", + "keyval": { + "public": "e6ae9d3b67d7b3ce274130291dd90287f32b8fd72bfb4ac5430859ebd1c28a46" + }, + "scheme": "ed25519" + } + }, + "roles": { + "root": { + "keyids": [ + "d4dab4b4d68b91665a6d0dac5b4e64677aa6d853fc787669168b4b4ba9822129", + "05e17c1501d627b2597322f80d33aacec6f30a507552d3326a88913422b0e30b" + ], + "threshold": 1 + }, + "snapshot": { + "keyids": [ + "77dfdca206c0fe1b8e55d67d21dd0e195a0998a9d2b56c6d3ee8f68d04c21e93" + ], + "threshold": 1 + }, + "targets": { + "keyids": [ + "e4dae3872d28d29f7624a702bfd25f68453544d597229ee9e0a8569d1f940cf4" + ], + "threshold": 1 + }, + "timestamp": { + "keyids": [ + "3a05831328273e4b821c3bbe1fed0c5332749d8e071675879af26a401a5c85ae" + ], + "threshold": 1 + } + }, + "spec_version": "1.0.0", + "version": 2 + } +} \ No newline at end of file diff --git a/client/testdata/Published2Times_roottoolarge/server/metadata.staged/snapshot.json b/client/testdata/Published2Times_roottoolarge/server/metadata.staged/snapshot.json new file mode 100644 index 00000000..42d8aae0 --- /dev/null +++ b/client/testdata/Published2Times_roottoolarge/server/metadata.staged/snapshot.json @@ -0,0 +1,19 @@ +{ + "signatures": [ + { + "keyid": "77dfdca206c0fe1b8e55d67d21dd0e195a0998a9d2b56c6d3ee8f68d04c21e93", + "sig": "ecf4d79a88873efb223361e550b8fc35813ad7bf31d9769908d9495cfb930e03db889dc7419897031cadf39437c9f49b085f384fe1c18be3961704062365db0c" + } + ], + "signed": { + "_type": "snapshot", + "expires": "2031-09-09T23:13:37Z", + "meta": { + "targets.json": { + "version": 1 + } + }, + "spec_version": "1.0.0", + "version": 1 + } +} \ No newline at end of file diff --git a/client/testdata/Published2Times_roottoolarge/server/metadata.staged/targets.json b/client/testdata/Published2Times_roottoolarge/server/metadata.staged/targets.json new file mode 100644 index 00000000..65bfd77c --- /dev/null +++ b/client/testdata/Published2Times_roottoolarge/server/metadata.staged/targets.json @@ -0,0 +1,19 @@ +{ + "signatures": [ + { + "keyid": "e4dae3872d28d29f7624a702bfd25f68453544d597229ee9e0a8569d1f940cf4", + "sig": "f2cee9e31bda3f88b25b0153bb48a6cb21237e4c41a34bbae95f152b56975085bc04c4978eed6be76a3ead23ff76a1259ff07e7b45b04fb51865c9601713c905" + } + ], + "signed": { + "_type": "targets", + "delegations": { + "keys": {}, + "roles": [] + }, + "expires": "2031-09-09T23:13:37Z", + "spec_version": "1.0.0", + "targets": {}, + "version": 1 + } +} \ No newline at end of file diff --git a/client/testdata/Published2Times_roottoolarge/server/metadata.staged/timestamp.json b/client/testdata/Published2Times_roottoolarge/server/metadata.staged/timestamp.json new file mode 100644 index 00000000..9a03f46a --- /dev/null +++ b/client/testdata/Published2Times_roottoolarge/server/metadata.staged/timestamp.json @@ -0,0 +1,24 @@ +{ + "signatures": [ + { + "keyid": "3a05831328273e4b821c3bbe1fed0c5332749d8e071675879af26a401a5c85ae", + "sig": "35d1087c4874221bc772c8276bd77415d9366833aad4efc3926a8eda1de053843d2c114ac7448f08e3cfd802857c2ab2569d8be186b3cc36e65e458905f0e10e" + } + ], + "signed": { + "_type": "timestamp", + "expires": "2031-09-09T23:13:37Z", + "meta": { + "snapshot.json": { + "hashes": { + "sha256": "d62f650c8097fd4de9e3c8874ef15f7e10fdcc4c32f7a1818e972e8984b8da8a", + "sha512": "d9d0c38df27bc2ccc9523cb8d27623cb40b264053233e5e3261d83e2921c790b21accf9d427e36aa4c1939ddbccaaa5e006267f1cdd451606c514135d178dca5" + }, + "length": 431, + "version": 1 + } + }, + "spec_version": "1.0.0", + "version": 1 + } +} \ No newline at end of file diff --git a/client/testdata/Published2Times_roottoolarge/server/metadata/1.root.json b/client/testdata/Published2Times_roottoolarge/server/metadata/1.root.json new file mode 100644 index 00000000..fff03947 --- /dev/null +++ b/client/testdata/Published2Times_roottoolarge/server/metadata/1.root.json @@ -0,0 +1,87 @@ +{ + "signatures": [ + { + "keyid": "d4dab4b4d68b91665a6d0dac5b4e64677aa6d853fc787669168b4b4ba9822129", + "sig": "481a1bd10fedbe33e88e5f586a8726f558a5ec426bf65d2ba1c449fd1f69148da6af40f1ae18a5be63539dfbf076019db8b28f3f644f7fd4f003b7d06a4c2e09" + } + ], + "signed": { + "_type": "root", + "consistent_snapshot": true, + "expires": "2031-09-09T23:13:37Z", + "keys": { + "3a05831328273e4b821c3bbe1fed0c5332749d8e071675879af26a401a5c85ae": { + "keyid_hash_algorithms": [ + "sha256", + "sha512" + ], + "keytype": "ed25519", + "keyval": { + "public": "6bac59b8d9e1aae02fae6fba6e7fe3fc9fe5b4a9fe98c3fca255d8c8ec3e5b35" + }, + "scheme": "ed25519" + }, + "77dfdca206c0fe1b8e55d67d21dd0e195a0998a9d2b56c6d3ee8f68d04c21e93": { + "keyid_hash_algorithms": [ + "sha256", + "sha512" + ], + "keytype": "ed25519", + "keyval": { + "public": "6400d770c7c1bce4b3d59ce0079ed686e843b6500bbea77d869a1ae7df4565a1" + }, + "scheme": "ed25519" + }, + "d4dab4b4d68b91665a6d0dac5b4e64677aa6d853fc787669168b4b4ba9822129": { + "keyid_hash_algorithms": [ + "sha256", + "sha512" + ], + "keytype": "ed25519", + "keyval": { + "public": "28bf74baa87ed923f8fa27e3292684f8ec4730ce0bdc65150ed58199206ce089" + }, + "scheme": "ed25519" + }, + "e4dae3872d28d29f7624a702bfd25f68453544d597229ee9e0a8569d1f940cf4": { + "keyid_hash_algorithms": [ + "sha256", + "sha512" + ], + "keytype": "ed25519", + "keyval": { + "public": "e6ae9d3b67d7b3ce274130291dd90287f32b8fd72bfb4ac5430859ebd1c28a46" + }, + "scheme": "ed25519" + } + }, + "roles": { + "root": { + "keyids": [ + "d4dab4b4d68b91665a6d0dac5b4e64677aa6d853fc787669168b4b4ba9822129" + ], + "threshold": 1 + }, + "snapshot": { + "keyids": [ + "77dfdca206c0fe1b8e55d67d21dd0e195a0998a9d2b56c6d3ee8f68d04c21e93" + ], + "threshold": 1 + }, + "targets": { + "keyids": [ + "e4dae3872d28d29f7624a702bfd25f68453544d597229ee9e0a8569d1f940cf4" + ], + "threshold": 1 + }, + "timestamp": { + "keyids": [ + "3a05831328273e4b821c3bbe1fed0c5332749d8e071675879af26a401a5c85ae" + ], + "threshold": 1 + } + }, + "spec_version": "1.0.0", + "version": 1 + } +} \ No newline at end of file diff --git a/client/testdata/Published2Times_roottoolarge/server/metadata/1.snapshot.json b/client/testdata/Published2Times_roottoolarge/server/metadata/1.snapshot.json new file mode 100644 index 00000000..42d8aae0 --- /dev/null +++ b/client/testdata/Published2Times_roottoolarge/server/metadata/1.snapshot.json @@ -0,0 +1,19 @@ +{ + "signatures": [ + { + "keyid": "77dfdca206c0fe1b8e55d67d21dd0e195a0998a9d2b56c6d3ee8f68d04c21e93", + "sig": "ecf4d79a88873efb223361e550b8fc35813ad7bf31d9769908d9495cfb930e03db889dc7419897031cadf39437c9f49b085f384fe1c18be3961704062365db0c" + } + ], + "signed": { + "_type": "snapshot", + "expires": "2031-09-09T23:13:37Z", + "meta": { + "targets.json": { + "version": 1 + } + }, + "spec_version": "1.0.0", + "version": 1 + } +} \ No newline at end of file diff --git a/client/testdata/Published2Times_roottoolarge/server/metadata/1.targets.json b/client/testdata/Published2Times_roottoolarge/server/metadata/1.targets.json new file mode 100644 index 00000000..65bfd77c --- /dev/null +++ b/client/testdata/Published2Times_roottoolarge/server/metadata/1.targets.json @@ -0,0 +1,19 @@ +{ + "signatures": [ + { + "keyid": "e4dae3872d28d29f7624a702bfd25f68453544d597229ee9e0a8569d1f940cf4", + "sig": "f2cee9e31bda3f88b25b0153bb48a6cb21237e4c41a34bbae95f152b56975085bc04c4978eed6be76a3ead23ff76a1259ff07e7b45b04fb51865c9601713c905" + } + ], + "signed": { + "_type": "targets", + "delegations": { + "keys": {}, + "roles": [] + }, + "expires": "2031-09-09T23:13:37Z", + "spec_version": "1.0.0", + "targets": {}, + "version": 1 + } +} \ No newline at end of file diff --git a/client/testdata/Published2Times_roottoolarge/server/metadata/1.timestamp.json b/client/testdata/Published2Times_roottoolarge/server/metadata/1.timestamp.json new file mode 100644 index 00000000..9a03f46a --- /dev/null +++ b/client/testdata/Published2Times_roottoolarge/server/metadata/1.timestamp.json @@ -0,0 +1,24 @@ +{ + "signatures": [ + { + "keyid": "3a05831328273e4b821c3bbe1fed0c5332749d8e071675879af26a401a5c85ae", + "sig": "35d1087c4874221bc772c8276bd77415d9366833aad4efc3926a8eda1de053843d2c114ac7448f08e3cfd802857c2ab2569d8be186b3cc36e65e458905f0e10e" + } + ], + "signed": { + "_type": "timestamp", + "expires": "2031-09-09T23:13:37Z", + "meta": { + "snapshot.json": { + "hashes": { + "sha256": "d62f650c8097fd4de9e3c8874ef15f7e10fdcc4c32f7a1818e972e8984b8da8a", + "sha512": "d9d0c38df27bc2ccc9523cb8d27623cb40b264053233e5e3261d83e2921c790b21accf9d427e36aa4c1939ddbccaaa5e006267f1cdd451606c514135d178dca5" + }, + "length": 431, + "version": 1 + } + }, + "spec_version": "1.0.0", + "version": 1 + } +} \ No newline at end of file diff --git a/client/testdata/Published2Times_roottoolarge/server/metadata/2.root.json b/client/testdata/Published2Times_roottoolarge/server/metadata/2.root.json new file mode 100644 index 00000000..4aad61d5 Binary files /dev/null and b/client/testdata/Published2Times_roottoolarge/server/metadata/2.root.json differ diff --git a/client/testdata/Published2Times_roottoolarge/server/metadata/root.json b/client/testdata/Published2Times_roottoolarge/server/metadata/root.json new file mode 100644 index 00000000..21d082c8 --- /dev/null +++ b/client/testdata/Published2Times_roottoolarge/server/metadata/root.json @@ -0,0 +1,103 @@ +{ + "signatures": [ + { + "keyid": "05e17c1501d627b2597322f80d33aacec6f30a507552d3326a88913422b0e30b", + "sig": "122b322d6f212fcc22ec9062e6948baf694ec4ecf366e4a3cd5cf4c738aa39706b3420aeacd6d8e0e54f0af0168644e905696b397974dadfd3d2a578be06fd08" + }, + { + "keyid": "d4dab4b4d68b91665a6d0dac5b4e64677aa6d853fc787669168b4b4ba9822129", + "sig": "c5e5a542c368d32a8bb1884ffcc850f8902c96537b2b827be3608c44dbdd24ff0cd3b0c326e03869474091e21073f87a57237f2909300a2c43a41ca90c22020c" + } + ], + "signed": { + "_type": "root", + "consistent_snapshot": true, + "expires": "2031-09-09T23:13:37Z", + "keys": { + "05e17c1501d627b2597322f80d33aacec6f30a507552d3326a88913422b0e30b": { + "keyid_hash_algorithms": [ + "sha256", + "sha512" + ], + "keytype": "ed25519", + "keyval": { + "public": "f758af464295e62a1da4d3267be6d13f4aba9c7d52166d01b6bd5b4559496c9d" + }, + "scheme": "ed25519" + }, + "3a05831328273e4b821c3bbe1fed0c5332749d8e071675879af26a401a5c85ae": { + "keyid_hash_algorithms": [ + "sha256", + "sha512" + ], + "keytype": "ed25519", + "keyval": { + "public": "6bac59b8d9e1aae02fae6fba6e7fe3fc9fe5b4a9fe98c3fca255d8c8ec3e5b35" + }, + "scheme": "ed25519" + }, + "77dfdca206c0fe1b8e55d67d21dd0e195a0998a9d2b56c6d3ee8f68d04c21e93": { + "keyid_hash_algorithms": [ + "sha256", + "sha512" + ], + "keytype": "ed25519", + "keyval": { + "public": "6400d770c7c1bce4b3d59ce0079ed686e843b6500bbea77d869a1ae7df4565a1" + }, + "scheme": "ed25519" + }, + "d4dab4b4d68b91665a6d0dac5b4e64677aa6d853fc787669168b4b4ba9822129": { + "keyid_hash_algorithms": [ + "sha256", + "sha512" + ], + "keytype": "ed25519", + "keyval": { + "public": "28bf74baa87ed923f8fa27e3292684f8ec4730ce0bdc65150ed58199206ce089" + }, + "scheme": "ed25519" + }, + "e4dae3872d28d29f7624a702bfd25f68453544d597229ee9e0a8569d1f940cf4": { + "keyid_hash_algorithms": [ + "sha256", + "sha512" + ], + "keytype": "ed25519", + "keyval": { + "public": "e6ae9d3b67d7b3ce274130291dd90287f32b8fd72bfb4ac5430859ebd1c28a46" + }, + "scheme": "ed25519" + } + }, + "roles": { + "root": { + "keyids": [ + "d4dab4b4d68b91665a6d0dac5b4e64677aa6d853fc787669168b4b4ba9822129", + "05e17c1501d627b2597322f80d33aacec6f30a507552d3326a88913422b0e30b" + ], + "threshold": 1 + }, + "snapshot": { + "keyids": [ + "77dfdca206c0fe1b8e55d67d21dd0e195a0998a9d2b56c6d3ee8f68d04c21e93" + ], + "threshold": 1 + }, + "targets": { + "keyids": [ + "e4dae3872d28d29f7624a702bfd25f68453544d597229ee9e0a8569d1f940cf4" + ], + "threshold": 1 + }, + "timestamp": { + "keyids": [ + "3a05831328273e4b821c3bbe1fed0c5332749d8e071675879af26a401a5c85ae" + ], + "threshold": 1 + } + }, + "spec_version": "1.0.0", + "version": 2 + } +} \ No newline at end of file diff --git a/client/testdata/Published2Times_roottoolarge/server/metadata/snapshot.json b/client/testdata/Published2Times_roottoolarge/server/metadata/snapshot.json new file mode 100644 index 00000000..42d8aae0 --- /dev/null +++ b/client/testdata/Published2Times_roottoolarge/server/metadata/snapshot.json @@ -0,0 +1,19 @@ +{ + "signatures": [ + { + "keyid": "77dfdca206c0fe1b8e55d67d21dd0e195a0998a9d2b56c6d3ee8f68d04c21e93", + "sig": "ecf4d79a88873efb223361e550b8fc35813ad7bf31d9769908d9495cfb930e03db889dc7419897031cadf39437c9f49b085f384fe1c18be3961704062365db0c" + } + ], + "signed": { + "_type": "snapshot", + "expires": "2031-09-09T23:13:37Z", + "meta": { + "targets.json": { + "version": 1 + } + }, + "spec_version": "1.0.0", + "version": 1 + } +} \ No newline at end of file diff --git a/client/testdata/Published2Times_roottoolarge/server/metadata/targets.json b/client/testdata/Published2Times_roottoolarge/server/metadata/targets.json new file mode 100644 index 00000000..65bfd77c --- /dev/null +++ b/client/testdata/Published2Times_roottoolarge/server/metadata/targets.json @@ -0,0 +1,19 @@ +{ + "signatures": [ + { + "keyid": "e4dae3872d28d29f7624a702bfd25f68453544d597229ee9e0a8569d1f940cf4", + "sig": "f2cee9e31bda3f88b25b0153bb48a6cb21237e4c41a34bbae95f152b56975085bc04c4978eed6be76a3ead23ff76a1259ff07e7b45b04fb51865c9601713c905" + } + ], + "signed": { + "_type": "targets", + "delegations": { + "keys": {}, + "roles": [] + }, + "expires": "2031-09-09T23:13:37Z", + "spec_version": "1.0.0", + "targets": {}, + "version": 1 + } +} \ No newline at end of file diff --git a/client/testdata/Published2Times_roottoolarge/server/metadata/timestamp.json b/client/testdata/Published2Times_roottoolarge/server/metadata/timestamp.json new file mode 100644 index 00000000..9a03f46a --- /dev/null +++ b/client/testdata/Published2Times_roottoolarge/server/metadata/timestamp.json @@ -0,0 +1,24 @@ +{ + "signatures": [ + { + "keyid": "3a05831328273e4b821c3bbe1fed0c5332749d8e071675879af26a401a5c85ae", + "sig": "35d1087c4874221bc772c8276bd77415d9366833aad4efc3926a8eda1de053843d2c114ac7448f08e3cfd802857c2ab2569d8be186b3cc36e65e458905f0e10e" + } + ], + "signed": { + "_type": "timestamp", + "expires": "2031-09-09T23:13:37Z", + "meta": { + "snapshot.json": { + "hashes": { + "sha256": "d62f650c8097fd4de9e3c8874ef15f7e10fdcc4c32f7a1818e972e8984b8da8a", + "sha512": "d9d0c38df27bc2ccc9523cb8d27623cb40b264053233e5e3261d83e2921c790b21accf9d427e36aa4c1939ddbccaaa5e006267f1cdd451606c514135d178dca5" + }, + "length": 431, + "version": 1 + } + }, + "spec_version": "1.0.0", + "version": 1 + } +} \ No newline at end of file diff --git a/repo.go b/repo.go index 90d16928..b4ca62b9 100644 --- a/repo.go +++ b/repo.go @@ -1591,3 +1591,8 @@ func (r *Repo) CheckRoleUnexpired(role string, validAt time.Time) error { } return nil } + +// GetMeta returns the underlying meta file map from the store. +func (r *Repo) GetMeta() (map[string]json.RawMessage, error) { + return r.local.GetMeta() +}