Skip to content

Commit

Permalink
Merge pull request in-toto#146 from in-toto/securesystemslib-0.10.8
Browse files Browse the repository at this point in the history
Update to securesystemslib v0.10.8
  • Loading branch information
SantiagoTorres authored Nov 8, 2017
2 parents 40f1e1d + 2a0f134 commit c3e9687
Show file tree
Hide file tree
Showing 11 changed files with 73 additions and 67 deletions.
4 changes: 2 additions & 2 deletions in_toto/in_toto_sign.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
# Re-sign specified link
# Since -o is not specified, write to default output filename, using the
# short id for priv_key as a filename infix (in place of "c1ae1e51")
in-toto-sign -f package.c1ae1e51.link -k priv_key
# short id for priv_key as a filename infix (in place of "2f89b927")
in-toto-sign -f package.2f89b927.link -k priv_key
# Verify Layout signed with three keys
in-toto-sign -f root.layout -k pub_key0 pub_key1 pub_key2 --verify
Expand Down
2 changes: 1 addition & 1 deletion in_toto/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def import_rsa_key_from_file(filepath, password=None):

if securesystemslib.keys.is_pem_private(rsa_pem):
rsa_key = securesystemslib.keys.import_rsakey_from_private_pem(
rsa_pem, password)
rsa_pem, password=password)

elif securesystemslib.keys.is_pem_public(rsa_pem):
rsa_key = securesystemslib.keys.import_rsakey_from_public_pem(rsa_pem)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
securesystemslib==0.10.4
securesystemslib==0.10.8
sphinx
attrs
python-dateutil
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"the integrity of software supply chains"),
license="MIT",
packages=find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests"]),
install_requires=["six", "securesystemslib==0.10.4", "attrs", "canonicaljson",
install_requires=["six", "securesystemslib==0.10.8", "attrs", "canonicaljson",
"python-dateutil", "iso8601"],
test_suite="test.runtests",
entry_points={
Expand Down
39 changes: 23 additions & 16 deletions test/demo_files/demo.layout.template
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"signed" : {
{"signed": {
"_type": "layout",
"readme" : "",
"inspect": [
{
"_type": "inspection",
Expand Down Expand Up @@ -34,23 +32,34 @@
}
],
"keys": {
"0c6c50a1c30f3c0ce179598bf49502d2a89ccc2dccc4db5adcaf83b9f309d117": {
"keyid": "0c6c50a1c30f3c0ce179598bf49502d2a89ccc2dccc4db5adcaf83b9f309d117",
"2f89b9272acfc8f4a0a0f094d789fdb0ba798b0fe41f2f5f417c12f0085ff498": {
"keyid": "2f89b9272acfc8f4a0a0f094d789fdb0ba798b0fe41f2f5f417c12f0085ff498",
"keyid_hash_algorithms": [
"sha256",
"sha512"
],
"keytype": "rsa",
"keyval": {
"private": "",
"public": "-----BEGIN PUBLIC KEY-----\nMIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEA0Zfzonp3/FScaIP+KKuz\nB+OZNFpjbVGWjm3leqnFqHYLqrLcCw5KhlXpycJqoSvZBpO+PFCksUx8U/ryklHG\nVoDiB84pRkvZtBoVaA4b4IHDIhz1K5NqkJgieya4fwReTxmCW0a9gH7AnDicHBCX\nlzMxqEdt6OKMV5g4yjKaxf8lW72O1gSI46GSIToo+Z7UUgs3ofaM5UFIcczgCpUa\n5kEKocB6cSZ9U8PKRLSs0xO0ROjrcOTsfxMs8eV4bsRCWY5mAq1WM9EHDSV9WO8g\nqrRmanC4enNqa8jU4O3zhgJVegP9A01r9AwNt6AqgPSikwhXN/P4v1FMYV+R6N3b\nS1lsVWRAnwBq5RFz5zVvcY88JEkHbrcBqP/A4909NXae1VMXmnoJb4EzGAkyUySB\na+fHXAVJgzwyv3I48d/OIjH8NWcVmM/DQL7FtcJk3tp0YUjY5wNpcbQTnLzURtlU\nsd+MtGuvdlDxUUvtUYCIVKRdS8UzYnTPjI2xzeoSHZ2ZAgMBAAE=\n-----END PUBLIC KEY-----"
}
"public": "-----BEGIN PUBLIC KEY-----\nMIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAzgLBsMFSgwBiWTBmVsyW\n5KbJwLFSodAzdUhU2Bq6SdRz/W6UOBGdojZXibxupjRtAaEQW/eXDe+1CbKg6ENZ\nGt2D9HGFCQZgQS8ONgNDQGiNxgApMA0T21AaUhru0vEofzdN1DfEF4CAGv5AkcgK\nsalhTyONervFIjFEdXGelFZ7dVMV3Pp5WkZPG0jFQWjnmDZhUrtSxEtqbVghc3kK\nAUj9Ll/3jyi2wS92Z1j5ueN8X62hWX2xBqQ6nViOMzdujkoiYCRSwuMLRqzW2CbT\nL8hF1+S5KWKFzxl5sCVfpPe7V5HkgEHjwCILXTbCn2fCMKlaSbJ/MG2lW7qSY2Ro\nwVXWkp1wDrsJ6Ii9f2dErv9vJeOVZeO9DsooQ5EuzLCfQLEU5mn7ul7bU7rFsb8J\nxYOeudkNBatnNCgVMAkmDPiNA7E33bmL5ARRwU0iZicsqLQR32pmwdap8PjofxqQ\nk7Gtvz/iYzaLrZv33cFWWTsEOqK1gKqigSqgW9T26wO9AgMBAAE=\n-----END PUBLIC KEY-----"
},
"scheme": "rsassa-pss-sha256"
},
"c1ae1e516e00e9cab671b3302b0b861cd1cd22d175e6c6dc49ad8c271c91a5b8": {
"keyid": "c1ae1e516e00e9cab671b3302b0b861cd1cd22d175e6c6dc49ad8c271c91a5b8",
"776a00e29f3559e0141b3b096f696abc6cfb0c657ab40f441132b345b08453f5": {
"keyid": "776a00e29f3559e0141b3b096f696abc6cfb0c657ab40f441132b345b08453f5",
"keyid_hash_algorithms": [
"sha256",
"sha512"
],
"keytype": "rsa",
"keyval": {
"private": "",
"public": "-----BEGIN PUBLIC KEY-----\nMIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAzgLBsMFSgwBiWTBmVsyW\n5KbJwLFSodAzdUhU2Bq6SdRz/W6UOBGdojZXibxupjRtAaEQW/eXDe+1CbKg6ENZ\nGt2D9HGFCQZgQS8ONgNDQGiNxgApMA0T21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rsassa-pss-sha256"
}
},
"readme": "",
"steps": [
{
"_type": "step",
Expand All @@ -64,7 +73,7 @@
],
"name": "write-code",
"pubkeys": [
"0c6c50a1c30f3c0ce179598bf49502d2a89ccc2dccc4db5adcaf83b9f309d117"
"776a00e29f3559e0141b3b096f696abc6cfb0c657ab40f441132b345b08453f5"
],
"threshold": 1
},
Expand Down Expand Up @@ -98,11 +107,9 @@
],
"name": "package",
"pubkeys": [
"c1ae1e516e00e9cab671b3302b0b861cd1cd22d175e6c6dc49ad8c271c91a5b8"
"2f89b9272acfc8f4a0a0f094d789fdb0ba798b0fe41f2f5f417c12f0085ff498"
],
"threshold": 1
}
]
},
"signatures": []
}
}, "signatures": []}
26 changes: 26 additions & 0 deletions test/demo_files/package.2f89b927.link
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{"signed": {
"_type": "link",
"byproducts": {
"return-value": 0,
"stderr": "a foo.py\n",
"stdout": ""
},
"command": [
"tar",
"zcvf",
"foo.tar.gz",
"foo.py"
],
"environment": {},
"materials": {
"foo.py": {
"sha256": "74dc3727c6e89308b39e4dfedf787e37841198b1fa165a27c013544a60502549"
}
},
"name": "package",
"products": {
"foo.tar.gz": {
"sha256": "52947cb78b91ad01fe81cd6aef42d1f6817e92b9e6936c1e5aabb7c98514f355"
}
}
}, "signatures": [{"keyid":"2f89b9272acfc8f4a0a0f094d789fdb0ba798b0fe41f2f5f417c12f0085ff498","sig":"3b133e862b62290ffd56144dc92657375bfbb4a234a00abf17c81848ef82bf4e0fba3392e8be8f0e85b371081f487914994810974443a74e549db7ae8f869ba2001393ec07f8720efc2704abcadb55e34431108721a954129b6dd9301729bf8cddcbc619bb58a64abe4653fa037a8c5798c2b62c9f794607faa20c834ae29ec15cea5aa66ccbdf8233031e1ff4f5e1eaeb92eaaa1f42564633e7f25f23a3bd67695e9dc0c2e3af0b8a27cc2278ff234bef531946c98e73f78b85cfcb95127268ee399245130af3b13992315f360f2533cc46ede7f680124234234f1aefa25c589e0813617f4e21815d2d7ff1446dc48704314695a5a405f7d2cfa03bc63827a4bfd202d0df2addde52074e84e67dc98b5acf9e4053d30b32e5f58d6665912c96131db6b062c2a6e975983a2d3eab8a7b341d6d5c58e691d89ec80d5218884348ec890d04ca8a21082eaa8aa7b99936130dfc4ee5092bcbe61296aa09341c582f52aa4c17373d1284905306384236d6208a2873d8b1d16547e5323e7da7028719"}]}
26 changes: 0 additions & 26 deletions test/demo_files/package.c1ae1e51.link

This file was deleted.

13 changes: 0 additions & 13 deletions test/demo_files/write-code.0c6c50a1.link

This file was deleted.

13 changes: 13 additions & 0 deletions test/demo_files/write-code.776a00e2.link
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{"signed": {
"_type": "link",
"byproducts": {},
"command": [],
"environment": {},
"materials": {},
"name": "write-code",
"products": {
"foo.py": {
"sha256": "74dc3727c6e89308b39e4dfedf787e37841198b1fa165a27c013544a60502549"
}
}
}, "signatures": [{"keyid":"776a00e29f3559e0141b3b096f696abc6cfb0c657ab40f441132b345b08453f5","sig":"c7625874086f8980dc28d1c6704aaaa5b9dc65400e9f33a3546abf2e5b46d2084c684981e866a43bb9748eeb5344eb8abdbcf27c6c6eee9cec483ed2d673cf2d4bc7a856539e000079b95b5cbea381513b06b78c909ebe699010ea60f21cf1fa452fa40d3cc35ddd50cf4a3c7fdcf3c323123716e839c6e2226394333f122818cdb5b0adf846ab4f03e193684add833f1a92dc1f1a5a9bed01d99ba88b16351070bffe06fd311098cab07a351bd5f96eccc4fc715b3fda54ae35223843010038abeac5ad6bd523a28e8e402320c4d71140512f6d070a869bc682cc962ece0f4768dec1c2d992effb8b19c48d378f3363f5e3345562ca6f3dad8951bf3612f8bbe85e1e517f8fcde7041adfc9c813dd6f88a2ca15717074c5bad7412056fe97c89d730139c2a6d2decc1a5f5ac220975d4f932b9c57acb1e5c262ca88d6bd10208ae879d349c8142f834fa9ce2145e63662a3e08216e0df131617786d9c7a160ce19d74475c077c8ecee2c524c2eb6b4ee522cb730fbb865d3a0fc000671e9b5a"}]}
5 changes: 2 additions & 3 deletions test/test_in_toto_sign.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def setUpClass(self):
shutil.copy(os.path.join(demo_files, file_path), self.test_dir)

self.layout_path = "demo.layout.template"
self.link_path = "package.c1ae1e51.link"
self.link_path = "package.2f89b927.link"
self.alice_path = "alice"
self.alice_pub_path = "alice.pub"
self.bob_path= "bob"
Expand Down Expand Up @@ -131,12 +131,11 @@ def test_sign_and_verify(self):
], 0)
# Verify Link with alice's keyid as infix
self._test_cli_sys_exit([
"-f", "package.20a893b8.link",
"-f", "package.556caebd.link",
"-k", self.alice_pub_path,
"--verify"
], 0)


def test_fail_signing(self):
"""Fail signing with an invalid key. """
self._test_cli_sys_exit([
Expand Down
8 changes: 4 additions & 4 deletions test/test_verifylib.py
Original file line number Diff line number Diff line change
Expand Up @@ -988,12 +988,12 @@ def test_verify_failing_layout_expired(self):

def test_verify_failing_link_metadata_files(self):
"""Test fail verification with link metadata files not found. """
os.rename("package.c1ae1e51.link", "package.link.bak")
os.rename("package.2f89b927.link", "package.link.bak")
layout = Metablock.load(self.layout_single_signed_path)
layout_key_dict = import_rsa_public_keys_from_files_as_dict([self.alice_path])
with self.assertRaises(in_toto.exceptions.LinkNotFoundError):
in_toto_verify(layout, layout_key_dict)
os.rename("package.link.bak", "package.c1ae1e51.link")
os.rename("package.link.bak", "package.2f89b927.link")

def test_verify_failing_inspection_exits_non_zero(self):
"""Test fail verification with inspection returning non-zero. """
Expand Down Expand Up @@ -1107,8 +1107,8 @@ def setUpClass(self):
shutil.copy(os.path.join(demo_files, file), self.test_dir)

self.demo_layout = Metablock.load("demo.layout.template")
self.code_link = Metablock.load("package.c1ae1e51.link")
self.package_link = Metablock.load("write-code.0c6c50a1.link")
self.code_link = Metablock.load("package.2f89b927.link")
self.package_link = Metablock.load("write-code.776a00e2.link")
self.demo_links = {
"write-code": self.code_link,
"package": self.package_link
Expand Down

0 comments on commit c3e9687

Please sign in to comment.