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

move utility key handling functions in pkg/cosign to an internal package #3779

Open
dmitris opened this issue Jul 11, 2024 · 1 comment
Open
Labels
enhancement New feature or request

Comments

@dmitris
Copy link
Contributor

dmitris commented Jul 11, 2024

Description
Follow-up on the discussions in #3776 - we need to review the functions in https://github.com/sigstore/cosign/blob/main/pkg/cosign/keys.go and move some of them to an internal package (possibly on a major version update for the API backward compatibility; can mark functions as Deprecated until then).

As for the TODOs, I agree this should be in an internal package, this isn't meant to be general purpose.
- @haydentherapper

It may be helpful to view the old TODO(jason) comments in pkg/cosign/keys.go@bdcbf44ee9.

@dmitris
Copy link
Contributor Author

dmitris commented Jul 11, 2024

files that use some of the types and functions in pkg/cosign/keys.go marked with TODO - move to internal, to help
evaluating the impact of the possible changes:

$ rg -l 'cosign\.KeysBytes'
test/helpers.go
pkg/cosign/kubernetes/secret_test.go
pkg/cosign/kubernetes/secret.go
cmd/cosign/cli/generate/generate_key_pair.go

$ rg -l 'cosign\.GeneratePrivateKey'
internal/pkg/cosign/ephemeral/signer.go
internal/pkg/cosign/payload/signer_test.go
internal/pkg/cosign/tsa/signer_test.go
internal/pkg/cosign/fulcio/signer_test.go
internal/pkg/cosign/rekor/signer_test.go
cmd/cosign/cli/sign/sign.go
cmd/cosign/cli/fulcio/fulcio_test.go

$ rg -l 'cosign\.ImportKeyPair'
test/helpers.go
cmd/cosign/cli/importkeypair/import_key_pair.go

$ rg -l 'cosign\.GenerateKeyPair'
test/helpers.go
cmd/cosign/cli/attest/attest_blob_test.go
cmd/cosign/cli/publickey/public_key_test.go
pkg/cosign/git/github/github.go
pkg/cosign/git/gitlab/gitlab.go
pkg/cosign/kubernetes/secret.go
test/e2e_test.go
cmd/cosign/cli/generate/generate_key_pair.go

# NB PemToECDSAKey is used only in the pkg/cosign package, pkg/cosign/keys.go file (no cosign.PemToECDSAKey references):
$ rg PemToECDSAKey
pkg/cosign/keys.go
197:// PemToECDSAKey marshals and returns the PEM-encoded ECDSA public key.
198:func PemToECDSAKey(pemBytes []byte) (*ecdsa.PublicKey, error) {

$ rg -l 'cosign\.LoadPrivateKey'
test/e2e_test.go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant