From 7b4c3218e1cf7785eb7a59e02ff8b540a657d88f Mon Sep 17 00:00:00 2001 From: vladdd Date: Sat, 19 Apr 2014 14:39:47 -0400 Subject: [PATCH] Remove extraneous example files. --- .../client/metadata/current/snapshot.json | Bin 1007 -> 0 bytes examples/client/metadata/current/targets.json | Bin 1184 -> 0 bytes .../metadata/current/targets/project.json | Bin 604 -> 0 bytes .../client/metadata/current/timestamp.json | Bin 544 -> 0 bytes .../client/metadata/previous/timestamp.json | Bin 544 -> 0 bytes examples/client/targets/file1.txt | 1 - examples/client/targets/file2.txt | 1 - examples/client/targets/project/file3.txt | 1 - examples/generate.py | 131 ------------------ 9 files changed, 134 deletions(-) delete mode 100644 examples/client/metadata/current/snapshot.json delete mode 100644 examples/client/metadata/current/targets.json delete mode 100644 examples/client/metadata/current/targets/project.json delete mode 100644 examples/client/metadata/current/timestamp.json delete mode 100644 examples/client/metadata/previous/timestamp.json delete mode 100644 examples/client/targets/file1.txt delete mode 100644 examples/client/targets/file2.txt delete mode 100644 examples/client/targets/project/file3.txt delete mode 100755 examples/generate.py diff --git a/examples/client/metadata/current/snapshot.json b/examples/client/metadata/current/snapshot.json deleted file mode 100644 index 3294c89ede76ef6f75d6401edfc3f2856f6b3bab..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1007 zcmb7@-Hy{h42AFe6j82W8Qb&Y+1G$85JK}~x7~%dY64 zoafCjPW$bl%-_#4jrYT+%`iOMGmMY&wC{E^YLna)TH{z<_Myk(JSvfQ7?nUeix+_a z4uKUi3wN?NbO_|~_-0reev^53Tsum~5a4gY0Myx^{;$O5~VF@Bk!PO>n*Ka|t7JI+^4qx?MWufC1w$h~!7=Yw-qTdl?g8| zordvzJkECy)A8`p`QH#FD&i_DrcRC**r2R*zplsVpi81;{jzg_6TVxtz uB>OkO5@ZWrnouJX diff --git a/examples/client/metadata/current/targets.json b/examples/client/metadata/current/targets.json deleted file mode 100644 index 6387d30ea4f8d4fdde51dc0e1edddfc007567407..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1184 zcmbtT%WfMn47~d*7CN^LMZNPKIkgB1N}{|@9ow)sL4v^lUhXSKZUwr~F0^`(!W~aVDK!>jJsO)^XtD|p zeavz`C8!RAAtaO4w{8mf%tL>iB63CNbXqqAz?g?qs}=xa%Y@zp7s<4yYjLSbOp9cb z2EvHJCTdB$mNS#Kpmm7s2sA>1f*2e4nswzI9MxEB4Q#<1N5$!CGgt$<6^2#=0tCw- zHT}_-<1(^ z_ELMxL6ZloQHvxsT4S^^o(qv~HWCzvrbW@T1djy9mVm*7Z#2>(k1(@-uZy7Pqz#Xib(E?Du~X*YL?LNM?hw2TLU`)T}KOtFAk#ZXg9J*8Yc(y5*< z{Y2g583BCh37sG1@-D~XLvy;MBub@-4w?lb7s%*Pqq7ObIRrK)XT23A*~TF27V09` zB2lOIeAo`X1U6Gm%lZro{~45ZSU4Jp4xmQE&04gvMiz&labjVe5;oZiOo>eZc3yMK hnrxvowbn|bRC@!JMxsY+Efl}<`6BH!OK{y>{{m+DCgcDB diff --git a/examples/client/metadata/current/targets/project.json b/examples/client/metadata/current/targets/project.json deleted file mode 100644 index 57f4195ab32db50b3e1a9274a056355a40072b4a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 604 zcmX|-+iu%15Jcbo6#}2zW_ej&@*R0<5fn>mX(@GWLt={rf&aZr*(yK+ zt@H6r?a#uidLDiphT&88pnmbkJc^qq{M4k450Q8&$33IhBL&-IT1kPg-O@c(RlAlZRnR$%N zft?vsOeti|kqeLy5f}ra#{fQtu{uIbBYI2dlflSTG*)?KO*Zn#kKke{a>MGuDxtg` zhS!d}mBJmim!W>Pk1Kb^7g~d~N`@i<5>YV)z{KctuVp6};}f5cZ4zS>`#=iY QfAyD_RjQDYK8Sw%2bv+AF8}}l diff --git a/examples/client/metadata/current/timestamp.json b/examples/client/metadata/current/timestamp.json deleted file mode 100644 index 93e124e167dcb22a37eea5f2206c5523b52d0fda..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 544 zcmXw$%}yOL42AdiDWa^QvYmgPgH;hiPU0}r_Wp>ORv^T?*E9DbIU74V{?75|!PsSf zJ@NYYO&0rLo({%*>NEDYe9T=t7MZF?ghHwNR+&PgNF$=pC1NULAWjSrx37w4-{bAQ=k(=Y>8tdj$9m<5mG{_B%ukk;(8Ams?tLQY z+&vW8V7D;r%ldJVjq!0l%ChqDa%H#jewnYqSpo<5fLf0L4}1N*{Zi+AlTzgqUzX{- z{`j?=Pv2c*Ctjxg0(<(pbD1>hxGinyS*m7QhF97KJ-d$NGu476`Jl((KAhBqAg-cN rO+|7?Jy*=Q8B=T5GZ_0vPOs~v!U&MIk($0u?LT>2<{b+U+W-0wX6=oH diff --git a/examples/client/metadata/previous/timestamp.json b/examples/client/metadata/previous/timestamp.json deleted file mode 100644 index 93e124e167dcb22a37eea5f2206c5523b52d0fda..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 544 zcmXw$%}yOL42AdiDWa^QvYmgPgH;hiPU0}r_Wp>ORv^T?*E9DbIU74V{?75|!PsSf zJ@NYYO&0rLo({%*>NEDYe9T=t7MZF?ghHwNR+&PgNF$=pC1NULAWjSrx37w4-{bAQ=k(=Y>8tdj$9m<5mG{_B%ukk;(8Ams?tLQY z+&vW8V7D;r%ldJVjq!0l%ChqDa%H#jewnYqSpo<5fLf0L4}1N*{Zi+AlTzgqUzX{- z{`j?=Pv2c*Ctjxg0(<(pbD1>hxGinyS*m7QhF97KJ-d$NGu476`Jl((KAhBqAg-cN rO+|7?Jy*=Q8B=T5GZ_0vPOs~v!U&MIk($0u?LT>2<{b+U+W-0wX6=oH diff --git a/examples/client/targets/file1.txt b/examples/client/targets/file1.txt deleted file mode 100644 index 7bf3499f..00000000 --- a/examples/client/targets/file1.txt +++ /dev/null @@ -1 +0,0 @@ -This is an example target file. \ No newline at end of file diff --git a/examples/client/targets/file2.txt b/examples/client/targets/file2.txt deleted file mode 100644 index 606f18ef..00000000 --- a/examples/client/targets/file2.txt +++ /dev/null @@ -1 +0,0 @@ -This is an another example target file. \ No newline at end of file diff --git a/examples/client/targets/project/file3.txt b/examples/client/targets/project/file3.txt deleted file mode 100644 index 60464604..00000000 --- a/examples/client/targets/project/file3.txt +++ /dev/null @@ -1 +0,0 @@ -This is role1's target file. \ No newline at end of file diff --git a/examples/generate.py b/examples/generate.py deleted file mode 100755 index f9f3530a..00000000 --- a/examples/generate.py +++ /dev/null @@ -1,131 +0,0 @@ -""" - - generate.py - - - Vladimir Diaz - - - February 26, 2014. - - - See LICENSE for licensing information. - - - Provide a set of pre-generated key files and a basic repository that unit - tests can use in their test cases. The pre-generated files created by this - script should be copied by the unit tests as needed. The original versions - should be preserved. 'tuf/tests/unit/repository_files/' will store the files - generated. 'generate.py' should not require re-execution if the pre-generated - repository files have already been created, unless they need to change in some - way. -""" - -import shutil -import datetime - -from tuf.repository_tool import * -import tuf.util - -repository = create_new_repository('repository') - -# Generate and save the top-level role keys, including the delegated roles. -# The unit tests should only have to import the keys they need from these -# pre-generated key files. -root_key_file = 'keystore/root_key' -targets_key_file = 'keystore/targets_key' -snapshot_key_file = 'keystore/snapshot_key' -timestamp_key_file = 'keystore/timestamp_key' -project_key_file = 'keystore/project_key' - -# Generate public and private key files for the top-level roles, and two -# delegated roles (these number of keys should be sufficient for most of the -# unit tests). Unit tests may generate additional keys, if needed. -generate_and_write_ed25519_keypair(root_key_file, password='password') -generate_and_write_ed25519_keypair(targets_key_file, password='password') -generate_and_write_ed25519_keypair(snapshot_key_file, password='password') -generate_and_write_ed25519_keypair(timestamp_key_file, password='password') -generate_and_write_ed25519_keypair(project_key_file, password='password') - -# Import the public keys. These keys are needed so that metadata roles are -# assigned verification keys, which clients use to verify the signatures created -# by the corresponding private keys. -root_public = import_ed25519_publickey_from_file(root_key_file+'.pub') -targets_public = import_ed25519_publickey_from_file(targets_key_file+'.pub') -snapshot_public = import_ed25519_publickey_from_file(snapshot_key_file+'.pub') -timestamp_public = import_ed25519_publickey_from_file(timestamp_key_file+'.pub') -project_public = import_ed25519_publickey_from_file(project_key_file+'.pub') - -# Import the private keys. These private keys are needed to generate the -# signatures included in metadata. -root_private = import_ed25519_privatekey_from_file(root_key_file, 'password') -targets_private = import_ed25519_privatekey_from_file(targets_key_file, 'password') -snapshot_private = import_ed25519_privatekey_from_file(snapshot_key_file, 'password') -timestamp_private = import_ed25519_privatekey_from_file(timestamp_key_file, 'password') -project_private = import_ed25519_privatekey_from_file(project_key_file, 'password') - -# Add the verification keys to the top-level roles. -repository.root.add_verification_key(root_public) -repository.targets.add_verification_key(targets_public) -repository.snapshot.add_verification_key(snapshot_public) -repository.timestamp.add_verification_key(timestamp_public) - -# Load the signing keys, previously imported, for the top-level roles so that -# valid metadata can be written. -repository.root.load_signing_key(root_private) -repository.targets.load_signing_key(targets_private) -repository.snapshot.load_signing_key(snapshot_private) -repository.timestamp.load_signing_key(timestamp_private) - -# Create the target files (downloaded by clients) whose file size and digest -# are specified in the 'targets.json' file. -target1_filepath = 'repository/targets/file1.txt' -tuf.util.ensure_parent_dir(target1_filepath) -target2_filepath = 'repository/targets/file2.txt' -tuf.util.ensure_parent_dir(target2_filepath) -target3_filepath = 'repository/targets/project/file3.txt' -tuf.util.ensure_parent_dir(target3_filepath) - -with open(target1_filepath, 'wb') as file_object: - file_object.write('This is an example target file.') - -with open(target2_filepath, 'wb') as file_object: - file_object.write('This is an another example target file.') - -with open(target3_filepath, 'wb') as file_object: - file_object.write('This is role1\'s target file.') - -# Add target files to the top-level 'targets.json' role. These target files -# should already exist. -repository.targets.add_target(target1_filepath) -repository.targets.add_target(target2_filepath) - -repository.targets.delegate('project', [project_public], [target3_filepath]) -repository.targets('project').load_signing_key(project_private) - -# Set the top-level expiration times far into the future so that -# they do not expire anytime soon, or else the tests fail. Unit tests may -# modify the expiration datetimes (of the copied files), if they wish. -repository.root.expiration = datetime.datetime(2030, 01, 01, 00, 00) -repository.targets.expiration = datetime.datetime(2030, 01, 01, 00, 00) -repository.snapshot.expiration = datetime.datetime(2030, 01, 01, 00, 00) -repository.timestamp.expiration = datetime.datetime(2030, 01, 01, 00, 00) -repository.targets('project').expiration = datetime.datetime(2030, 01, 01, 00, 00) - -# Compress the 'targets.json' role so that the unit tests have a pre-generated -# example of compressed metadata. -repository.targets.compressions = ['gz'] - -# Create the actual metadata files, which are saved to 'metadata.staged'. -repository.write() - -# Move the staged.metadata to 'metadata' and create the client folder. The -# client folder, which includes the required directory structure and metadata -# files for clients to successfully load an 'tuf.client.updater.py' object. -staged_metadata_directory = 'repository/metadata.staged' -metadata_directory = 'repository/metadata' -shutil.copytree(staged_metadata_directory, metadata_directory) - -# Create the client files (required directory structure and minimal metadata) -# required by the 'tuf.interposition' and 'tuf.client.updater.py' updaters. -create_tuf_client_directory('repository', 'client')