Simplify and rename hash functions

This commit is contained in:
Jonny Stoten
2024-05-08 10:28:01 +01:00
parent d5b059043f
commit e3d02ab2e1
9 changed files with 11 additions and 15 deletions

View File

@@ -19,7 +19,7 @@ func SignDSSE(ctx context.Context, payload []byte, payloadType string, signer ds
encPayload := dsse.PAE(payloadType, payload)
// statement message digest
hash := util.S256(encPayload)
hash := util.SHA256(encPayload)
// sign message digest
sig, err := signer.Sign(ctx, hash)

View File

@@ -121,7 +121,7 @@ func verifySignature(ctx context.Context, sig Signature, payload []byte, keys Ke
return fmt.Errorf("error failed to decode signature: %w", err)
}
// verify payload ecdsa signature
ok = ecdsa.VerifyASN1(publicKey, util.S256(payload), signature)
ok = ecdsa.VerifyASN1(publicKey, util.SHA256(payload), signature)
if !ok {
return fmt.Errorf("payload signature is not valid")
}