Skip to content

Provide API that take in a hash instead of io bytes #666

@laurentsimon

Description

@laurentsimon

Description

The current sign and verify APIs take as input an io[bytes]:

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions