cosmian_kms_cli 5.18.0

Command Line Interface used to manage the KMS server If any assistance is needed, please either visit the Cosmian technical documentation at https://docs.cosmian.com or contact the Cosmian support team on Discord https://discord.com/invite/7kPMNtHpnz
Documentation
#![allow(clippy::print_stdout)]
//! These tests are gated behind the HSM feature flag. They require a running KMS-HSM server.
//! Configure the client file at the location indicated by `KSM_HSM_CLIENT_CONF` with the appropriate content
//! then run the tests with the following command:
//! ```bash
//!  cargo test --color=always --features hsm --lib tests::hsm::test_all_hsm_cli
//! ```

use encrypt_decrypt::test_aes_gcm;
use revoke_destroy::test_revoke_symmetric_key;
use test_kms_server::start_default_test_kms_server_with_utimaco_hsm;
#[cfg(feature = "non-fips")]
use wrap_with_hsm_key::{test_unwrap_on_export, test_wrap_with_rsa_oaep};
use wrap_with_hsm_key::{test_unwrap_with_hsm_key, test_wrap_with_aes_gcm};

use crate::error::result::KmsCliResult;
#[cfg(feature = "non-fips")]
use crate::tests::kms::hsm::encrypt_decrypt::{test_rsa_pkcs_oaep, test_rsa_pkcs_v15};

mod encrypt_decrypt;
mod revoke_destroy;
mod wrap_with_hsm_key;

#[ignore = "Requires an Utimaco HSM setup"]
#[tokio::test]
async fn test_all_hsm_cli() -> KmsCliResult<()> {
    let ctx = start_default_test_kms_server_with_utimaco_hsm().await;
    test_aes_gcm(ctx).await?;
    test_wrap_with_aes_gcm(ctx).await?;
    Box::pin(test_unwrap_with_hsm_key(ctx)).await?;
    test_revoke_symmetric_key(ctx).await?;
    #[cfg(feature = "non-fips")]
    test_rsa_pkcs_oaep(ctx).await?;
    #[cfg(feature = "non-fips")]
    test_rsa_pkcs_v15(ctx).await?;
    #[cfg(feature = "non-fips")]
    test_unwrap_on_export(ctx).await?;
    #[cfg(feature = "non-fips")]
    test_wrap_with_rsa_oaep(ctx).await?;
    Ok(())
}