The CMP test suite is a tool for verifying implementations of the Certificate Management Protocol (CMP). It generates CMP requests, sends them to the server and checks if responses match expectations. The results are logged in a report, which includes all the transmitted and received messages in base64 and in human-readable form.
Test cases are written in a domain-specific language (DSL) tailored for PKI and X509 certificate parsing. The provided scenarios evaluate server implementations of CMP RFC and the CMP lightweight profile RFC 9483.
Several usage scenarios are possible:
- Run it "as is" and check whether your CMP server conforms to the specification.
- Adapt the test suite to your needs, by writing test scenarios using the provided DSL.
Additionally, the DSL can also be used for writing client-oriented tests. A usage scenario could be:
- Extend the DSL, adding new keywords and correcting errors in existing ones.
What makes this test suite unique is the high-level notation it is written in, making the reports and test scenarios readable not only to software engineers, but also to PKI experts without programming experience. Another key benefit is the emphasis on replicability - a test report is sufficient for someone to understand exactly what was transmitted to the server and how the responses were processed.
These instructions assume a Debian-based Linux system, but it is designed to be used with other platforms as well. Occasionally, additional Windows commands are provided.
The contribution guidelines explain how to contribute to the project.
On a system where Docker is available, the easiest way to run the test suite is docker run --rm -it ghcr.io/siemens/cmp-test. This will invoke a smoke test just to confirm that the basics are in place. Add --help to learn about what other commands are available.
To run a minimal test against an actual CA, try docker run --rm -it ghcr.io/siemens/cmp-test --minimal http://example.com --ephemeral (replace the URL with your CMP endpoint).
A thorough evaluation that covers all the features of CMP requires a configuration file, where you specify preshared passwords, keys, algorithms to use, etc. (see --customconfig for details).
While the Docker-based approach makes it easy to get started, it essentially treats the test suite as a black box. However, if you want to customize, extend or debug it, it is necessary to dive deeper and understand how it works "under the hood".
Create a Python virtual environment by installing the dependencies from requirements.txt as follows:
- Create a virtual environment:
python3 -m venv venv-cmp-tests- If you use WSL 2.0, run
apt install libpython3-dev python3-venvif the command above fails.
- If you use WSL 2.0, run
- Activate the environment:
- on Linux or cygwin:
source venv-cmp-tests/bin/activate - on Windows with Powershell:
.\venv-cmp-tests\Scripts\Activate.ps1
- on Linux or cygwin:
- Install the dependencies:
pip install -r cmp-test-suite/requirements.txt
Note that if you have not activated the environment yet, do so now.
- Navigate into the test suite:
cd cmp-test-suite - Adjust the settings in the config/local.robot file to match your environment.
- To run the smoke test, this step is not necessary.
- Run the test:
- Run
robot tests/smoke.robotto run the smoke test, that checks if everything works so far. - Run
robot --variable environment:local teststo run everything intests/against thelocalenvironment.
- Run
- In your directory in the folder of cmp-test-suite you will find
report.html.
You can run specific tests on specific environments by adjusting command line options. Consider this example:
robot --outputdir=out --variable environment:cloudpki --include crypto tests
--outputdir=out- store the results in theoutdirectory--variable environment:cloudpki- use the settings given in theconfig/cloudpki.robotfile (replace as needed)--include crypto- run only the tests that have thecryptotag
make test- run all the tests, store the results inout/, use theconfig/local.robotsettings.make testlog- run all the tests, store the results in subdirectories likeout/2024-01-20_17-45_January-1, so that you can keep track of the history of test runs, instead of overwriting them. This will use the default test environment.make testlog env=cloudpki- as above, but use theconfig/cloudpki.robotsettings.make testlog env=ejbca- as above, but use theconfig/ejbca.robotsettings.make docs- generate HTML documentation for test suites and available keywords, store indoc/.make unittest- run unit tests that verify the functionality of the library itself.
The detailed documentation covers test suites and available keywords.
If the referenced documentation is not available, run make docs to generate it.
The development of the CMP test suite was partly funded by the German Federal Ministry of Education and Research in the project Quoryptan through grant number 16KIS2033.