Skip to content

Latest commit

 

History

History
102 lines (72 loc) · 2.72 KB

File metadata and controls

102 lines (72 loc) · 2.72 KB

Cosmian KMS — Build and Test Guide

Cosmian KMS is a high-performance, open-source FIPS 140-3 compliant Key Management System written in Rust.

Quick start

# Initialize git submodules (required after clone)
git submodule update --init --recursive

# Build the project (FIPS mode is default)
cargo build --release

# Run tests (FIPS mode is default)
cargo test

# For non-FIPS mode (includes additional algorithms)
cargo build --release --features non-fips
cargo test --features non-fips

Testing

# Run all tests (FIPS mode is default)
cargo test

# Run tests for a specific package
cargo test -p cosmian_kms_server
cargo test -p cosmian_kms_cli

# Run specific test suites
cargo test sqlite       # SQLite tests
cargo test postgres     # PostgreSQL tests (requires local PostgreSQL)
cargo test redis        # Redis tests

# Run tests in non-FIPS mode (includes additional algorithms)
cargo test --features non-fips
cargo test --features non-fips sqlite

Environment variables for DB tests:

  • KMS_POSTGRES_URL=postgresql://kms:kms@127.0.0.1:5432/kms
  • KMS_MYSQL_URL=mysql://kms:kms@localhost:3306/kms
  • KMS_SQLITE_PATH=data/shared

Notes:

  • MySQL tests are currently disabled in CI
  • Redis-findex tests are skipped in FIPS mode
  • FIPS mode is the default; use --features non-fips for non-approved algorithms
  • Start database backends with docker compose up -d before running DB tests

Running the server

After building, you can run the server manually:

cargo run --release --bin cosmian_kms -- --database-type sqlite --sqlite-path /tmp/kms-data

Or run the compiled binary directly:

./target/release/cosmian_kms --database-type sqlite --sqlite-path /tmp/kms-data

Basic API probe:

curl -s -X POST -H "Content-Type: application/json" -d '{}' http://localhost:9998/kmip/2_1

Expected response is a KMIP validation error, confirming the server is alive.

Repository layout (high level)

.github/                # CI workflows and scripts
crate/                  # Rust workspace crates (server, cli, crypto, …)
pkg/                    # Packaging metadata (deb/rpm service files, configs)
documentation/          # Documentation and guides
resources/              # Configuration files and resources
test_data/              # Test fixtures and data
ui/                     # Web UI source

Tips

  • Format/lints: run cargo fmt --check and cargo clippy to check code style
  • Use cargo build --release for optimized builds
  • Run cargo test frequently to ensure changes don't break functionality

Docker

docker pull ghcr.io/cosmian/kms:latest
docker run -p 9998:9998 --name kms ghcr.io/cosmian/kms:latest

Images include the UI at http://localhost:9998/ui.