# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
#
# When uploading crates to the registry Cargo will automatically
# "normalize" Cargo.toml files for maximal compatibility
# with all versions of Cargo and also rewrite `path` dependencies
# to registry (e.g., crates.io) dependencies.
#
# If you are reading this file be aware that the original Cargo.toml
# will likely look very different (and much more reasonable).
# See Cargo.toml.orig for the original contents.

[package]
edition = "2024"
rust-version = "1.87.0"
name = "cosmian_kms_server"
version = "5.22.0"
authors = [
    "Bruno Grieder <bruno.grieder@cosmian.com>",
    "Emmanuel Coste <emmanuel.coste@cosmian.com>",
]
build = false
exclude = [
    "ui/",
    "ui_non_fips/",
    "cosmian-kms/",
    ".vscode/",
]
autolib = false
autobins = false
autoexamples = false
autotests = false
autobenches = false
description = "Cosmian Key Management Service - A high-performance, FIPS 140-3 compliant Key Management System"
homepage = "https://github.com/Cosmian/kms"
readme = "README.md"
keywords = [
    "kms",
    "cosmian",
]
categories = ["security"]
license = "BUSL-1.1"
repository = "https://github.com/Cosmian/kms"
resolver = "2"

[package.metadata.cargo-machete]
ignored = ["sha2"]

[package.metadata.deb]
features = ["non-fips"]
maintainer = "Cosmian support team <tech@cosmian.com>"
maintainer-scripts = "../../pkg/deb/"
copyright = "2026, Cosmian Tech SAS <tech@cosmian.com>"
license-file = [
    "../../LICENSE",
    "0",
]
changelog = "../../CHANGELOG.md"
section = "security"
priority = "optional"
depends = ""
conflicts = "cosmian-kms-server-non-fips-dynamic, cosmian-kms-server-fips-dynamic"
replaces = "cosmian-kms-server-non-fips-dynamic, cosmian-kms-server-fips-dynamic"
assets = [
    [
    "../../ui_non_fips/dist/**/*",
    "usr/local/cosmian/ui/dist/",
    "644",
],
    [
    "target/release/cosmian_kms",
    "usr/sbin/cosmian_kms",
    "500",
],
    [
    "../../README.md",
    "usr/share/doc/cosmian/README.md",
    "644",
],
    [
    "../../pkg/kms.toml",
    "etc/cosmian/",
    "400",
],
    [
    "target/openssl-non-fips-3.6.2-linux/lib/ossl-modules/legacy.so",
    "usr/local/cosmian/lib/ossl-modules/legacy.so",
    "500",
],
]

[[package.metadata.deb.systemd-units]]
unit-name = "cosmian_kms"
unit-scripts = "../../pkg"
enable = true
start = false
restart-after-upgrade = false

[package.metadata.deb.variants.fips]
features = []
assets = [
    [
    "../../ui/dist/**/*",
    "usr/local/cosmian/ui/dist/",
    "644",
],
    [
    "target/release/cosmian_kms",
    "usr/sbin/cosmian_kms",
    "500",
],
    [
    "../../README.md",
    "usr/share/doc/cosmian/README.md",
    "644",
],
    [
    "../../pkg/kms.toml",
    "etc/cosmian/",
    "400",
],
    [
    "target/openssl-3.6.2-linux/lib/ossl-modules/fips.so",
    "usr/local/cosmian/lib/ossl-modules/fips.so",
    "500",
],
    [
    "target/openssl-3.6.2-linux/ssl/openssl.cnf",
    "usr/local/cosmian/lib/ssl/openssl.cnf",
    "644",
],
    [
    "target/openssl-3.6.2-linux/ssl/fipsmodule.cnf",
    "usr/local/cosmian/lib/ssl/fipsmodule.cnf",
    "644",
],
]

[package.metadata.deb.variants.fips-dynamic]
features = []
depends = ""
assets = [
    [
    "../../ui/dist/**/*",
    "usr/local/cosmian/ui/dist/",
    "500",
],
    [
    "target/release/cosmian_kms",
    "usr/sbin/cosmian_kms",
    "500",
],
    [
    "../../README.md",
    "usr/share/doc/cosmian/README.md",
    "644",
],
    [
    "../../pkg/kms.toml",
    "etc/cosmian/",
    "400",
],
    [
    "target/openssl-3.6.2-linux/lib/libssl.so.3",
    "usr/local/cosmian/lib/libssl.so.3",
    "500",
],
    [
    "target/openssl-3.6.2-linux/lib/libcrypto.so.3",
    "usr/local/cosmian/lib/libcrypto.so.3",
    "500",
],
    [
    "target/openssl-3.6.2-linux/lib/ossl-modules/fips.so",
    "usr/local/cosmian/lib/ossl-modules/fips.so",
    "500",
],
    [
    "target/openssl-3.6.2-linux/ssl/openssl.cnf",
    "usr/local/cosmian/lib/ssl/openssl.cnf",
    "644",
],
    [
    "target/openssl-3.6.2-linux/ssl/fipsmodule.cnf",
    "usr/local/cosmian/lib/ssl/fipsmodule.cnf",
    "644",
],
]

[package.metadata.deb.variants.non-fips-dynamic]
features = ["non-fips"]
depends = ""
assets = [
    [
    "../../ui_non_fips/dist/**/*",
    "usr/local/cosmian/ui/dist/",
    "500",
],
    [
    "target/release/cosmian_kms",
    "usr/sbin/cosmian_kms",
    "500",
],
    [
    "../../README.md",
    "usr/share/doc/cosmian/README.md",
    "644",
],
    [
    "../../pkg/kms.toml",
    "etc/cosmian/",
    "400",
],
    [
    "target/openssl-non-fips-3.6.2-linux/lib/libssl.so.3",
    "usr/local/cosmian/lib/libssl.so.3",
    "500",
],
    [
    "target/openssl-non-fips-3.6.2-linux/lib/libcrypto.so.3",
    "usr/local/cosmian/lib/libcrypto.so.3",
    "500",
],
    [
    "target/openssl-non-fips-3.6.2-linux/lib/ossl-modules/legacy.so",
    "usr/local/cosmian/lib/ossl-modules/legacy.so",
    "500",
],
]

[package.metadata.generate-rpm]
license = "BUSL-1.1"
auto-req = "no"
features = ["non-fips"]
require-sh = true

[[package.metadata.generate-rpm.assets]]
source = "../../ui_non_fips/dist/**/*"
dest = "/usr/local/cosmian/ui/dist/"
mode = "644"

[[package.metadata.generate-rpm.assets]]
source = "target/release/cosmian_kms"
dest = "/usr/sbin/cosmian_kms"
mode = "500"

[[package.metadata.generate-rpm.assets]]
source = "target/openssl-non-fips-3.6.2-linux/lib/ossl-modules/legacy.so"
dest = "/usr/local/cosmian/lib/ossl-modules/legacy.so"
mode = "500"

[[package.metadata.generate-rpm.assets]]
source = "../../README.md"
dest = "/usr/share/doc/cosmian/README.md"
mode = "644"
doc = true

[[package.metadata.generate-rpm.assets]]
source = "../../pkg/kms.toml"
dest = "/etc/cosmian/kms.toml"
mode = "400"

[[package.metadata.generate-rpm.assets]]
source = "../../pkg/cosmian_kms.service"
dest = "/lib/systemd/system/cosmian_kms.service"
mode = "644"

[package.metadata.generate-rpm.variants.fips]
license = "BUSL-1.1"
auto-req = "no"
require-sh = true
features = []

[[package.metadata.generate-rpm.variants.fips.assets]]
source = "../../ui/dist/**/*"
dest = "/usr/local/cosmian/ui/dist/"
mode = "644"

[[package.metadata.generate-rpm.variants.fips.assets]]
source = "target/release/cosmian_kms"
dest = "/usr/sbin/cosmian_kms"
mode = "500"

[[package.metadata.generate-rpm.variants.fips.assets]]
source = "target/openssl-3.6.2-linux/lib/ossl-modules/fips.so"
dest = "/usr/local/cosmian/lib/ossl-modules/fips.so"
mode = "500"

[[package.metadata.generate-rpm.variants.fips.assets]]
source = "target/openssl-3.6.2-linux/ssl/openssl.cnf"
dest = "/usr/local/cosmian/lib/ssl/openssl.cnf"
mode = "644"

[[package.metadata.generate-rpm.variants.fips.assets]]
source = "target/openssl-3.6.2-linux/ssl/fipsmodule.cnf"
dest = "/usr/local/cosmian/lib/ssl/fipsmodule.cnf"
mode = "644"

[[package.metadata.generate-rpm.variants.fips.assets]]
source = "../../README.md"
dest = "/usr/share/doc/cosmian/README.md"
mode = "644"
doc = true

[[package.metadata.generate-rpm.variants.fips.assets]]
source = "../../pkg/kms.toml"
dest = "/etc/cosmian/kms.toml"
mode = "400"

[[package.metadata.generate-rpm.variants.fips.assets]]
source = "../../pkg/cosmian_kms.service"
dest = "/lib/systemd/system/cosmian_kms.service"
mode = "644"

[package.metadata.generate-rpm.variants.fips-dynamic]
license = "BUSL-1.1"
auto-req = "no"
require-sh = true
features = []

[[package.metadata.generate-rpm.variants.fips-dynamic.assets]]
source = "../../ui/dist/**/*"
dest = "/usr/local/cosmian/ui/dist/"
mode = "500"

[[package.metadata.generate-rpm.variants.fips-dynamic.assets]]
source = "target/release/cosmian_kms"
dest = "/usr/sbin/cosmian_kms"
mode = "500"

[[package.metadata.generate-rpm.variants.fips-dynamic.assets]]
source = "target/openssl-3.6.2-linux/lib/libssl.so.3"
dest = "/usr/local/cosmian/lib/libssl.so.3"
mode = "500"

[[package.metadata.generate-rpm.variants.fips-dynamic.assets]]
source = "target/openssl-3.6.2-linux/lib/libcrypto.so.3"
dest = "/usr/local/cosmian/lib/libcrypto.so.3"
mode = "500"

[[package.metadata.generate-rpm.variants.fips-dynamic.assets]]
source = "target/openssl-3.6.2-linux/lib/ossl-modules/fips.so"
dest = "/usr/local/cosmian/lib/ossl-modules/fips.so"
mode = "500"

[[package.metadata.generate-rpm.variants.fips-dynamic.assets]]
source = "target/openssl-3.6.2-linux/ssl/openssl.cnf"
dest = "/usr/local/cosmian/lib/ssl/openssl.cnf"
mode = "644"

[[package.metadata.generate-rpm.variants.fips-dynamic.assets]]
source = "target/openssl-3.6.2-linux/ssl/fipsmodule.cnf"
dest = "/usr/local/cosmian/lib/ssl/fipsmodule.cnf"
mode = "644"

[[package.metadata.generate-rpm.variants.fips-dynamic.assets]]
source = "../../README.md"
dest = "/usr/share/doc/cosmian/README.md"
mode = "644"
doc = true

[[package.metadata.generate-rpm.variants.fips-dynamic.assets]]
source = "../../pkg/kms.toml"
dest = "/etc/cosmian/kms.toml"
mode = "400"

[[package.metadata.generate-rpm.variants.fips-dynamic.assets]]
source = "../../pkg/cosmian_kms.service"
dest = "/lib/systemd/system/cosmian_kms.service"
mode = "644"

[package.metadata.generate-rpm.variants.non-fips-dynamic]
license = "BUSL-1.1"
auto-req = "no"
require-sh = true
features = ["non-fips"]

[[package.metadata.generate-rpm.variants.non-fips-dynamic.assets]]
source = "../../ui_non_fips/dist/**/*"
dest = "/usr/local/cosmian/ui/dist/"
mode = "500"

[[package.metadata.generate-rpm.variants.non-fips-dynamic.assets]]
source = "target/release/cosmian_kms"
dest = "/usr/sbin/cosmian_kms"
mode = "500"

[[package.metadata.generate-rpm.variants.non-fips-dynamic.assets]]
source = "target/openssl-non-fips-3.6.2-linux/lib/libssl.so.3"
dest = "/usr/local/cosmian/lib/libssl.so.3"
mode = "500"

[[package.metadata.generate-rpm.variants.non-fips-dynamic.assets]]
source = "target/openssl-non-fips-3.6.2-linux/lib/libcrypto.so.3"
dest = "/usr/local/cosmian/lib/libcrypto.so.3"
mode = "500"

[[package.metadata.generate-rpm.variants.non-fips-dynamic.assets]]
source = "target/openssl-non-fips-3.6.2-linux/lib/ossl-modules/legacy.so"
dest = "/usr/local/cosmian/lib/ossl-modules/legacy.so"
mode = "500"

[[package.metadata.generate-rpm.variants.non-fips-dynamic.assets]]
source = "../../README.md"
dest = "/usr/share/doc/cosmian/README.md"
mode = "644"
doc = true

[[package.metadata.generate-rpm.variants.non-fips-dynamic.assets]]
source = "../../pkg/kms.toml"
dest = "/etc/cosmian/kms.toml"
mode = "400"

[[package.metadata.generate-rpm.variants.non-fips-dynamic.assets]]
source = "../../pkg/cosmian_kms.service"
dest = "/lib/systemd/system/cosmian_kms.service"
mode = "644"

[package.metadata.packager]
product-name = "Cosmian KMS Server"
long-description = "Cosmian KMS is a high-performance, source available FIPS 140-3 compliant Key Management System written in Rust. It provides enterprise-grade key management capabilities with support for various cryptographic operations, database backends, and HSM integrations."
license-file = "../../LICENSE"
identifier = "com.cosmian.kms.server"
formats = [
    "nsis",
    "dmg",
]

[[package.metadata.packager.resources]]
src = "../../README.md"
target = "README.md"

[[package.metadata.packager.resources]]
src = "../../pkg/kms.toml"
target = "kms.toml"

[[package.metadata.packager.resources]]
src = "ui_non_fips/dist"
target = "ui/"

[package.metadata.packager.nsis]
display-language-selector = false
installer-mode = "currentUser"
languages = ["English"]

[features]
default = ["interop"]
insecure = []
interop = ["cosmian_kms_server_database/interop"]
non-fips = [
    "cosmian_kms_client_utils/non-fips",
    "cosmian_kms_server_database/non-fips",
]
timeout = []

[lib]
name = "cosmian_kms_server"
path = "src/lib.rs"
doctest = false

[[bin]]
name = "cosmian_kms"
path = "src/main.rs"
test = false

[dependencies.actix-cors]
version = "0.6"

[dependencies.actix-files]
version = "0.6"

[dependencies.actix-governor]
version = "0.10"

[dependencies.actix-identity]
version = "0.6"

[dependencies.actix-rt]
version = "2.10"

[dependencies.actix-session]
version = "0.8"
features = ["cookie-session"]

[dependencies.actix-tls]
version = "3.4"

[dependencies.actix-web]
version = "4.12"
features = [
    "macros",
    "openssl",
]
default-features = false

[dependencies.async-recursion]
version = "1.1"

[dependencies.base64]
version = "0.22"

[dependencies.chrono]
version = "0.4"

[dependencies.clap]
version = "4.5"
features = [
    "help",
    "env",
    "std",
    "usage",
    "error-context",
    "derive",
    "cargo",
]
default-features = false

[dependencies.cosmian_kms_access]
version = "5.22.0"

[dependencies.cosmian_kms_base_hsm]
version = "5.22.0"

[dependencies.cosmian_kms_server_database]
version = "5.22.0"

[dependencies.cosmian_logger]
version = "0.5"
features = ["full"]

[dependencies.crypt2pay_pkcs11_loader]
version = "5.22.0"

[dependencies.dialoguer]
version = "0.11"
features = [
    "editor",
    "fuzzy-select",
    "history",
    "password",
    "completion",
]
default-features = false

[dependencies.dotenvy]
version = "0.15"

[dependencies.futures]
version = "0.3"

[dependencies.hex]
version = "0.4"
features = ["serde"]
default-features = false

[dependencies.http]
version = "1.4"

[dependencies.jsonwebtoken]
version = "10.3"
features = ["rust_crypto"]

[dependencies.num-bigint-dig]
version = "0.8"
features = [
    "std",
    "rand",
    "serde",
    "zeroize",
]
default-features = false

[dependencies.openssl]
version = "0.10"
default-features = false

[dependencies.openssl-sys]
version = "0.9"

[dependencies.opentelemetry]
version = "0.27"

[dependencies.opentelemetry-otlp]
version = "0.27"
features = [
    "metrics",
    "grpc-tonic",
]

[dependencies.opentelemetry_sdk]
version = "0.27"
features = [
    "metrics",
    "rt-tokio",
]

[dependencies.pem]
version = "3.0"

[dependencies.proteccio_pkcs11_loader]
version = "5.22.0"

[dependencies.reqwest]
version = "0.12"
features = [
    "json",
    "native-tls",
    "socks",
]
default-features = false

[dependencies.scratchstack-aws-signature]
version = "=0.10"

[dependencies.serde]
version = "1.0"

[dependencies.serde_json]
version = "1.0"

[dependencies.smartcardhsm_pkcs11_loader]
version = "5.22.0"

[dependencies.softhsm2_pkcs11_loader]
version = "5.22.0"

[dependencies.strum]
version = "0.27"
features = [
    "std",
    "derive",
    "strum_macros",
]
default-features = false

[dependencies.subtle]
version = "2.6"

[dependencies.thiserror]
version = "2.0"

[dependencies.time]
version = "0.3"
features = [
    "local-offset",
    "formatting",
]

[dependencies.tokio]
version = "1.44"
features = ["full"]
default-features = false

[dependencies.toml]
version = "0.9"

[dependencies.tracing]
version = "0.1"

[dependencies.url]
version = "2.5"

[dependencies.utimaco_pkcs11_loader]
version = "5.22.0"

[dependencies.uuid]
version = "=1.11.1"
features = ["v4"]

[dependencies.x509-parser]
version = "0.17"

[dependencies.zeroize]
version = "1.8"
default-features = false

[dev-dependencies.actix-http]
version = "3.12"

[dev-dependencies.cosmian_kms_client_utils]
version = "5.22.0"

[dev-dependencies.cosmian_kms_interfaces]
version = "5.22.0"

[dev-dependencies.native-tls]
version = "0.2"
default-features = false

[dev-dependencies.pem]
version = "3.0"

[dev-dependencies.tempfile]
version = "3.19"

[build-dependencies.actix-http]
version = "3.12"

[build-dependencies.sha2]
version = "0.10"
default-features = false

[build-dependencies.time]
version = "0.3"
features = [
    "local-offset",
    "formatting",
]

[lints.clippy]
as_conversions = "deny"
assertions_on_result_states = "deny"
empty_structs_with_brackets = "deny"
expect_used = "deny"
get_unwrap = "deny"
implicit_clone = "deny"
indexing_slicing = "deny"
map_err_ignore = "deny"
missing_asserts_for_indexing = "deny"
module_name_repetitions = "allow"
panic = "deny"
panic_in_result_fn = "deny"
print_stdout = "deny"
redundant_clone = "deny"
renamed_function_params = "deny"
str_to_string = "deny"
unreachable = "deny"
unseparated_literal_suffix = "deny"
unwrap_in_result = "deny"
unwrap_used = "deny"
verbose_file_reads = "deny"

[lints.clippy.all]
level = "deny"
priority = 80

[lints.clippy.cargo]
level = "deny"
priority = 30

[lints.clippy.cognitive_complexity]
level = "allow"
priority = 21

[lints.clippy.complexity]
level = "deny"
priority = 60

[lints.clippy.future_not_send]
level = "allow"
priority = 21

[lints.clippy.iter_with_drain]
level = "allow"
priority = 21

[lints.clippy.missing_errors_doc]
level = "allow"
priority = 91

[lints.clippy.multiple_crate_versions]
level = "allow"
priority = 31

[lints.clippy.nursery]
level = "deny"
priority = 20

[lints.clippy.pedantic]
level = "deny"
priority = 90

[lints.clippy.perf]
level = "deny"
priority = 50

[lints.clippy.redundant_pub_crate]
level = "allow"
priority = 21

[lints.clippy.ref_option]
level = "allow"
priority = 91

[lints.clippy.significant_drop_tightening]
level = "allow"
priority = 21

[lints.clippy.similar_names]
level = "allow"
priority = 91

[lints.clippy.style]
level = "deny"
priority = 40

[lints.clippy.suspicious]
level = "deny"
priority = 70

[lints.clippy.too_long_first_doc_paragraph]
level = "allow"
priority = 21

[lints.clippy.too_many_lines]
level = "allow"
priority = 91

[lints.rust]
future_incompatible = "deny"
keyword_idents = "deny"
let_underscore = "deny"
nonstandard_style = "deny"
refining_impl_trait = "deny"
unreachable_pub = "deny"
unsafe_code = "deny"
unused = "deny"
