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 libinbin@microsoft.com

@binbin-li binbin-li force-pushed the refactor-signature branch 2 times, most recently from c9741fb to 981a49d Compare September 9, 2022 09:30
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
Signed-off-by: Binbin Li <libinbin@microsoft.com>
Signed-off-by: Binbin Li <libinbin@microsoft.com>
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
Signed-off-by: Binbin Li <libinbin@microsoft.com>
Signed-off-by: Binbin Li <libinbin@microsoft.com>
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
Signed-off-by: Binbin Li <libinbin@microsoft.com>
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] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
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 <libinbin@microsoft.com>

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

This reverts commit cbea2cf.

Signed-off-by: Shiwei Zhang <shizh@microsoft.com>

* update to go 1.18 (#66)

Signed-off-by: Junjie Gao <junjiegao@microsoft.com>

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

Signed-off-by: Binbin Li <libinbin@microsoft.com>

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

Signed-off-by: Binbin Li <libinbin@microsoft.com>

* feat: added COSE envelope implementation

Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>

* update per code review

Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>

* update per code review

Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>

* update per code review

Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>

* resolve conflicts

Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>

* updated conformance test

Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>

* refactor: JWS for signature package (#76)

Signed-off-by: Junjie Gao <junjiegao@microsoft.com>

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

Signed-off-by: Binbin Li <libinbin@microsoft.com>

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

Signed-off-by: Binbin Li <libinbin@microsoft.com>

* refactor: JWS for signature package (#76)

Signed-off-by: Junjie Gao <junjiegao@microsoft.com>

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

Signed-off-by: Pritesh Bandi <pritesb@amazon.com>

* updated conformance_test

Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>

* refactor: refactor comments (#78)

Signed-off-by: Binbin Li <libinbin@microsoft.com>

* updated per code review

Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>

* updated per code review

Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>

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

Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>

* resolved conflicts

Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Binbin Li <libinbin@microsoft.com>
Signed-off-by: Shiwei Zhang <shizh@microsoft.com>
Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>
Signed-off-by: Pritesh Bandi <pritesb@amazon.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Binbin Li <libinbin050215@gmail.com>
Co-authored-by: Shiwei Zhang <shizh@microsoft.com>
Co-authored-by: Junjie Gao <43160897+JeyJeyGao@users.noreply.github.com>
Co-authored-by: Binbin Li <libinbin@microsoft.com>
Co-authored-by: Junjie Gao <junjiegao@microsoft.com>
Co-authored-by: Pritesh Bandi <priteshbandi@gmail.com>
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 <zaihaoyin@microsoft.com>

Signed-off-by: zaihaoyin <zaihaoyin@microsoft.com>
Co-authored-by: zaihaoyin <zaihaoyin@microsoft.com>
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