mirror of
https://github.com/aziascreations/BakaShrot.git
synced 2026-11-23 20:58:46 +01:00
Merged bakashrot-cert into bakashrot as bakashrot cert, Made the programs smaller, Added a -HybridCrt switch
- `bakashrot cert ca|issue|revoke|show` (same options) replaces bakashrot-cert: aws-lc, the C runtime and clap once, 2.53 MB instead of 2.85 + 1.73 MB on Windows; guides, docs, release.py, Docker updated - The tool built with its own profile, release-tools (panic = "abort", about 15% smaller); the DLL and the server keep unwind - clap without colours and suggestions (40 KB, 9 crates fewer) - SQLite without FTS3/FTS5, R-Tree, dbstat, STAT4, soundex(), extension loading and column metadata (LIBSQLITE3_FLAGS): the server 4.68 to 4.37 MB; a storage test checks they're out - build.ps1 / release.ps1 -HybridCrt (.cargo/hybrid-crt.toml): the UCRT from Windows, about 180 KB less per program, still nothing to install; static stays the default, README.txt says which - revamp.md: what was weighed and left (UPX, fully dynamic CRT, nightly options, OMIT_* flags), aws-lc kept over Graviola (490 KB bigger) and ring (no ML-KEM) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+8
-28
@@ -1,27 +1,16 @@
|
||||
//! `bakashrot-cert`: makes a CA, issues certificates, revokes them, shows
|
||||
//! them. Every file is PEM; keys are written once, never over an existing
|
||||
//! file. See `docs/certificates.md`.
|
||||
//! `bakashrot cert`: makes a CA, issues certificates, revokes them, shows
|
||||
//! them, with no server. Every file is PEM; keys are written once, never
|
||||
//! over an existing file. See `docs/certificates.md`.
|
||||
|
||||
use bakashrot_pki::{CA_DAYS, CERTIFICATE_DAYS, Ca, Identity, Revocations, Usage, summarize};
|
||||
use clap::{Parser, Subcommand};
|
||||
use clap::Subcommand;
|
||||
use std::fs;
|
||||
use std::io::Write;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::ExitCode;
|
||||
|
||||
#[derive(Parser)]
|
||||
#[command(
|
||||
name = "bakashrot-cert",
|
||||
version,
|
||||
about = "Issues and revokes BakaShrot's certificates"
|
||||
)]
|
||||
struct Cli {
|
||||
#[command(subcommand)]
|
||||
command: Command,
|
||||
}
|
||||
|
||||
// `bakashrot cert`'s commands (its help is `Command::Cert`'s, in main.rs).
|
||||
#[derive(Subcommand)]
|
||||
enum Command {
|
||||
pub enum Command {
|
||||
/// Makes a new CA: ca.crt and ca.key in --out. Keep ca.key off the
|
||||
/// servers: whoever has it can make any identity.
|
||||
Ca {
|
||||
@@ -85,17 +74,8 @@ enum Command {
|
||||
},
|
||||
}
|
||||
|
||||
fn main() -> ExitCode {
|
||||
match run(Cli::parse().command) {
|
||||
Ok(()) => ExitCode::SUCCESS,
|
||||
Err(error) => {
|
||||
eprintln!("bakashrot-cert: {error}");
|
||||
ExitCode::FAILURE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn run(command: Command) -> Result<(), String> {
|
||||
/// Runs one of `bakashrot cert`'s commands.
|
||||
pub fn run(command: Command) -> Result<(), String> {
|
||||
match command {
|
||||
Command::Ca { name, days, out } => {
|
||||
let ca = Ca::create(&name, days).map_err(|e| e.to_string())?;
|
||||
@@ -1,6 +1,9 @@
|
||||
//! `bakashrot`: pushes messages, reads them and their attachments, runs
|
||||
//! queries and lists names from the command line, connecting with a
|
||||
//! `client.toml`; see `docs/client.md`, "The tools".
|
||||
//! `client.toml`; see `docs/client.md`, "The tool". `bakashrot cert`
|
||||
//! issues the certificates (`cert.rs`, `docs/certificates.md`).
|
||||
|
||||
mod cert;
|
||||
|
||||
use bakashrot_client::{Client, Error, Settings};
|
||||
use bakashrot_proto::error::{code_name, is_refusal_code};
|
||||
@@ -18,12 +21,12 @@ use std::time::Duration;
|
||||
#[command(
|
||||
name = "bakashrot",
|
||||
version,
|
||||
about = "Pushes and reads BakaShrot's messages",
|
||||
about = "Pushes and reads BakaShrot's messages, issues its certificates",
|
||||
after_help = "Exits with 0 on success, 1 on a failure, 2 on bad arguments."
|
||||
)]
|
||||
struct Cli {
|
||||
/// The client's settings: the server, the CA's certificate, this
|
||||
/// client's certificate and key, the CRL.
|
||||
/// client's certificate and key, the CRL (cert doesn't use them).
|
||||
#[arg(short, long, global = true, default_value = "client.toml")]
|
||||
config: PathBuf,
|
||||
#[command(subcommand)]
|
||||
@@ -110,6 +113,12 @@ enum Command {
|
||||
#[arg(long)]
|
||||
json: bool,
|
||||
},
|
||||
/// Makes a CA, issues certificates, revokes them, shows them; no
|
||||
/// server needed (run it where the CA's key is).
|
||||
Cert {
|
||||
#[command(subcommand)]
|
||||
command: cert::Command,
|
||||
},
|
||||
}
|
||||
|
||||
/// Where `messages` starts.
|
||||
@@ -159,6 +168,7 @@ fn main() -> ExitCode {
|
||||
|
||||
fn run(config: &Path, command: Command) -> Result<(), String> {
|
||||
match command {
|
||||
Command::Cert { command } => cert::run(command)?,
|
||||
Command::Push {
|
||||
topic,
|
||||
message,
|
||||
Reference in New Issue
Block a user