-
Notifications
You must be signed in to change notification settings - Fork 64
Description
Description
The current sign and verify APIs take as input an io[bytes]:
- signing: https://github.com/sigstore/sigstore-python/blob/main/sigstore/sign.py#L119
- verifying: https://github.com/sigstore/sigstore-python/blob/main/sigstore/verify/models.py#L238
There are limitations to expecting an input buffer:
For signing, we may want to sign something like a tree structure, a folder, or something that does not have an obvious array representation and is application specific. In this case it would be useful to let the caller hash the content and pass it to the sign function. This would not work for edDSA signature - because they need the raw text message - but works for ECDSA.
For verification, same limitation. In addition, imagine you want to create a remote service (REST API) that verifies attestations / signatures. The signed message you may be too large to be sent over the network (e.g., a large SBOM), so you may want to let the caller hash the document and send over only the attestation and the hash of the message. There is one limitation to allowing this: it's is more prone to mistakes. There have been cases where a verifier would mistakenly take in the hash provided by an attacker instead of the message they intended to verify. So maybe we could dangerous APIs under a "danger" folder. FWIW, the Tink crypto library puts dangerous functions under a subtle folder.