Skip to content

Commit

Permalink
fix: quick fix to use correct sign/verify plugin (#338)
Browse files Browse the repository at this point in the history
Changes in this PR:
1. `signer.NewFromPlugin(plugin plugin.SignPlugin, ...)`
2. `verifer.executePlugin(ctx context.Context, installedPlugin
plugin.VerifyPlugin, ...)`

---------

Signed-off-by: Patrick Zheng <[email protected]>
  • Loading branch information
Two-Hearts authored Jul 19, 2023
1 parent 3981f69 commit 99bc2bc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion signer/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type pluginSigner struct {
// NewFromPlugin creates a notation.Signer that signs artifacts and generates
// signatures by delegating the one or more operations to the named plugin,
// as defined in https://github.com/notaryproject/notaryproject/blob/main/specs/plugin-extensibility.md#signing-interfaces.
func NewFromPlugin(plugin plugin.Plugin, keyID string, pluginConfig map[string]string) (notation.Signer, error) {
func NewFromPlugin(plugin plugin.SignPlugin, keyID string, pluginConfig map[string]string) (notation.Signer, error) {
if plugin == nil {
return nil, errors.New("nil plugin")
}
Expand Down
4 changes: 2 additions & 2 deletions verifier/verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ func (v *verifier) processSignature(ctx context.Context, sigBlob []byte, envelop
return err
}

var installedPlugin plugin.Plugin
var installedPlugin plugin.VerifyPlugin
if verificationPluginName != "" {
logger.Debugf("Finding verification plugin %s", verificationPluginName)
verificationPluginMinVersion, err := getVerificationPluginMinVersion(&outcome.EnvelopeContent.SignerInfo)
Expand Down Expand Up @@ -633,7 +633,7 @@ func verifyRevocation(outcome *notation.VerificationOutcome, r revocation.Revoca
return result
}

func executePlugin(ctx context.Context, installedPlugin plugin.Plugin, trustPolicy *trustpolicy.TrustPolicy, capabilitiesToVerify []proto.Capability, envelopeContent *signature.EnvelopeContent, pluginConfig map[string]string) (*proto.VerifySignatureResponse, error) {
func executePlugin(ctx context.Context, installedPlugin plugin.VerifyPlugin, trustPolicy *trustpolicy.TrustPolicy, capabilitiesToVerify []proto.Capability, envelopeContent *signature.EnvelopeContent, pluginConfig map[string]string) (*proto.VerifySignatureResponse, error) {
logger := log.GetLogger(ctx)
// sanity check
if installedPlugin == nil {
Expand Down

0 comments on commit 99bc2bc

Please sign in to comment.