support RSA, ECDSA and EDDSA public key verification
@@ -29,6 +29,7 @@ import (
"github.com/sigstore/cosign/pkg/cosign/attestation"
"github.com/sigstore/cosign/pkg/oci"
sigs "github.com/sigstore/cosign/pkg/signature"
+ "github.com/sigstore/sigstore/pkg/cryptoutils"
"github.com/sigstore/sigstore/pkg/signature"
"github.com/sigstore/sigstore/pkg/signature/payload"
)
@@ -310,12 +311,12 @@ func stringToJSONMap(i interface{}) (map[string]interface{}, error) {
func decodePEM(raw []byte) (signature.Verifier, error) {
// PEM encoded file.
- ed, err := cosign.PemToECDSAKey(raw)
+ pubKey, err := cryptoutils.UnmarshalPEMToPublicKey(raw)
if err != nil {
- return nil, errors.Wrap(err, "pem to ecdsa")
+ return nil, errors.Wrap(err, "pem to public key")
}
- return signature.LoadECDSAVerifier(ed, crypto.SHA256)
+ return signature.LoadVerifier(pubKey, crypto.SHA256)
}
func extractPayload(verified []oci.Signature) ([]payload.SimpleContainerImage, error) {
