A Rust implementation of the Security Protocol and Data Model (SPDM) specification with static X.509 certificates.
This library provides a complete SPDM responder implementation with:
- Real SPDM protocol processing using the integrated SPDM library
- Static X.509 certificates (no dynamic generation complexity)
- DMTF SPDM device validator compatibility
- P-384 ECDSA cryptography with SHA-384 hashing
- TCP socket transport for testing and validation
- SPDM versions 1.1 and 1.2 support
- Certificate-based authentication
- Challenge-response authentication
- Signed measurements with attestation
- Chunked message support for large transfers
- Static certificate chain (419 + 453 = 872 bytes total)
- Rust (1.70 or later)
- Cargo (comes with Rust)
- OpenSSL (for certificate verification tests, optional)
spdm-lib/
├── src/
│ ├── lib.rs # Main library
│ └── ... # SPDM protocol implementation
├── examples/
│ ├── platform/ # Reference platform implementations
│ │ ├── certs.rs # Static X.509 certificates (OpenSSL generated)
│ │ ├── cert_store.rs # Certificate store with ECDSA signing
│ │ ├── crypto.rs # SHA-384 hash and system RNG
│ │ ├── socket_transport.rs # TCP transport with DMTF protocol
│ │ ├── evidence.rs # Demo device evidence
│ │ └── mod.rs # Platform module exports
│ ├── spdm_responder.rs # Clean SPDM responder using platform implementations
│ └── test_static_certs.rs # Certificate verification test
└── tests/ # Integration tests
cargo buildBuild the main SPDM responder:
cargo build --example spdm_responderBuild all examples:
cargo build --examplescargo build --release --example spdm_responderRun all library unit tests:
cargo testStart the SPDM responder on default port 2323:
cargo run --example spdm_respondercargo run --example spdm_responder -- --port 8080cargo run --example spdm_responder -- --verbosecargo run --example spdm_responder -- \
--port 2323 \
--cert device_cert.pem \
--key device_key.pem \
--measurements measurements.json \
--verboseThe SPDM responder supports the following command line arguments:
-p, --port <PORT>- TCP port to listen on (default: 2323)-c, --cert <CERT_FILE>- Path to certificate file (default: device_cert.pem)-k, --key <KEY_FILE>- Path to private key file (default: device_key.pem)-m, --measurements <FILE>- Path to measurements file (default: measurements.json)-v, --verbose- Enable verbose logging-h, --help- Print help message
The responder is compatible with the DMTF SPDM device validator:
-
Start the responder:
cargo run --example spdm_responder -- --verbose
-
In another terminal, test with nc (netcat):
echo -ne '\x00\x00\xFF\xFE\x00\x00\x00\x03\x00\x00\x00\x00' | nc localhost 2323
-
Or use the DMTF SPDM device validator (if available):
spdm-device-validator --host localhost --port 2323
The responder uses static X.509 certificates generated by OpenSSL:
- Root CA Certificate: 419 bytes (self-signed, CA:TRUE)
- Attestation Certificate: 453 bytes (signed by root CA, CA:FALSE)
- Combined Chain: 872 bytes (root CA + attestation certificate)
- Cryptography: P-384 ECDSA with SHA-384
- Validity: September 2025 - September 2026
These certificates pass OpenSSL verification:
openssl verify -CAfile root_ca.pem attestation.pem
# Output: attestation.pem: OK- Create a new file in
examples/ - Add necessary dependencies to
Cargo.tomlif needed - Build with:
cargo build --example your_example
The static certificates are in examples/platform/certs.rs. They were generated from working OpenSSL certificates and should not be modified unless you have replacement certificates that pass verification.
Enable verbose logging to see detailed SPDM message processing:
RUST_LOG=debug cargo run --example spdm_responder -- --verboseIf you encounter build errors:
- Update Rust:
rustup update - Clean build:
cargo clean && cargo build
If the responder doesn't accept connections:
- Check port availability:
netstat -ln | grep :2323 - Firewall settings: Ensure port 2323 is open
- Bind address: The responder binds to
0.0.0.0:2323(all interfaces)
If certificate-related errors occur:
- Run certificate test:
cargo run --example test_static_certs - Check certificate format: Certificates are in DER format, not PEM
- Static certificates: The responder uses hardcoded certificates, not files
Licensed under the Apache-2.0 license. See LICENSE file for details.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Run
cargo test - Submit a pull request
For issues and questions:
- Check the troubleshooting section above
- Run tests to verify your setup
- Enable verbose logging for debugging
- Check that certificates pass verification tests