The Cosmian KMS is a high-performance, source-available FIPS 140-3 compliant server application written in Rust.
Online documentation
The Cosmian KMS presents some unique features, such as:
- large-scale encryption and decryption of data see this documentation
- the ability to confidentially run in a public cloud, or any zero-trust environment, using Cosmian VM. See our cloud-ready confidential KMS on the Azure, GCP, and AWS marketplaces our deployment guide
- support of state-of-the-art authentication mechanisms (see authentication)
- out-of-the-box support of Google Workspace Client Side Encryption (CSE)
- out-of-the-box support of Microsoft Double Key Encryption (DKE)
- support for the CardContact SmartCard, Nitrokey HSM 2, Proteccio, and Utimaco HSMs with KMS keys wrapped by the HSM
- Veracrypt and LUKS disk encryption support
- FIPS 140-3 mode gated behind the feature
fips
- a binary and JSON KMIP 1.0-1.4 and 2.0-2.1 compliant interface
- MongoDB (./documentation/docs/mongodb.md)
- Oracle DB TDE support
- Percona Postgresql DB (./documentation/docs/percona.md)
- VMWare vCenter Trust Key Provider integration
- User Defined Functions for Big Data including snowflake
- a full-featured client command line and graphical interface
- a high-availability mode with simple horizontal scaling
- a support of Python, JavaScript, Dart, Rust, C/C++, and Java clients (see the
cloudproof
libraries on Cosmian Github) - integrated with OpenTelemetry
The Cosmian KMS is both a Key Management System and a Public Key Infrastructure. As a KMS, it is designed to manage the lifecycle of keys and provide scalable cryptographic services such as on-the-fly key generation, encryption, and decryption operations.
The Cosmian KMS supports all the standard NIST cryptographic algorithms as well as advanced post-quantum cryptography algorithms such as Covercrypt. Please refer to the list of supported algorithms.
As a PKI it can manage root and intermediate certificates, sign and verify certificates, use their public keys to encrypt and decrypt data. Certificates can be exported under various formats, including PKCS#12 modern and legacy flavor, to be used in various applications, such as in S/MIME encrypted emails.
The KMS has extensive online documentation
- Cosmian KMS
- KMIP support by Cosmian KMS (v4.23 β v5.9.0)
Pre-built binaries are available for Linux, MacOS, and Windows, as well as Docker images. To run the server binary, OpenSSL must be available in your path (see "building the KMS" below for details); other binaries do not have this requirement.
Using Docker to quick-start a Cosmian KMS server on http://localhost:9998
that stores its data
inside the container, run the following command:
docker run -p 9998:9998 --name kms ghcr.io/cosmian/kms:latest
Then, use the CLI to issue commands to the KMS. The CLI, called cosmian
, can be either:
-
installed with
cargo install cosmian_cli
-
downloaded from Cosmian packages
-
built and launched from the GitHub project by running
cargo build --bin cosmian
-
Create a 256-bit symmetric key
β cosmian sym keys create --number-of-bits 256 --algorithm aes --tag my-key-file ... The symmetric key was successfully generated. Unique identifier: 87e9e2a8-4538-4701-aa8c-e3af94e44a9e Tags: - my-key-file
-
Encrypt the
image.png
file with AES GCM using the keyβ cosmian sym encrypt --tag my-key-file --output-file image.enc image.png ... The encrypted file is available at "image.enc"
-
Decrypt the
image.enc
file using the keyβ cosmian sym decrypt --tag my-key-file --output-file image2.png image.enc ... The decrypted file is available at "image2.png"
See the documentation for more.
The Cosmian KMS is written in Rust and organized as a Cargo workspace with multiple crates. The repository contains the following main components:
- KMS Server (
cosmian_kms
) - The main KMS server binary built fromcrate/server
server
- Main KMS server implementation with REST API, KMIP protocol support, and web UIserver_database
- Database abstraction layer supporting SQLite, PostgreSQL, MySQL, and Redisaccess
- Permission and access control management system
kms_client
- High-level Rust client library for KMS server communicationclient_utils
- Shared utilities for client implementationswasm
- WebAssembly bindings for browser-based clients
crypto
- Core cryptographic operations and algorithm implementationskmip
- Complete implementation of the KMIP (Key Management Interoperability Protocol) standard versions 1.0-2.1kmip-derive
- Procedural macros for KMIP protocol serialization/deserialization
hsm/base_hsm
- Base HSM abstraction layerhsm/smartcardhsm
- Nitrokey HSM 2 resp. CardContact SmartCard-HSMhsm/proteccio
- Proteccio HSM integrationhsm/softhsm2
- SoftHSM2 integration for testing and developmenthsm/utimaco
- Utimaco HSM integration
interfaces
- Database and storage backend abstractions
test_kms_server
- Library for programmatic KMS server instantiation in testscli
- Legacy CLI crate (now primarily used for testing)
documentation/
- Comprehensive project documentation built with MkDocsexamples/
- Code examples and integration samplesscripts/
- Build and deployment scriptstest_data/
- Test fixtures and sample dataui/
- Frontend web interface source codepkg/
- Packaging configurations for Debian and RPM distributions
Note: Each crate contains its own README with detailed information. Please refer to these files for specific implementation details and usage instructions.
Find the public documentation of the KMS in the documentation
directory.
The Cosmian KMS is built using the Rust programming language. A Rust toolchain is required to build the KMS.
From version 5.4.0, the KMS runs in FIPS mode by default.
The non-FIPS mode can be enabled by passing the --features non-fips
flag to cargo build
or cargo run
.
OpenSSL v3.2.0 is required to build the KMS.
Retrieve OpenSSL v3.2.0 (already built) with the following commands:
export OPENSSL_DIR=/usr/local/openssl
sudo mkdir -p ${OPENSSL_DIR}
sudo chown -R $USER ${OPENSSL_DIR}
bash .github/reusable_scripts/get_openssl_binaries.sh
-
Install Visual Studio Community with the C++ workload and clang support.
-
Install Strawberry Perl.
-
Install
vcpkg
following these instructions -
Then install OpenSSL 3.2.0:
The files vcpkg.json
and vcpkg_fips.json
are provided in the repository to install OpenSSL v3.2.0:
vcpkg install --triplet x64-windows-static # arm64-windows-static for ARM64
vcpkg integrate install
$env:OPENSSL_DIR = "$env:VCPKG_INSTALLATION_ROOT\packages\openssl_x64-windows-static" # openssl_arm64-windows-static for ARM64
For a FIPS-compliant build, use the following commands (to build fips.dll), also run:
Copy-Item -Path "vcpkg_fips.json" -Destination "vcpkg.json"
vcpkg install
vcpkg integrate install
Once OpenSSL is installed, you can build the KMS. To avoid the additive feature issues, the main artifacts - the CLI,
the KMS server and the PKCS11 provider should be directly built using cargo build --release
within their crate,
not from the project root.
Build the server:
cd crate/server
cargo build --release
You can build a Docker containing the KMS server as follows:
docker buildx build . -t kms
Or:
# Example with FIPS support
docker buildx build --build-arg FIPS="true" -t kms .
Pull the test data using:
git submodule update --init --recursive
By default, tests are run using cargo test
and an SQLCipher backend (called sqlite
).
This can be influenced by setting the KMS_TEST_DB
environment variable to
sqlite
, for plain SQLitemysql
(requires a running MySQL or MariaDB server connected using a"mysql://kms:kms@localhost:3306/kms"
URL)postgresql
(requires a running PostgreSQL server connected using a"postgresql://kms:[email protected]:5432/kms"
URL)redis-findex
(requires a running Redis server connected using a"redis://localhost:6379"
URL)
Example: testing with a plain SQLite and some logging
RUST_LOG="error,cosmian_kms_server=info,cosmian_kms_cli=info" KMS_TEST_DB=sqlite cargo test
Alternatively, when writing a test or running a test from your IDE, the following can be inserted at the top of the test:
unsafe {
set_var("RUST_LOG", "error,cosmian_kms_server=debug,cosmian_kms_cli=info");
set_var("RUST_BACKTRACE", "1");
set_var("KMS_TEST_DB", "redis-findex");
}
log_init(option_env!("RUST_LOG"));
To run the server with cargo, you need to set the RUST_LOG
environment variable to the desired
log level and select the correct backend (which defaults to sqlite
).
RUST_LOG="info,cosmian_kms_server=debug" \
cargo run --bin cosmian_kms --features non-fips -- \
--database-type redis-findex --database-url redis://localhost:6379 \
--redis-master-password secret --redis-findex-label label
If a configuration file is provided, parameters are set following this order:
- conf file (env variable
COSMIAN_KMS_CONF
set by default to/etc/cosmian/kms.toml
) - default (set on struct)
Otherwise, the parameters are set following this order:
- args in the command line
- env var
- default (set on struct)
See the Marketplace guide for more details about Cosmian VM.
All releases can be found in the public URL package.cosmian.com.
To run benchmarks, go to the crate/test_kms_server
directory and run:
cargo bench
Typical values for single-threaded HTTP KMIP 2.1 requests (zero network latency) are as follows
- RSA PKCSv1.5:
- encrypt
- 2048 bits: 128 microseconds
- 4096 bits: 175 microseconds
- decrypt
- 2048 bits: 830 microseconds
- 4096 bits: 4120 microseconds
- RSA PKCS OAEP:
- encrypt
- 2048 bits: 134 microseconds
- 4096 bits: 173 microseconds
- decrypt
- 2048 bits: 849 microseconds
- 4096 bits: 3823 microseconds
- RSA PKCS KEY WRP (AES):
- encrypt
- 2048 bits: 142 microseconds
- 4096 bits: 198 microseconds
- decrypt
- 2048 bits: 824 microseconds
- 4096 bits: 3768 microseconds
- RSA Keypair creation (saved in KMS DB)
- 2048 bits: 33 milliseconds
- 4096 bits: 322 milliseconds
This page summarizes the KMIP coverage in Cosmian KMS, using the OVHcloud guide as a layout
reference. Columns are KMS server versions grouped by identical support. Operation support is
derived from the presence of a dedicated implementation in
crate/server/src/core/operations
for each version tag.
Legend:
- β Fully supported
- β Not implemented
- π« Deprecated (not used here)
- π§ Partially supported (not used here)
- N/A Not applicable
Version columns (merged where identical):
- 4.23.0 β 4.24.0
- 5.0.0 β 5.4.1
- 5.5.0 β 5.5.1
- 5.6.0 β 5.7.1
- 5.8.0 β 5.9.0
Notes:
- The Operations table below is computed from the server source tree at each version tag.
- "Modify Attribute" in some KMIP documents corresponds to the server's "Set Attribute" operation.
- "Discover" here refers to the KMIP Discover Versions operation.
Message | 4.23β4.24 | 5.0β5.4.1 | 5.5β5.5.1 | 5.6β5.7.1 | 5.8β5.9 |
---|---|---|---|---|---|
Request Message | β | β | β | β | β |
Response Message | β | β | β | β | β |
Operation | 4.23β4.24 | 5.0β5.4.1 | 5.5β5.5.1 | 5.6β5.7.1 | 5.8β5.9 |
---|---|---|---|---|---|
Create | β | β | β | β | β |
Create Key Pair | β | β | β | β | β |
Register | β | β | β | β | β |
Re-key | β | β | β | β | β |
Re-key Key Pair | β | β | β | β | β |
DeriveKey | β | β | β | β | β |
Certify | β | β | β | β | β |
Re-certify | β | β | β | β | β |
Locate | β | β | β | β | β |
Check | β | β | β | β | β |
Get | β | β | β | β | β |
Get Attributes | β | β | β | β | β |
Get Attribute List | β | β | β | β | β |
Add Attribute | β | β | β | β | β |
Set Attribute (Modify) | β | β | β | β | β |
Delete Attribute | β | β | β | β | β |
Obtain Lease | β | β | β | β | β |
Get Usage Allocation | β | β | β | β | β |
Activate | β | β | β | β | β |
Revoke | β | β | β | β | β |
Destroy | β | β | β | β | β |
Archive | β | β | β | β | β |
Recover | β | β | β | β | β |
Validate | β | β | β | β | β |
Query | β | β | β | β | β |
Cancel | β | β | β | β | β |
Poll | β | β | β | β | β |
Notify | β | β | β | β | β |
Put | β | β | β | β | β |
Discover Versions | β | β | β | β | β |
Encrypt | β | β | β | β | β |
Decrypt | β | β | β | β | β |
Sign | β | β | β | β | β |
Signature Verify | β | β | β | β | β |
MAC | β | β | β | β | β |
MAC Verify | β | β | β | β | β |
RNG Retrieve | β | β | β | β | β |
RNG Seed | β | β | β | β | β |
Hash | β | β | β | β | β |
Create Split Key | β | β | β | β | β |
Join Split Key | β | β | β | β | β |
Export | β | β | β | β | β |
Import | β | β | β | β | β |
-
Operations shown as β are backed by a Rust implementation file under
crate/server/src/core/operations
at the corresponding version tag. -
If no implementation file exists at a tag for an operation, it is marked β for that version range.
-
Version ranges were merged when the set of supported operations did not change across the range:
- 4.23.0β4.24.0
- 5.0.0β5.4.1 (adds AddAttribute, Discover Versions, Query)
- 5.5.0β5.5.1 (adds Register)
- 5.6.0β5.7.1 (adds Activate, Digest internal support)
- 5.8.0β5.9.0 (adds Sign, Signature Verify)
If you spot a mismatch or want to extend coverage, please open an issue or PR.
Managed Object | 4.23β4.24 | 5.0β5.4.1 | 5.5β5.5.1 | 5.6β5.7.1 | 5.8β5.9 |
---|---|---|---|---|---|
Certificate | β | β | β | β | β |
Symmetric Key | β | β | β | β | β |
Public Key | β | β | β | β | β |
Private Key | β | β | β | β | β |
Split Key | β | β | β | β | β |
Template | π« | π« | π« | π« | π« |
Secret Data | β | β | β | β | β |
Opaque Object | β | β | β | β | β |
PGP Key | β | β | β | β | β |
Notes:
- Opaque Object import support is present from 5.0.0 (see
import.rs
). - PGP Key types appear in digest and attribute handling but full object import/register is not implemented, hence β.
Base Object | 4.23β4.24 | 5.0β5.4.1 | 5.5β5.5.1 | 5.6β5.7.1 | 5.8β5.9 |
---|---|---|---|---|---|
Attribute | β | β | β | β | β |
Credential | β | β | β | β | β |
Key Block | β | β | β | β | β |
Key Value | β | β | β | β | β |
Key Wrapping Data | β | β | β | β | β |
Key Wrapping Specification | β | β | β | β | β |
Transparent Key Structures | β | β | β | β | β |
Template-Attribute Structures | β | β | β | β | β |
Extension Information | β | β | β | β | β |
Data | β | β | β | β | β |
Data Length | β | β | β | β | β |
Signature Data | β | β | β | β | β |
MAC Data | β | β | β | β | β |
Nonce | β | β | β | β | β |
Correlation Value | β | β | β | β | β |
Init Indicator | β | β | β | β | β |
Final Indicator | β | β | β | β | β |
RNG Parameter | β | β | β | β | β |
Profile Information | β | β | β | β | β |
Validation Information | β | β | β | β | β |
Capability Information | β | β | β | β | β |
Authenticated Encryption Additional Data | β | β | β | β | β |
Authenticated Encryption Tag | β | β | β | β | β |
Notes:
- AEAD Additional Data and Tag are supported in encrypt/decrypt APIs.
- Nonce and RNG Parameter are used by symmetric encryption paths.
Structure | 4.23β4.24 | 5.0β5.4.1 | 5.5β5.5.1 | 5.6β5.7.1 | 5.8β5.9 |
---|---|---|---|---|---|
Symmetric Key | β | β | β | β | β |
DSA Private/Public Key | β | β | β | β | β |
RSA Private/Public Key | β | β | β | β | β |
DH Private/Public Key | β | β | β | β | β |
ECDSA Private/Public Key | β | β | β | β | β |
ECDH Private/Public Key | β | β | β | β | β |
ECMQV Private/Public | β | β | β | β | β |
EC Private/Public | β | β | β | β | β |
Note: EC/ECDSA support is present; DH/DSA/ECMQV are not implemented.
Attribute | 4.23β4.24 | 5.0β5.4.1 | 5.5β5.5.1 | 5.6β5.7.1 | 5.8β5.9 |
---|---|---|---|---|---|
Unique Identifier | β | β | β | β | β |
Name | β | β | β | β | β |
Object Type | β | β | β | β | β |
Cryptographic Algorithm | β | β | β | β | β |
Cryptographic Length | β | β | β | β | β |
Cryptographic Parameters | β | β | β | β | β |
Cryptographic Domain Parameters | β | β | β | β | β |
Certificate Type | β | β | β | β | β |
Certificate Identifier | π« | π« | π« | π« | π« |
Certificate Subject | π« | π« | π« | π« | π« |
Certificate Issuer | π« | π« | π« | π« | π« |
Digest | β | β | β | β | β |
Operation Policy Name | π« | π« | π« | π« | π« |
Cryptographic Usage Mask | β | β | β | β | β |
Lease Time | β | β | β | β | β |
Usage Limits | β | β | β | β | β |
State | β | β | β | β | β |
Initial Date | β | β | β | β | β |
Activation Date | β | β | β | β | β |
Process Start Date | β | β | β | β | β |
Protect Stop Date | β | β | β | β | β |
Deactivation Date | β | β | β | β | β |
Destroy Date | β | β | β | β | β |
Compromise Occurrence Date | β | β | β | β | β |
Compromise Date | β | β | β | β | β |
Revocation Reason | β | β | β | β | β |
Archive Date | β | β | β | β | β |
Object Group | β | β | β | β | β |
Link | β | β | β | β | β |
Application Specific Information | β | β | β | β | β |
Contact Information | β | β | β | β | β |
Last Change Date | β | β | β | β | β |
Custom Attribute (Vendor Attribute) | β | β | β | β | β |
Certificate Length | β | β | β | β | β |
X.509 Certificate Identifier | β | β | β | β | β |
X.509 Certificate Subject | β | β | β | β | β |
X.509 Certificate Issuer | β | β | β | β | β |
Digital Signature Algorithm | β | β | β | β | β |
Fresh | β | β | β | β | β |
Alternative Name | β | β | β | β | β |
Key Value Present | β | β | β | β | β |
Key Value Location | β | β | β | β | β |
Original Creation Date | β | β | β | β | β |
Random Number Generator | β | β | β | β | β |
PKCS#12 Friendly Name | β | β | β | β | β |
Description | β | β | β | β | β |
Comment | β | β | β | β | β |
Sensitive | β | β | β | β | β |
Always Sensitive | β | β | β | β | β |
Extractable | β | β | β | β | β |
Never Extractable | β | β | β | β | β |
Notes:
- GetAttributes returns a union of metadata attributes and those embedded in KeyBlock structures.
- βVendor Attributesβ are available via the Cosmian vendor namespace and are accessible via GetAttributes.
- For the 5.x columns above, a β
indicates the attribute is used or updated by at least one KMIP operation implementation in
crate/server/src/core/operations
, explicitly excluding the attribute-only handlers (Add/Delete/Get/Set Attribute).