This project implements the DKIM (DomainKeys Identified Mail) RSA-SHA256 verification algorithm using the Cairo zkVM (Zero-Knowledge Virtual Machine). The project is designed to parse raw email data, generate a trace of Cairo CPU operations, and produce a PIE output for prover stage.
DKIM is an email authentication method designed to detect email spoofing. It allows the receiver to check that an email was indeed sent and authorized by the owner of the domain. This project focuses on the RSA-SHA256 signature verification process, which is a common method used in DKIM.
The project is implemented in Cairo, a language designed for creating provable programs, the implementation includes parsing logic for raw email data, handling of cryptographic operations, and generation of a trace that can be used for proving.
-
Clone the Repository:
https://github.com/iosis-tech/zkemail-cairo.git cd zkemail-cairo
-
Set Up Cairo0 compiler:
make
-
Run the example verifications:
cargo test -r
To run the Cairo DKIM verification process, use below command, raw_email.eml
is raw content of an email to verify
cargo run -r -- --cairo_pie_output pie.zip --secure_run true --raw_mail_file raw_email.eml --print_output
Run and prove with STWO:
run_and_prove --run_from_cairo_pie pie.zip --proof_path proof.json
This command will execute the Cairo program with the provided input, generate a Cairo PIE file.
Contributions and guidance are very welcome!