JMIX-RS
A Rust library for creating, validating, and working with JMIX (JSON Medical Interchange) packages. JMIX enables secure exchange of medical imaging data and metadata with built-in encryption, digital signatures, and integrity verification.
Features
- ๐๏ธ High-level builder API for creating JMIX envelopes
- ๐ฅ DICOM file processing and metadata extraction
- ๐ End-to-end encryption using AES-256-GCM with Curve25519 ECDH
- โ๏ธ Digital signatures with Ed25519 (JWS standard)
- ๐ JSON Schema validation with configurable schema directory
- โ Integrity verification using deterministic SHA-256 payload hashing
- ๐ก๏ธ Cryptographic assertions for sender/receiver identity verification
- ๐ฆ Package validation API with comprehensive error reporting
Installation
Add to your Cargo.toml:
[]
= "0.3.2"
Quick Start
Basic JMIX Envelope
Create a simple JMIX envelope from DICOM files:
use ;
let builder = new;
let config = from_file?;
let = builder.build_from_dicom?;
With Security Features
Create an envelope with encryption and digital signatures:
use JmixBuilder;
// Builder with complete security features
let builder = with_complete_security?;
let = builder.build_from_dicom?;
// Save to files
let saved_files = builder.save_to_files?;
DICOM Processing
Extract metadata from DICOM files:
use DicomProcessor;
let processor = new;
let metadata = processor.process_dicom_folder?;
println!;
Configuration
Create a configuration file for your JMIX envelope:
API Overview
Core Types
use ;
Builder API
The JmixBuilder provides a high-level API for creating JMIX envelopes:
// Basic builder
let builder = new;
// With encryption only
let builder = with_encryption?;
// With signatures only
let builder = with_jws_signing?;
// With complete security (encryption + signatures + assertions)
let builder = with_complete_security?;
Validation API
Validate existing JMIX packages:
use ;
let options = ValidationOptions ;
let report = validate_package?;
println!;
Error Handling
use JmixError;
match result
Performance Optimization
For large DICOM datasets, you can use performance flags to optimize processing:
// Skip SHA-256 hashing for faster processing
let = builder.build_from_dicom_with_options?;
// Skip both hashing and file listing for maximum speed
let = builder.build_from_dicom_with_options?;
// Save with same performance flags
builder.save_to_files_with_options?;
See Performance Optimization Guide for detailed information.
Schema Validation
Configure JSON Schema validation for JMIX packages:
use ValidationConfig;
// Configure schema directory
let validation_config = new?;
// Validate envelope components
validation_config.validate_manifest?;
validation_config.validate_metadata?;
validation_config.validate_audit?;
Schema resolution order:
ValidationConfig::new(Some(path))- Explicit pathJMIX_SCHEMA_DIRenvironment variable../jmix/schemas(default)
Technical Details
Cryptographic Features
- AES-256-GCM: Authenticated encryption with 256-bit keys
- Curve25519: Elliptic curve Diffie-Hellman key exchange
- Ed25519: Elliptic curve digital signatures (JWS standard)
- SHA-256: Deterministic payload hashing for integrity verification
- Ephemeral keys: Base64-encoded ephemeral public key, IV, and auth tag
Payload Hashing
JMIX-RS uses deterministic SHA-256 payload hashing:
- Unencrypted: Hash computed over
payload/directory contents - Encrypted: Hash computed over plaintext TAR before encryption
- Format:
sha256:<hex>stored inmanifest.security.payload_hash
CLI Tool
The library includes a command-line tool for validating and working with JMIX packages:
Installation
# Install from crates.io
# Or build from source
# Binary at: target/release/jmix
Usage
# Validate a JMIX package
# Validate with schema checking
# Decrypt an encrypted package
# JSON output for automation
For detailed CLI documentation, run jmix --help.
Learn More
- ๐ Developer Guide - Contributing and development setup
- โก Performance Optimization - Large dataset handling
- ๐งช Testing Guide - Test suite documentation
- ๐ Changelog - Release history and changes
- ๐ API Documentation - Rust library docs
License
This project is licensed under the Apache 2.0 License.