Dilithium CodeSign CLI v1
Dilithium CodeSign CLI v1
```toml
[package]
name = "final_cli_v1.0_std"
version = "1.0.0"
edition = "2021"
[dependencies]
post_quantum_crypto = { path = "../post_quantum_crypto" }
sha3 = "0.10"
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
git2 = "0.18"
clap = { version = "4.0", features = ["derive"] }
chrono = "0.4"
rpassword = "7.0"
```
```rust
use post_quantum_crypto::apps::codesign::DilithiumCodeSign;
use sha3::{Sha3_256, Digest};
use serde::{Serialize, Deserialize};
use git2::{Repository, Commit};
use clap::{Parser, Subcommand};
use std::fs;
use std::path::Path;
const SIG_DIR = ".git/dilithium-sigs";
#[derive(Serialize, Deserialize)]
struct CommitSig {
commit_id: String,
signature: String,
public_key: String,
timestamp: String,
}
#[derive(Parser)]
struct Cli {
#[command(subcommand)]
command: Command,
}
#[derive(Subcommand)]
enum Command {
Init,
Sign,
Verify { commit: String },
VerifyChain,
}
fn main() {
let cli = Cli::parse();
let signer = DilithiumCodeSign::new();
match cli.command {
Command::Init => signer.init_repo(),
Command::Sign => signer.sign_current_commit(),
Command::Verify { commit } => {
if signer.verify_commit(&commit) {
println!("Verified");
} else {
println!("Failed");
}
}
Command::VerifyChain => {
if signer.verify_chain() {
println!("Chain Verified");
} else {
println!("Chain Failed");
}
}
}
}
```
---
**FINAL_Cli_v1.0_std**
- `./final_cli_v1.0_std init` → setup repo + keys
- `./final_cli_v1.0_std sign` → sign HEAD
- `./final_cli_v1.0_std verify <sha>` → check commit
- `./final_cli_v1.0_std verify-chain` → check all
---
**Build & Run:**
```bash
cargo build --release
./target/release/final_cli_v1.0_std init
```
---
**Next?**
Say: **Make GUI**
→ I’ll give you **FINAL_Gui_v1.0_core**
**Go.**