@@ -123,6 +123,13 @@ func (s *PluginSigner) SignBlob(ctx context.Context, descGenFunc notation.BlobDe
123123 if err != nil {
124124 return nil , nil , err
125125 }
126+ // only support blob signing with the signature generator capability because
127+ // the envelope generator capability is designed for OCI signing.
128+ // A new capability may be added in the future for blob signing.
129+ if ! metadata .HasCapability (plugin .CapabilitySignatureGenerator ) {
130+ return nil , nil , fmt .Errorf ("the plugin %q lacks the signature generator capability required for blob signing" , metadata .Name )
131+ }
132+
126133 logger .Debug ("Invoking plugin's describe-key command" )
127134 ks , err := s .getKeySpec (ctx , mergedConfig )
128135 if err != nil {
@@ -135,12 +142,7 @@ func (s *PluginSigner) SignBlob(ctx context.Context, descGenFunc notation.BlobDe
135142 return nil , nil , err
136143 }
137144 logger .Debugf ("Using plugin %v with capabilities %v to sign blob using descriptor %+v" , metadata .Name , metadata .Capabilities , desc )
138- if metadata .HasCapability (plugin .CapabilitySignatureGenerator ) {
139- return s .generateSignature (ctx , desc , opts , ks , metadata , mergedConfig )
140- } else if metadata .HasCapability (plugin .CapabilityEnvelopeGenerator ) {
141- return s .generateSignatureEnvelope (ctx , desc , opts )
142- }
143- return nil , nil , fmt .Errorf ("plugin does not have signing capabilities" )
145+ return s .generateSignature (ctx , desc , opts , ks , metadata , mergedConfig )
144146}
145147
146148func (s * PluginSigner ) getKeySpec (ctx context.Context , config map [string ]string ) (signature.KeySpec , error ) {
0 commit comments