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

refactor: refactor envelope and signer to support cose #73

Merged
merged 4 commits into from
Sep 14, 2022

Conversation

binbin-li
Copy link
Contributor

@binbin-li binbin-li commented Sep 9, 2022

What?

Background can be checked out in notaryproject/notation#278

  1. Created Envelope interface.
  2. Renamed the original SignatureProvider to Signer.
  3. Created LocalSigner to support native signing implementation provided by underlying crypto libraries, e.g. go-cose, go-jwt.
  4. Created internal.base.Envelope struct to replace the orginal SignatureEnvelope struct.
  5. Renamed SignerInfo to EnvelopeContent to better reflect its functionality.
  6. Other refactoring on the algorithm and keySpec definitions.

Test?

Added corresponding unit tests.

Notes

The compilation failed right now, which should be addressed in the next PR.

Signed-off-by: Binbin Li [email protected]

@binbin-li binbin-li force-pushed the refactor-signature branch 2 times, most recently from c9741fb to 981a49d Compare September 9, 2022 09:30
@gokarnm gokarnm requested a review from priteshbandi September 9, 2022 19:57
signature/types.go Show resolved Hide resolved
signature/errors.go Outdated Show resolved Hide resolved
signature/algorithm.go Show resolved Hide resolved
signature/algorithm.go Outdated Show resolved Hide resolved
signature/algorithm.go Outdated Show resolved Hide resolved
signature/algorithm.go Outdated Show resolved Hide resolved
signature/envelope.go Outdated Show resolved Hide resolved
signature/internal/base/envelope.go Outdated Show resolved Hide resolved
signature/internal/base/envelope.go Outdated Show resolved Hide resolved
signature/internal/base/envelope.go Outdated Show resolved Hide resolved
signature/internal/base/envelope.go Show resolved Hide resolved
signature/types.go Outdated Show resolved Hide resolved
signature/types.go Outdated Show resolved Hide resolved
signature/errors.go Outdated Show resolved Hide resolved
signature/errors.go Outdated Show resolved Hide resolved
signature/errors.go Outdated Show resolved Hide resolved
signature/errors.go Outdated Show resolved Hide resolved
signature/envelope.go Outdated Show resolved Hide resolved
signature/signer.go Outdated Show resolved Hide resolved
@binbin-li binbin-li force-pushed the refactor-signature branch 4 times, most recently from 84054cd to 8a7286c Compare September 13, 2022 06:31
Copy link

@gokarnm gokarnm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link

@patrickzheng200 patrickzheng200 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

signature/envelope.go Outdated Show resolved Hide resolved
signature/errors.go Outdated Show resolved Hide resolved
signature/internal/base/envelope.go Outdated Show resolved Hide resolved
signature/internal/base/envelope.go Outdated Show resolved Hide resolved
Copy link
Contributor

@shizhMSFT shizhMSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@binbin-li binbin-li merged commit 55b5b39 into notaryproject:stage/cose Sep 14, 2022
shizhMSFT pushed a commit that referenced this pull request Sep 21, 2022
patrickzheng200 pushed a commit that referenced this pull request Sep 23, 2022
* Bump github.com/golang-jwt/jwt/v4 from 4.4.1 to 4.4.2 (#14)

Bumps [github.com/golang-jwt/jwt/v4](https://github.com/golang-jwt/jwt) from 4.4.1 to 4.4.2.
- [Release notes](https://github.com/golang-jwt/jwt/releases)
- [Changelog](https://github.com/golang-jwt/jwt/blob/main/VERSION_HISTORY.md)
- [Commits](golang-jwt/jwt@v4.4.1...v4.4.2)

---
updated-dependencies:
- dependency-name: github.com/golang-jwt/jwt/v4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* refactor: refactor envelope and signer to support cose (#53)

Signed-off-by: Binbin Li <[email protected]>

* Revert "refactor: refactor envelope and signer to support cose (#53)" (#67)

This reverts commit cbea2cf.

Signed-off-by: Shiwei Zhang <[email protected]>

* update to go 1.18 (#66)

Signed-off-by: Junjie Gao <[email protected]>

* refactor: rename signer to signature submodule (#71)

Signed-off-by: Binbin Li <[email protected]>

* refactor: refactor envelope and signer to support cose (#73)

Signed-off-by: Binbin Li <[email protected]>

* feat: added COSE envelope implementation

Signed-off-by: Patrick Zheng <[email protected]>

* update per code review

Signed-off-by: Patrick Zheng <[email protected]>

* update per code review

Signed-off-by: Patrick Zheng <[email protected]>

* update per code review

Signed-off-by: Patrick Zheng <[email protected]>

* resolve conflicts

Signed-off-by: Patrick Zheng <[email protected]>

* updated conformance test

Signed-off-by: Patrick Zheng <[email protected]>

* refactor: JWS for signature package (#76)

Signed-off-by: Junjie Gao <[email protected]>

* refactor: rename signer to signature submodule (#71)

Signed-off-by: Binbin Li <[email protected]>

* refactor: refactor envelope and signer to support cose (#73)

Signed-off-by: Binbin Li <[email protected]>

* refactor: JWS for signature package (#76)

Signed-off-by: Junjie Gao <[email protected]>

* Allows signing with self-signed certificate (#77)

Signed-off-by: Pritesh Bandi <[email protected]>

* updated conformance_test

Signed-off-by: Patrick Zheng <[email protected]>

* refactor: refactor comments (#78)

Signed-off-by: Binbin Li <[email protected]>

* updated per code review

Signed-off-by: Patrick Zheng <[email protected]>

* updated per code review

Signed-off-by: Patrick Zheng <[email protected]>

* removed CLI related maps, they should be in notation CLI

Signed-off-by: Patrick Zheng <[email protected]>

* resolved conflicts

Signed-off-by: Patrick Zheng <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: Binbin Li <[email protected]>
Signed-off-by: Shiwei Zhang <[email protected]>
Signed-off-by: Junjie Gao <[email protected]>
Signed-off-by: Patrick Zheng <[email protected]>
Signed-off-by: Pritesh Bandi <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Binbin Li <[email protected]>
Co-authored-by: Shiwei Zhang <[email protected]>
Co-authored-by: Junjie Gao <[email protected]>
Co-authored-by: Binbin Li <[email protected]>
Co-authored-by: Junjie Gao <[email protected]>
Co-authored-by: Pritesh Bandi <[email protected]>
chloeyin added a commit to notaryproject/notation-go that referenced this pull request Sep 27, 2022
)

## What
Refactor `notation-go` to support multiple envelope types.
Background can be checked in
notaryproject/notation#278
I wthe whole PR into two PRs to help review, this is the first PR. More
unit test cases will be added in the next PR.
The whole picture is here
#146

## Major Changes
- Use package `github.com/notaryproject/notation-core-go/signature` to
sign and verify.
- Combine `runner` and `signer` into a `provider` for `pluginSigner` to
sign and remove the `pluginSigProvider`.
- Add `builtinProvider` to support local signing and `externalProvider`
to support signing by plugin.
- Move the payload media type and its checks to `signature` package as
mentioned in notaryproject/notation-core-go#73
- Support new
[keySpec](https://github.com/notaryproject/notaryproject/blob/main/signature-specification.md#algorithm-selection)
and plugin contract.
- Get verification plugin and version from extended attributes.
- Add `SpeculateSignatureEnvelopeFormat` to inspect signature (This
function may change later to better inspect a signature)
- Add sign/verify from file test cases.
Signed-off-by: zaihaoyin <[email protected]>

Signed-off-by: zaihaoyin <[email protected]>
Co-authored-by: zaihaoyin <[email protected]>
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.

5 participants