---
id: HSCP-T-006
titre: "Inventory of encryption and keys: complete fields, no key value, one decision per gap"
titre_court: "Check the inventory of encryption and keys"
type: note
objet: test
langue: en
statut: brouillon
version: 0.2
verifie_le: 2026-12-05
traduit_de: LISEZ-MOI.md
traduit_de_version: 0.2
traduit_de_empreinte: 6e6443c5c2e07a37
traduction: modèle de langue, glossaire catalogue/glossaire-en.yaml
source: traduction de LISEZ-MOI.md, version 0.2
sensibilite: interne
licence: Apache-2.0
gestes: [HSCP-G-042, HSCP-G-001]
recette: HSCP-R-019
piece: inventaire
---

# Inventory of encryption and keys: complete fields, no key value, one decision per gap

## What the test checks

The evidence item is the inventory of encryption, one line per use (JSON Lines), following the data model of the recipe. Every line carries:

| Field | Required | Meaning |
|---|---|---|
| `donnee` | yes | the protected data |
| `classe` | yes | its security-need class, from the data classification |
| `sante` | no | `true` for health data |
| `couche` | yes | `circulation-externe` (external transit), `circulation-interne` (internal transit), `stockage` (storage), `sauvegarde` (backup) or `applicatif` (application level) |
| `sens` | no | for transit: `entrant` (incoming, the product receives the connection) or `sortant` (outgoing, the product opens it to a third party) |
| `mecanisme` | yes | protocol or algorithm, key size, library and version |
| `cle` | yes | identifier of the key, never its value |
| `client` | for health data at rest, with `--multi-clients` | customer the key belongs to |
| `emplacements_cle` | yes | list of every place where the key is held |
| `acces` | yes | who or which service can use the key |
| `rotation` | yes | `derniere` (last) and `echeance` (due), or `detruite_le` (destroyed on) |
| `confidentialite_jusqu_a` | no | year until which the data must stay confidential, taken from its class (for example `2040`) |
| `besoin` | yes | encryption expected for the data class |
| `ecart` | yes | `aucun` (none), `manque` (missing), `faiblesse` (weakness) or `exces` (excess) |
| `decision` | for every gap | `action` (`corriger` fix, `accepter` accept, `retirer` remove), `date`, `motif` (reason), and `echeance` (due date) for a fix |
| `point` | no | for an exposed endpoint: `host:port` |
| `protocoles` | with `point` | protocols allowed on that endpoint, for example `TLSv1.2`, `TLSv1.3` |

The test rejects:

- an unreadable line, a missing required field, a layer, direction or gap outside the vocabulary, an unreadable confidentiality year;
- a line that contains, in any field, what looks like a key or a secret: PEM block, JWK key, age key, long hexadecimal string, long base64 string;
- an unreadable or future date, an overdue rotation on a key that has not been destroyed;
- a gap without a decision, a decision without a date or without a real reason, a fix without a due date or past its due date.

With `--multi-clients`, when the product serves several customers, it also rejects health data at rest whose key has no customer, and the same key attached to two customers.

With `--releve`, it compares a configuration scan of the exposed endpoints with the inventory, produced by [testssl.sh](https://testssl.sh/) (free software) with `--jsonfile` or `--jsonfile-pretty`. It rejects a scanned endpoint missing from the inventory, and a protocol offered by an endpoint but not allowed by its line. An endpoint of the inventory missing from the scan gives a note, not a rejection.

## Running the test

```sh
python3 verifier.py inventaire.jsonl --date 2026-12-01 --multi-clients --releve releve.json
```

Without `--date`, the test uses the current day. `--json` gives the same answer as JSON. Exit code: 0 evidence accepted, 1 evidence rejected, 2 incorrect call. Python 3.10 or later, no dependency, no network access.

## Producing the evidence

The inventory is written by hand or exported from the key manager and the configuration, one line per use of encryption. The scan of the exposed endpoints is produced with testssl.sh:

```sh
testssl.sh --jsonfile releve.json portail.exemple.test:443
```

## Examples

- `exemples/valide/`: seven uses for a product that serves several customers. One key per customer for storage, a backup with a shared key and its decision to fix it, a double encryption to remove, an incoming exposed endpoint on TLS 1.2 and 1.3 matching the scan, a key destroyed at the end of a contract, an outgoing connection to an AI model, confidential until 2040, without hybrid key exchange, accepted with its reason. Accepted on 01/12/2026.
- `exemples/refuse/`: a key shared by two customers, an attachment key without a customer, overdue and without a decision, a secret value in a line, a layer outside the vocabulary, a decision without a date or reason, a direction `inconnu` and an unreadable confidentiality year. The scan shows TLS 1.0 offered and an exposed endpoint missing from the inventory. Rejected.

## What the test does not say

- It does not say whether the chosen encryption is the right one, nor whether the need of each class is right: that is the review of the recipe.
- It does not say whether the inventory is complete. The scan only sees exposed endpoints; encryption at rest and copies of keys are checked by review, by comparing the inventory with the key manager's list.
- The search for key values relies on their shape. A certificate fingerprint in hexadecimal is rejected like a key: name the key by its identifier. A short secret or one written in words can pass.
- It does not read the cipher suites or the certificate expiry in the scan: only the endpoints and the protocols.
