Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --verification-keys (subjectPublicKeyInfo) arg to in-toto-verify #652

Merged

Conversation

lukpueh
Copy link
Member

@lukpueh lukpueh commented Nov 23, 2023

EDIT 2023/12/05: rename --subjectPublicKeyInfo to --verification-keys, and test also test with dsse demo files


This is meant as replacement for --layout-keys, supporting a
consistent standard key file format (subjectPublicKeyInfo/pem).

It is part of a series of patches to prepare for deprecation of legacy
securesystemslib interfaces and key file formats.

Change details

Adds helper to load public key file as SSlibKey and convert it to its
dictionary representation with the keyid included, to make it compatible
with verifylib.in_toto_verify.

in-toto-verify uses this for keys passed with --verification-keys.

In the future we might want to support Key (SSlibKey's base class)
natively in in_toto_verify.

This PR also adds a deprecation warning for --layout-keys and tests
using the demo supply chain.

Test public key files come from secure-systems-lab/securesystemslib#604.

@lukpueh lukpueh force-pushed the in-toto-verify-add-subjectPublicKeyInfo branch 3 times, most recently from 1e087f8 to 219ad27 Compare November 24, 2023 12:51
lukpueh added a commit to lukpueh/in-toto that referenced this pull request Nov 24, 2023
blocks on in-toto#652

----

Changes `in-toto-sign` to expect pem/pkcs8 signing keys and
pem/subjectPublicKeyInfo verification keys passed with the `--key`
argument. `--key-type` is now obsolete and removed.

Otherwise the behavior of in-toto-sign remains the same.

This is part of a series of patches to prepare for removal of legacy
securesystemslib interfaces and key file formats.

**Change details**

Unlike, in-toto-verify (in-toto#652) and in-toto-run/record (in-toto#651, in-toto#649), where
new arguments were introduced for the new formats, and deprecation
warnings were added to the old arguments, in-toto-sign is changed
directly.

This is because, the main use cases for in-toto-sign have been:
- in-toto maintainers re-signing test/demo metadata
- layout-web-tool users signing online-generated layouts

Given that the layout-web-tool is currently offline for revision
(in-toto/layout-web-tool#70) and in-toto
maintainers should be easily able to adapt, a direct change is not
expected to disrupt anyone's operations.

IMO this can even be released as part of a minor version bump.

**Test change details**

- use new pre-generated key files instead of demo key files (but keep
  using demo metadata)
- update expected keyid link file name where necessary
- remove `--key-type` in cli invocations
- remove `--key-type` -specific tests
- remove obsolete test case, which uses 4 keys

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
lukpueh added a commit to lukpueh/in-toto that referenced this pull request Nov 27, 2023
As we are switching to a standard key file format (see in-toto#649, in-toto#651
and in-toto#652), we no longer need to maintain a custom command line tool,
to generate key files in a proprietary in-toto/securesystemslib format.

Docs on how to migrate existing key or generate new key files with
standard tooling (`pyca/cryptography` or `openssl` cli) are available
in:
https://github.com/secure-systems-lab/securesystemslib#legacy-key-migration

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
@lukpueh lukpueh mentioned this pull request Nov 27, 2023
lukpueh added a commit to lukpueh/in-toto that referenced this pull request Nov 28, 2023
blocks on in-toto#652

Refactor `Layout.add_functionary_key_from_path()` to use new public key
loading infrastructure, in preparation for the removal of legacy
securesystemslib modules and key (file) formats.

Coincidentally, this method used to only support rsa public keys, and
the legacy key loader already supported PEM/subjectPublicKeyInfo format
for rsa, which is now supported for all key types.

This means, the patch is backwards compatibility for rsa keys and adds
support for ed25519 and ecdsa keys.

The patch also changes tests to use new test key files and try all 3
supported formats.

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
@lukpueh lukpueh force-pushed the in-toto-verify-add-subjectPublicKeyInfo branch from 219ad27 to 9de11d5 Compare December 4, 2023 14:12
lukpueh added a commit to lukpueh/in-toto that referenced this pull request Dec 4, 2023
blocks on in-toto#652

----

Changes `in-toto-sign` to expect pem/pkcs8 signing keys and
pem/subjectPublicKeyInfo verification keys passed with the `--key`
argument. `--key-type` is now obsolete and removed.

Otherwise the behavior of in-toto-sign remains the same.

This is part of a series of patches to prepare for removal of legacy
securesystemslib interfaces and key file formats.

**Change details**

Unlike, in-toto-verify (in-toto#652) and in-toto-run/record (in-toto#651, in-toto#649), where
new arguments were introduced for the new formats, and deprecation
warnings were added to the old arguments, in-toto-sign is changed
directly.

This is because, the main use cases for in-toto-sign have been:
- in-toto maintainers re-signing test/demo metadata
- layout-web-tool users signing online-generated layouts

Given that the layout-web-tool is currently offline for revision
(in-toto/layout-web-tool#70) and in-toto
maintainers should be easily able to adapt, a direct change is not
expected to disrupt anyone's operations.

IMO this can even be released as part of a minor version bump.

**Test change details**

- use new pre-generated key files instead of demo key files (but keep
  using demo metadata)
- update expected keyid link file name where necessary
- remove `--key-type` in cli invocations
- remove `--key-type` -specific tests
- remove obsolete test case, which uses 4 keys

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
lukpueh added a commit to lukpueh/in-toto that referenced this pull request Dec 4, 2023
blocks on in-toto#652

Refactor `Layout.add_functionary_key_from_path()` to use new public key
loading infrastructure, in preparation for the removal of legacy
securesystemslib modules and key (file) formats.

Coincidentally, this method used to only support rsa public keys, and
the legacy key loader already supported PEM/subjectPublicKeyInfo format
for rsa, which is now supported for all key types.

This means, the patch is backwards compatibility for rsa keys and adds
support for ed25519 and ecdsa keys.

The patch also changes tests to use new test key files and try all 3
supported formats.

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
blocks on:
- in-toto#649

---

This is meant as replacement for `--layout-keys`, supporting a
consistent standard key file format (subjectPublicKeyInfo/pem).

It is part of a series of patches to prepare for deprecation of legacy
securesystemslib interfaces and key file formats.

**Change details**

Adds helper to load public key file as SSlibKey and convert it to its
dictionary representation with the keyid included, to make it compatible
with verifylib.in_toto_verify.

in-toto-verify uses this for keys passed with --subjectPublicKeyInfo.

NOTE: requires unreleased securesystemslib API, which **blocks** this PR.

In the future we might want to support Key (SSlibKey's base class)
natively in in_toto_verify.

This PR also adds a deprecation warning for --layout-keys and tests
using the demo supply chain.

Test public key files come from secure-systems-lab/securesystemslib#604.

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
This aligns with the rename of the corresponding private key
argument to a less technical name. (--pkcs -> --signing_key)

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
Copy TestInTotoVerifySubjectPublicKeyInfoKeys to
TestInTotoVerifySubjectPublicKeyInfoKeysAndUseDSSE, using
dsse demo files.

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
@lukpueh lukpueh force-pushed the in-toto-verify-add-subjectPublicKeyInfo branch from 9de11d5 to 4c8f124 Compare December 5, 2023 10:16
@lukpueh lukpueh marked this pull request as ready for review December 5, 2023 10:18
@lukpueh lukpueh changed the title Add --subjectPublicKeyInfo arg to in-toto-verify Add --verification-key (subjectPublicKeyInfo) arg to in-toto-verify Dec 5, 2023
@lukpueh lukpueh changed the title Add --verification-key (subjectPublicKeyInfo) arg to in-toto-verify Add --verification-keys (subjectPublicKeyInfo) arg to in-toto-verify Dec 5, 2023
@lukpueh lukpueh merged commit a971d40 into in-toto:develop Dec 6, 2023
16 checks passed
lukpueh added a commit to lukpueh/in-toto that referenced this pull request Dec 6, 2023
Changes `in-toto-sign` to expect pem/pkcs8 signing keys and
pem/subjectPublicKeyInfo verification keys passed with the `--key`
argument. `--key-type` is now obsolete and removed.

Otherwise the behavior of in-toto-sign remains the same.

This is part of a series of patches to prepare for removal of legacy
securesystemslib interfaces and key file formats.

**Change details**

Unlike, in-toto-verify (in-toto#652) and in-toto-run/record (in-toto#651, in-toto#649), where
new arguments were introduced for the new formats, and deprecation
warnings were added to the old arguments, in-toto-sign is changed
directly.

This is because, the main use cases for in-toto-sign have been:
- in-toto maintainers re-signing test/demo metadata
- layout-web-tool users signing online-generated layouts

Given that the layout-web-tool is currently offline for revision
(in-toto/layout-web-tool#70) and in-toto
maintainers should be easily able to adapt, a direct change is not
expected to disrupt anyone's operations.

IMO this can even be released as part of a minor version bump.

**Test change details**

- use new pre-generated key files instead of demo key files (but keep
  using demo metadata)
- update expected keyid link file name where necessary
- remove `--key-type` in cli invocations
- remove `--key-type` -specific tests
- remove obsolete test case, which uses 4 keys

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
lukpueh added a commit to lukpueh/in-toto that referenced this pull request Dec 6, 2023
Changes `in-toto-sign` to expect pem/pkcs8 signing keys and
pem/subjectPublicKeyInfo verification keys passed with the `--key`
argument. `--key-type` is now obsolete and removed.

Otherwise the behavior of in-toto-sign remains the same.

This is part of a series of patches to prepare for removal of legacy
securesystemslib interfaces and key file formats.

**Change details**

Unlike, in-toto-verify (in-toto#652) and in-toto-run/record (in-toto#651, in-toto#649), where
new arguments were introduced for the new formats, and deprecation
warnings were added to the old arguments, in-toto-sign is changed
directly.

This is because, the main use cases for in-toto-sign have been:
- in-toto maintainers re-signing test/demo metadata
- layout-web-tool users signing online-generated layouts

Given that the layout-web-tool is currently offline for revision
(in-toto/layout-web-tool#70) and in-toto
maintainers should be easily able to adapt, a direct change is not
expected to disrupt anyone's operations.

IMO this can even be released as part of a minor version bump.

**Test change details**

- use new pre-generated key files instead of demo key files (but keep
  using demo metadata)
- update expected keyid link file name where necessary
- remove `--key-type` in cli invocations
- remove `--key-type` -specific tests
- remove obsolete test case, which uses 4 keys

Signed-off-by: Lukas Puehringer <lukas.puehringer@nyu.edu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants