Skip to content

DKIM RSA-SHA256 Verification Algorithm in Cairo ZKVM

Notifications You must be signed in to change notification settings

iosis-tech/zkemail-cairo

Repository files navigation

DKIM RSA-SHA256 Verification Algorithm in Cairo ZKVM

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.

Overview

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.

Getting Started

Setup

  1. Clone the Repository:

    https://github.com/iosis-tech/zkemail-cairo.git
    cd zkemail-cairo
  2. Set Up Cairo0 compiler:

    make
  3. Run the example verifications:

    cargo test -r

Running the Project

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

Generating a proof with STWO

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.

Contributing

Contributions and guidance are very welcome!

About

DKIM RSA-SHA256 Verification Algorithm in Cairo ZKVM

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages