Chiffrement de fichiers en ligne de commande.
Command-line file encryption.
Chiffremento CLI est un outil en ligne de commande écrit en Go pour chiffrer et déchiffrer des fichiers. Il s'utilise soit via une interface guidée, soit avec des flags pour les scripts.
chiffremento chiffrement v2.4.0
┌────────────────────────────────────────────────────┐
│ entrée rapport-annuel.pdf 14.2 Mo │
│ sortie rapport-annuel.pdf.chto │
│ │
│ aead aes-256-gcm │
│ kdf argon2id m=256MiB t=3 p=4 │
│ sel 16 o aléatoires · en-tête authentifié │
│ │
│ ██ ██ ██ ██ ██ d6 23 76 e5 47 23 67 8b 1d │
│ ████████████░░░░░░░░░░░░░░░░░░ 42% 38 Mo/s │
└────────────────────────────────────────────────────┘
Lancer chiffremento ouvre maintenant une vraie application plein écran, et l'indicateur de force connaît le français. Les releases sont aussi signées : on peut vérifier qu'elles viennent bien du dépôt.
Le format de fichier ne change pas : il reste en v4. Les
.chtocréés avec les versions précédentes s'ouvrent comme avant.
- 🖥️ Interface plein écran. Un seul écran en plein terminal, avec une barre du haut (l'opération et l'étape) et une barre du bas (les touches utiles). Après chaque opération, on revient au menu : plus besoin de relancer le programme.
Échapabandonne l'opération en cours,qquitte,?affiche l'aide,ooublie la phrase gardée. Une carte résume le résultat. En cas d'échec, un écran d'erreur donne la cause et un conseil court (mauvaise phrase, fichier abîmé, permission refusée…). - 🧠 Phrase gardée pour la session, sur demande. Après une opération réussie, l'interface demande s'il faut garder la phrase pour la suivante (« non » par défaut). Elle est oubliée après 5 minutes sans touche, avec
o, ou à la sortie. Seule la phrase est gardée, jamais la clé dérivée. - 📊 Indicateur de force en français. Il reconnaît les mots français, les prénoms et les noms de famille de l'INSEE, avec ou sans accent.
zxcvbn, le calcul qui estime combien d'essais il faut pour deviner un mot de passe, est maintenant une copie interne au projet. Elle corrige des défauts de l'original avec les caractères accentués : un mot de passe pouvait être estimé à 0 essai, etandrén'était pas reconnu comme un mot. - 🪶 Plus léger. Le binaire passe de 8 348 898 à 6 312 914 octets. Lancer
-versiondemande ~4,2 Mo de mémoire au lieu de ~15,5 Mo : les listes de mots ne sont chargées qu'à la première estimation de force. - 🔏 Releases signées. Chaque release contient une signature de
checksums.txt(faite aveccosign, un outil de signature), la liste des bibliothèques embarquées (SBOM) et une attestation de provenance.install.shvérifie la signature sicosignest installé. Voir Vérifier une release. - 🛡️ Fiabilité.
- Plus aucun fichier temporaire déchiffré ne reste sur le disque après Ctrl+C, fermeture de la fenêtre ou plantage.
- La copie du mot de passe est effacée de la mémoire avant la sortie.
- Saisie du mot de passe : deux bouts de code pouvaient lire et écrire la saisie en même temps (une « course de données »). C'est corrigé pour le mot de passe et sa confirmation.
Échapdans l'explorateur de fichiers remonte d'un dossier, au lieu de valider sans fichier.
Le format de fichier ne change pas : il reste en v4.
- 🎲 Phrase de passe générée. À l'étape du mot de passe, l'interface propose une phrase de 7 mots français tirée au hasard, d'environ 128 bits. Elle s'affiche masquée, se dévoile ou se copie, et l'interface demande confirmation qu'elle a été enregistrée avant de chiffrer. En ligne de commande :
-mode genpass [-mots N]. - 🪶 Plus léger. La mémoire d'Argon2 est rendue au système dès la clé dérivée : pendant le traitement d'un gros fichier, l'empreinte passe de 272 à 17 Mo, et
-mode passwdde 528 à 272 Mo. Archiver ou extraire un dossier de 5 000 fichiers consomme environ 90 Mo de moins, et l'interface au repos calcule 40 % de moins. - ⚡ Extraction d'un dossier rapide et sûre. Chaque fichier extrait est désormais synchronisé sur disque, sans le coût d'une synchronisation complète par fichier sous macOS : 0,55 s pour 5 000 petits fichiers au lieu de ~17 s. Sur les volumes qui ne savent pas synchroniser (exFAT, SMB, NFS), l'extraction n'échoue plus.
- 🛡️ Fiabilité.
- Ctrl+C interrompt l'écran de progression et restaure le terminal pendant la saisie masquée.
- Une source modifiée depuis le chiffrement n'est jamais effacée, et l'écran dit pourquoi la source n'a pas pu être relevée.
- L'écriture reste atomique quand l'entrée est un flux.
-out /dev/null, un tube nommé ou un lien symbolique reçoivent de nouveau les octets. - Un nom d'origine contenant « : » est accepté avec
-meta minimal. install.shrefuse une archive absente dechecksums.txt.
Le format de fichier est passé en v4 dans cette version. Les deux numéros sont indépendants : la version du programme suit ses fonctionnalités, celle du format sa structure binaire.
chiffremento -mode infoaffiche celle d'un fichier donné. Les.chtoen v1, v2 et v3 restent déchiffrables.
- 🔐 Format v4 — engagement de clé : un témoin de 32 octets sur la clé maîtresse, comparé avant tout déchiffrement. Un mot de passe faux est annoncé comme tel, au lieu d'une erreur d'authentification en fin de lecture, et l'attaque par oracle de partitionnement n'a plus de prise.
- 📦 Format v4 — enveloppe DEK/KEK : la clé qui chiffre le contenu est tirée au hasard puis scellée dans l'en-tête. Elle ne dépend plus du mot de passe, ce qui rend possible le point suivant.
- 🔑
-mode passwd: changer le mot de passe en réécrivant 117 octets d'en-tête, quelle que soit la taille du fichier. Le contenu n'est pas relu. Réservé aux fichiers en v4 : avant, la clé du contenu venait du mot de passe, donc en changer imposait de tout re-chiffrer. Attention, l'ancien mot de passe continue d'ouvrir toute copie du fichier antérieure au changement — sauvegarde, instantané : pour une révocation complète, déchiffrer puis rechiffrer. - ↩️ Marche arrière dans l'interface guidée :
↑↓parcourent les réponses,→valide,←revient à la décision précédente — d'un écran à l'autre, en gardant les réponses déjà données. Dans un champ texte et dans l'explorateur, où←sert déjà, le retour se fait avecshift+tab. - 🏷️ Restitution du nom d'origine : conservé par
-meta minimal, il était stocké mais jamais ressorti. Il n'est lisible qu'une fois le contenu authentifié. - 🎭 Brouillage du nom et de la date du fichier produit, dans l'interface guidée : sortie sous un nom tiré au hasard —
3fb8db8ee5db3891.chto— et datée du 1ᵉʳ janvier 2000. Le déchiffrement restitue les deux. - 🗑️ Suppression après coup de ce que l'opération remplace, dans l'interface guidée : l'original après un chiffrement, le
.chtoaprès un déchiffrement. Effacer un original n'a lieu qu'après relecture et authentification complète du chiffré. « Garder » est toujours la réponse sous le curseur. - 📏
-pad-niveau standard|fort|maximum: largeur du palier de remplissage, de « quelques pour cent » à « toute une octave sort à la même taille ».
Le format de fichier était passé en v3 dans cette version.
- 📁 Dossiers : chiffrer un dossier entier, empaqueté en tar au fil du chiffrement et recréé à l'identique au déchiffrement.
- 🗜️ zstd : remplace gzip, mesuré ~8× plus rapide à ratio comparable. gzip n'est plus produit, seulement relu : les
.chtov1 et v2 compressés restent déchiffrables. La compression est désormais décrite par un champ de l'en-tête plutôt que par un simple bit. - 📏
-pad: masque la taille réelle du contenu en arrondissant au palier supérieur. - 🔗
-out,-in -,-out -: destination choisie, et flux standard pour composer avec d'autres outils. - 🗂️ Explorateur de fichiers dans l'interface guidée, en alternative à la saisie du chemin.
- 📊 Force du mot de passe par dictionnaire :
azerty123est enfin annoncé comme faible. - 🔑 Profils de dérivation :
-kdf standard|fort|maximum, du plus rapide au plus coûteux à attaquer. - 🏷️
-meta minimal: conserve le nom et la date d'origine à l'intérieur du chiffré, pour pouvoir sortir sous un nom neutre. - 📊
-mode bench: mesure les profils et le débit des algorithmes sur votre machine, et conseille un profil.
- 🖥️ Interface guidée : lancer
chiffrementosans argument ouvre une interface qui vous guide. Les flags restent disponibles pour les scripts. - 🛡️ Format v2 : les paramètres Argon2 sont désormais stockés dans le fichier, et l'en-tête est lié à la clé de chiffrement. Les fichiers
.chtoproduits par les versions 1.x restent déchiffrables. - 🔑 Argon2 renforcé : 256 MiB au lieu de 32 MiB, soit environ onze fois plus coûteux pour une attaque par force brute.
- 💾 Écriture atomique : plus aucune façon de détruire un fichier existant avec un déchiffrement raté.
- 🙈 Fin du flag
-key: le mot de passe n'est plus jamais passé en argument, donc il n'apparaît plus danspsni dans l'historique du shell. - 🔍 Commande
info: inspecter un.chtosans mot de passe et sans le déchiffrer.
- 🔐 Chiffrement authentifié : AES-256-GCM (par défaut) ou ChaCha20-Poly1305, en streaming via
minio/sio(format DARE). - 🔑 Dérivation de clé : Argon2id, avec des paramètres inscrits dans le fichier pour pouvoir être renforcés plus tard sans casser les anciens fichiers.
- ⚡ Mémoire constante : chiffrer un fichier de 100 Go ne consomme que quelques mégaoctets de RAM.
- 📁 Fichiers et dossiers : un dossier est empaqueté en tar au fil du chiffrement — sans archive intermédiaire sur le disque — et recréé tel quel au déchiffrement. Les liens symboliques sont refusés, et une archive ne peut rien écrire hors du dossier de destination.
- 📦 Compression : zstd, optionnelle avant chiffrement et proposée active pour un dossier. Elle remplace gzip, mesurée ~8× plus rapide pour un ratio équivalent ; les anciens fichiers gzip restent déchiffrables mais ne sont plus produits.
- 📏 Taille masquée : option
-pad, qui arrondit la taille au palier supérieur (schéma Padmé) pour qu'un.chtone trahisse plus la taille exacte de son contenu. - 🔗 Composable :
-in -et-out -lisent et écrivent sur les flux standard. - 📊 Indicateur de force réaliste : la robustesse du mot de passe est évaluée par une copie interne de
zxcvbn, qui reconnaît les mots de dictionnaire (dont les mots, prénoms et noms français, accents compris), les dates et les suites de touches.azerty123est annoncé à ~13 bits, pas à ~60. - 🎲 Phrase de passe générée : à l'étape du mot de passe, l'interface propose de générer une phrase de 7 mots français, avec majuscules, séparateurs et un chiffre tirés au hasard par
crypto/rand— environ 128 bits. Elle s'affiche masquée, se dévoile ou se copie dans le presse-papier, et l'interface demande confirmation qu'elle a été enregistrée avant de chiffrer. Aussi en ligne de commande :-mode genpass [-mots N]. Liste de mots : celle compilée par Tango pour Tails et le Tor Project (CC0). - 😱 Mode parano : double chiffrement en cascade (ChaCha20 à l'extérieur, AES à l'intérieur), avec deux clés dérivées indépendamment par HKDF.
- 🔗 En-tête authentifié : version, drapeaux, algorithme, paramètres Argon2, sel et engagement de clé servent tous de données associées au scellement de l'enveloppe. Modifier un seul octet de l'en-tête empêche le déchiffrement. Jusqu'au format v3, ce liage passait par la dérivation de la clé elle-même.
brew tap ValMtp3/homebrew-tap
brew install --cask chiffrementoDepuis la v2.0.0, la distribution passe par un cask et non plus par une formule : GoReleaser a déprécié les formules. Si vous aviez installé la v1.x, désinstallez-la d'abord avec
brew uninstall chiffremento. Les casks sont spécifiques à macOS ; sous Linux, utilisez le script d'installation ci-dessous.
- Depuis la page Releases, téléchargez l'archive correspondant à votre système, le fichier
checksums.txt, sa signaturechecksums.txt.sigstore.json(obligatoire si cosign est installé) etinstall.sh, dans le même dossier. - Lancez :
bash install.shLe script vérifie la signature (si cosign est installé) puis l'empreinte SHA-256 de l'archive avant d'installer quoi que ce soit.
Chaque release contient checksums.txt (les empreintes de toutes les archives), sa signature checksums.txt.sigstore.json, un SBOM par archive (la liste des bibliothèques embarquées) et une attestation de provenance. La signature est faite par la CI, sans clé à garder : elle prouve que les fichiers viennent du workflow de ce dépôt sur un tag v*. Pour la vérifier à la main, avec cosign et la CLI GitHub :
cosign verify-blob --bundle checksums.txt.sigstore.json \
--certificate-identity-regexp '^https://github.com/ValMtp3/chiffremento-go-cli/.github/workflows/release.yml@refs/tags/v' \
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
checksums.txt
sha256sum --ignore-missing -c checksums.txt # macOS : shasum -a 256 --ignore-missing -c checksums.txt
gh attestation verify chiffremento_X.Y.Z_linux_amd64.tar.gz --repo ValMtp3/chiffremento-go-cli \
--signer-workflow ValMtp3/chiffremento-go-cli/.github/workflows/release.yml \
--source-ref refs/tags/vX.Y.ZFaites ces vérifications avant bash install.sh : le script est lui-même le vérificateur, donc on le contrôle d'abord (son empreinte est dans checksums.txt, la ligne sha256sum ci-dessus la couvre si install.sh est dans le dossier).
install.sh fait la première vérification lui-même, avant de lire les empreintes :
- cosign présent et
checksums.txt.sigstore.jsondans le dossier : la signature est vérifiée avec l'identité ci-dessus. Si elle échoue, ou si cosign ne peut pas la vérifier (réseau absent), l'installation est refusée. Il faut une version récente de cosign : ≥ 2.6.2 (ou ≥ 3.0.4 en v3). En dessous, le script refuse avec « cosign trop ancien », par prudence : l'avis GHSA-whqx-f9j3-ch6m décrit un défaut qui, dans certaines conditions (identité ou clé déjà compromise), empêche de retrouver la trace de la signature dans le journal public (Rekor). Il ne fait pas accepter une fausse signature, et les réglages par défaut de cosign v3 ne sont pas touchés ; nous gardons le seuil quand même. - cosign absent : le script affiche « signature non vérifiée : installe cosign pour plus de sûreté » et continue. L'empreinte SHA-256 est toujours vérifiée.
- cosign installé, mais fichier
.sigstore.jsonabsent : l'installation est refusée, quelle que soit la version (sans signature,checksums.txtne prouve rien). Télécharge le fichier depuis la même page de release. Pour une release antérieure à la 2.4.0, qui n'est pas signée, utilise l'install.shfourni avec cette release.
Sans cosign, seule l'empreinte est vérifiée : rien ne protège contre un remplacement complet des fichiers (archive et
checksums.txt).
Un binaire nu (
chiffremento-<os>-<arch>, produit parmake build-all) posé sanschecksums.txt, ou absent de ce fichier, est installé sans vérification : le script affiche seulement « Aucune empreinte disponible … installation non vérifiée ». Une archive de release, elle, est refusée si elle n'est pas listée danschecksums.txt.
make buildSans aucun argument, dans un terminal :
chiffrementoElle demande l'opération, puis comment désigner la cible : saisir un chemin (ou le glisser-déposer), ou parcourir les fichiers. Dans l'explorateur, ↑↓ se déplacent, → entre dans un dossier, échap remonte d'un dossier et entrée choisit.
Les décisions suivent la même grammaire : ↑↓ parcourent les réponses, → (ou entrée) valide, ← revient à la décision précédente — y compris d'un écran à l'autre, en gardant les réponses déjà données. Dans un champ texte et dans l'explorateur, où ← sert déjà, le retour se fait avec shift+tab.
Elle occupe tout le terminal, dans un écran à part que la sortie rend tel qu'il était : une barre en haut (chiffremento v2.4.0 · chiffrer › options, et ● phrase en mémoire à droite quand une phrase est gardée), le cadre au centre (de 52 à 80 colonnes selon la fenêtre), les touches de l'écran courant en bas. Sur un terminal trop petit, les barres disparaissent et le cadre prend toute la place. Le menu revient après chaque opération : une carte donne le résultat, un écran d'erreur donne la cause et quoi faire, entrée revient au menu. On quitte par la ligne « quitter » du menu ou par q. Les résumés complets de la session sont alors imprimés dans le terminal.
Captures réelles (terminal de 80×24, binaire lancé dans un pseudo-terminal), le menu puis les options de chiffrement :
chiffremento v2.4.0 · menu
┌──────────────────────────────────────────────────────────────────────────┐
│ ┃ opération │
│ ┃ > chiffrer un fichier ou un dossier │
│ ┃ déchiffrer un .chto (fichier ou dossier) │
│ ┃ vérifier un .chto (sans rien écrire) │
│ ┃ changer le mot de passe d'un .chto │
│ ┃ quitter │
│ │
│ désigner la cible │
│ saisir un chemin (ou glisser-déposer) │
│ parcourir les fichiers │
└──────────────────────────────────────────────────────────────────────────┘
↑↓ choisir → valider q quitter ? aide ctrl+c quitter
L'écran des options est coupé en bas : le terminal ne fait que 24 lignes, l'interface défile pour garder le champ actif visible.
chiffremento v2.4.0 · chiffrer › options
┌──────────────────────────────────────────────────────────────────────────┐
│ ┃ algorithme │
│ ┃ > aes-256-gcm (défaut) │
│ ┃ chacha20-poly1305 │
│ ┃ cascade chacha20 + aes (parano) │
│ │
│ coût de la dérivation de clé │
│ argon2id m=256MiB t=3 p=4 · 256 Mio de mémoire, exigés aussi au │
│ déchiffrement │
│ standard (défaut) │
│ fort │
│ maximum │
│ │
│ compresser avant chiffrement (zstd) │
│ réduit la taille, mais laisse fuiter la compressibilité du contenu │
│ oui │
│ non │
└──────────────────────────────────────────────────────────────────────────┘
↑↓ choisir → valider ← revenir ? aide ctrl+c quitter
Et l'écran du mot de passe, avec l'indicateur de force pour « dupont » :
chiffremento v2.4.0 · chiffrer › options
┌──────────────────────────────────────────────────────────────────────────┐
│ ┃ mot de passe │
│ ┃ ~5 bits — faible, une phrase de passe serait bien plus sûre · cassé en │
│ ┃ quelques secondes hors ligne │
│ ┃ > ****** │
│ │
│ confirmation │
│ une faute de frappe rendrait le fichier définitivement irrécupérable │
│ > │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
└──────────────────────────────────────────────────────────────────────────┘
⏎ valider shift+tab revenir ? aide ctrl+c quitter
| Touche | Rôle |
|---|---|
↑ ↓ |
parcourir les réponses |
→ ou ⏎ |
valider |
← |
revenir à la décision précédente |
shift+tab |
revenir, dans un champ texte ou l'explorateur |
échap |
abandonner l'opération, retour au menu |
| dans l'explorateur : remonter d'un dossier | |
q |
quitter, depuis le menu |
o |
oublier la phrase en mémoire, hors d'un champ texte |
? |
ouvrir ou fermer cette aide |
ctrl+c |
quitter tout de suite |
Code de sortie de la session : 0 si tout a réussi, 1 si au moins une opération a échoué, 130 sur Ctrl+C, 129 si la fenêtre du terminal est fermée. Avant son lancement, une opération s'abandonne sans rien écrire ; une écriture déjà lancée n'est pas coupée par échap.
Après une opération réussie avec une phrase saisie ou générée, elle demande s'il faut garder la phrase pour la session (« ne pas la garder » par défaut). Si oui, elle est proposée à la saisie suivante : ⏎ l'utilise, ou on la retape. Elle est oubliée, octets mis à zéro, après 5 min sans touche (sur l'heure murale comme sur l'horloge monotone, donc aussi après une mise en veille), par o, et à la sortie. Seule la phrase est gardée, jamais une clé dérivée : Argon2 tourne à chaque opération. La mémoire n'est pas verrouillée : comme toute phrase tapée, elle peut être écrite dans le fichier d'échange du système.
Avec -mode …, ou quand l'entrée ou la sortie n'est pas un terminal, rien ne change : pas d'écran à part, la sortie reste simple.
Au chiffrement, une fois le nom et la date conservés à l'intérieur du chiffré, elle propose de brouiller ceux du fichier produit : sortie sous un nom tiré au hasard — 3fb8db8ee5db3891.chto — et datée du 1er janvier 2000. Le déchiffrement les restitue tous les deux. La date de création, elle, reste celle de l'écriture : aucun appel en espace utilisateur ne la change, le brouillage cache la date au regard ordinaire, pas à l'examen du disque.
Quand le masquage de taille est activé, elle demande aussi la largeur du palier, en montrant ce que chaque cran coûte sur ce fichier : « 7.2 Mo → environ 8.0 Mo (+11.8 %) · tout ce qui pèse de 4.0 Mo à 8.0 Mo sort identique ».
Une fois l'opération finie, elle propose enfin de supprimer ce qu'elle remplace : l'original après un chiffrement, le .chto après un déchiffrement. Effacer un original n'a lieu qu'après relecture et authentification complète du chiffré — l'original est la seule autre copie. « Garder » est toujours la réponse sous le curseur, et la suppression retire l'entrée du dossier sans effacer les données du support.
chiffremento -mode <enc|dec|verify|info|passwd> -in <fichier> [options]Le mot de passe n'est jamais un argument. Il est demandé de façon masquée, ou lu sur l'entrée standard si celle-ci n'est pas un terminal.
| Flag | Description |
|---|---|
-mode |
Obligatoire. enc (chiffrer), dec (déchiffrer), verify (contrôler sans rien écrire), info (inspecter l'en-tête), passwd (changer le mot de passe), bench (mesurer les coûts) ou genpass (générer une phrase de passe, sans -in). |
-in |
Obligatoire. Fichier ou dossier d'entrée, ou - pour l'entrée standard. |
-out |
Destination. Par défaut, l'entrée suivie de .chto en enc, l'entrée sans l'extension en dec. - écrit sur la sortie standard. |
-comp |
(enc) Active la compression zstd. |
-pad |
(enc) Masque la taille réelle. S'exclut avec -comp. |
-pad-niveau |
(enc) Largeur du palier : standard (défaut), fort ou maximum. Exige -pad. |
-chacha |
(enc) Utilise ChaCha20-Poly1305 au lieu d'AES-GCM. |
-parano |
(enc) Double chiffrement en cascade. S'exclut avec -chacha. |
-kdf |
(enc) Coût de la dérivation : standard (défaut), fort ou maximum. |
-meta |
(enc) Métadonnées conservées : none (défaut) ou minimal (nom et date). |
-force |
(enc, dec) Écrase la destination si elle existe déjà. Sans lui, l'opération est refusée. Ne s'applique jamais à un dossier extrait. |
-mots |
(genpass) Nombre de mots de la phrase : 7 par défaut, de 6 à 12. |
-version |
Affiche la version. |
Une destination qui existe déjà est refusée par défaut : déchiffrer
doc.pdf.chtoà côté d'undoc.pdfsans rapport ne le détruit pas. Utilise-forcepour écraser volontairement. Un dossier extrait ne s'écrase jamais, même avec-force: cela voudrait dire supprimer une arborescence entière.
Chiffrer (crée document.txt.chto) :
chiffremento -mode enc -in document.txtDéchiffrer (recrée document.txt) :
chiffremento -mode dec -in document.txt.chtoChiffrer un dossier (crée photos.chto, qui contient toute l'arborescence) :
chiffremento -mode enc -in photosLe déchiffrer recrée le dossier photos, qui ne doit pas déjà exister :
chiffremento -mode dec -in photos.chtoContrôler qu'une sauvegarde est intacte et déchiffrable, sans rien écrire sur le disque :
chiffremento -mode verify -in sauvegarde.tar.gz.chtoMesurer les coûts sur cette machine, pour choisir un profil en connaissance de cause :
chiffremento -mode benchRenforcer la dérivation de clé :
chiffremento -mode enc -in secret.pdf -kdf fortConserver le nom et la date d'origine à l'intérieur du chiffré, pour pouvoir sortir sous un nom neutre :
chiffremento -mode enc -in rapport-medical.pdf -out a3f9c2.chto -meta minimalAu déchiffrement, le nom n'est lisible qu'une fois le contenu authentifié : la ligne de commande l'affiche sans renommer d'autorité, l'interface guidée propose de rendre son nom au fichier. Sous Windows, un nom légal ailleurs — rapport 2024?.pdf, aux.txt — est adapté aux règles du système, et l'interface montre le nom exact avant de renommer.
Inspecter un fichier sans le déchiffrer ni saisir de mot de passe :
chiffremento -mode info -in document.txt.chtoChanger le mot de passe sans re-chiffrer le contenu — l'ancien est demandé, puis le nouveau :
chiffremento -mode passwd -in document.txt.chtoLe fichier doit être en format v4 : dans les formats précédents la clé du contenu vient du mot de passe, donc en changer revient à tout re-chiffrer. -mode info dit de quel format il s'agit.
Le temps du remplacement, l'ancien en-tête est déposé à côté sous document.txt.chto.entete-precedent, puis retiré. C'est le filet contre une écriture interrompue : une coupure au mauvais moment laisserait sinon un en-tête ni ancien ni nouveau, et un fichier qu'aucun mot de passe n'ouvrirait. S'il subsiste après une interruption, ne pas le remettre en place à l'aveugle — vérifier d'abord lequel des deux mots de passe ouvre le fichier avec -mode verify.
Mode parano avec compression :
chiffremento -mode enc -in backup.db -parano -compÉcrire ailleurs que dans le dossier de la source :
chiffremento -mode enc -in photos -out /volumes/sauvegarde/photos.chtoMasquer la taille réelle du fichier :
chiffremento -mode enc -in contrat.pdf -padTrois largeurs de palier au choix. Ce qui compte n'est pas la taille du palier, mais le nombre de fichiers qui sortent à la même taille — mesuré sur des fichiers de 7,5 à 7,9 Mo :
-pad-niveau |
tailles distinctes obtenues | surcoût maximal |
|---|---|---|
standard (défaut) |
7 606 005 · 7 737 141 · 7 868 277 · 7 999 413 | ~12 % |
fort |
7 606 005 · 7 868 277 · 8 130 549 | ~25 % |
maximum |
8 392 821 — une seule | ~100 % |
chiffremento -mode enc -in contrat.pdf -pad -pad-niveau maximumLe palier reste proportionnel à la taille à tous les niveaux : un pas fixe — arrondir tout le monde au multiple de 10 Mo supérieur — gonflerait un fichier de 3 Ko d'un facteur mille et ne masquerait plus rien à 1,4 Go, où 10 Mo ne pèsent plus que 0,7 %. Ajouter de l'aléa au remplissage serait contre-productif pour la même raison inverse : un palier fixe met tout un intervalle sur une valeur unique, alors qu'un tirage disperse les tailles à l'intérieur du palier et redonne à un observateur de quoi séparer deux fichiers.
Lister une sauvegarde de dossier sans l'extraire, en passant le tar à tar :
chiffremento -mode dec -in photos.chto -out - | tar tf -Depuis un script, le mot de passe se fournit sur l'entrée standard :
echo "$MOT_DE_PASSE" | chiffremento -mode enc -in backup.dbAvec
-in -, l'entrée standard porte les données : le mot de passe est alors demandé sur le terminal (/dev/tty). Sans terminal, l'outil refuse plutôt que de lire la première ligne des données comme mot de passe.
magic 8 o "CHFRMT03"
version 1 o 1 à 3 (anciens), 4 (courant)
flags 1 o bit 0 = compressé (v1/v2), bit 1 = archive tar, bit 2 = rempli,
bit 3 = métadonnées
algo 1 o 1 = AES-GCM, 2 = ChaCha20-Poly1305, 3 = cascade
argonTime 4 o uint32 big-endian ┐
argonMemory 4 o uint32 big-endian (KiB) ├ v2 et suivantes
argonPar 1 o uint8 ┘
compAlgo 1 o 0 = aucune, 1 = gzip (lu, plus écrit), 2 = zstd ─ v3 et suivantes
salt 16 o
commit 32 o engagement sur la clé maîtresse ┐
wrappedDEK 48 o clé du fichier, scellée ┘ v4
Dérivation en v4. masterKey = Argon2id(mot de passe, sel, paramètres), puis trois usages séparés par HKDF-Expand, chacun sous son étiquette :
| Sortie | Rôle |
|---|---|
commit (32 o) |
écrit dans l'en-tête, comparé en temps constant avant tout déchiffrement |
kek + nonce (44 o) |
ouvre l'enveloppe qui contient la clé du fichier |
| — | les clés du contenu, elles, viennent de la DEK, tirée au hasard par fichier |
Deux propriétés en découlent :
- Engagement de clé. AES-GCM et ChaCha20-Poly1305 ne sont pas engageants : on peut fabriquer un chiffré valide sous plusieurs clés, ce qu'exploitent les attaques par oracle de partitionnement. Le tag
commitferme cette porte, et rend au passage un message clair — « mot de passe incorrect » — au lieu d'une erreur d'authentification survenue au milieu du fichier. - Changement de mot de passe instantané. La clé du contenu ne dépend plus du mot de passe :
-mode passwdréécrit les 117 octets d'en-tête, quelle que soit la taille du fichier.
L'en-tête reste authentifié : il sert de données associées (AAD) au scellement de l'enveloppe, donc en modifier un octet — version, algorithme, sel, engagement — empêche l'ouverture. C'est ce qui remplace, en v4, le liage par HKDF des versions 2 et 3.
Les fichiers en version 1, 2 et 3 sont relus avec leur dérivation d'origine. Les nouveaux fichiers sont toujours écrits en version 4.
La v3 remplace le drapeau de compression par un champ : un bit ne pouvait pas distinguer gzip de zstd, et empiler un bit par algorithme rendait possibles des états contradictoires. En v1 et v2, le bit 0 signifiait gzip — c'est le seul sens qu'il ait jamais eu, donc la relecture est directe. Un binaire plus ancien refuse un fichier v3 au lieu de l'interpréter de travers.
Les paramètres Argon2 sont inscrits dans chaque fichier, donc ajustables sans casser l'existant.
| Profil | Mémoire | Passes | Coût mesuré |
|---|---|---|---|
standard (défaut) |
256 Mio | 3 | ~140 ms |
fort |
512 Mio | 4 | ~350 ms |
maximum |
1 Gio | 4 | ~730 ms |
Le déchiffrement exige la même mémoire que le chiffrement. Un fichier scellé en
maximumsera indéchiffrable sur une machine qui n'a pas 1 Gio à consacrer à la dérivation.chiffremento -mode benchmesure les trois profils sur votre machine et conseille le plus robuste qui reste raisonnable, en tenant compte de cette contrainte.
Ce que l'outil protège :
- le contenu d'un fichier au repos : disque volé, sauvegarde envoyée sur un service tiers, clé USB perdue ;
- l'intégrité : toute modification du contenu chiffré ou de l'en-tête est détectée, le déchiffrement échoue.
Ce que l'outil ne protège pas :
- le nom du fichier :
secret.pdf.chtoannonce son contenu ; - la taille : elle suit celle du fichier d'origine, à quelques dizaines d'octets près ;
- les métadonnées : dates et permissions d'origine ne sont pas conservées ;
- sous Windows, les fichiers produits ne sont pas restreints en
0600: le système n'a pas de bits de permission POSIX et l'accès y dépend des ACL, que cet outil ne touche pas. Sur macOS et Linux, la restriction est bien appliquée ; - avec
-comp, la compressibilité du contenu fuit à travers la taille finale ; - une machine compromise : keylogger, mémoire lue par un autre processus, fichier d'origine encore présent sur le disque après chiffrement.
La solidité dépend entièrement de la force du mot de passe. Argon2id rend chaque tentative coûteuse (~150 ms), mais un mot de passe court reste cassable. Utilisez une phrase de passe longue.
Le mode parano ne remplace pas un bon mot de passe : il protège contre la découverte d'une faiblesse dans un seul des deux algorithmes, rien d'autre.
MIT — voir LICENSE. Les composants et données de tiers (zxcvbn, liste de mots Tails/Tor, prénoms et noms de l'Insee) sont crédités dans NOTICE.
Chiffremento CLI is a command-line tool written in Go for encrypting and decrypting files. It offers a guided interface, or flags for scripting.
Running chiffremento now opens a real full-screen application, and the strength meter knows French. Releases are also signed, so you can check they come from the repository.
The file format does not change: it stays at v4.
.chtofiles created with earlier versions open as before.
- 🖥️ Full-screen interface. One screen filling the terminal, with a top bar (the operation and the step) and a bottom bar (the useful keys). After each operation you return to the menu: no need to relaunch the program.
Escabandons the current operation,qquits,?shows help,oforgets the kept passphrase. A card sums up the result. On failure, an error screen gives the cause and a short piece of advice (wrong passphrase, damaged file, permission denied…). - 🧠 Passphrase kept for the session, on request. After a successful operation, the interface asks whether to keep the passphrase for the next one ("no" by default). It is forgotten after 5 minutes without a keypress, with
o, or on exit. Only the passphrase is kept, never the derived key. - 📊 French-aware strength meter. It recognises French words and INSEE first and last names, with or without accents.
zxcvbn, the calculation that estimates how many guesses it takes to crack a password, is now an internal copy. It fixes defects of the original with accented characters: a password could be estimated at 0 guesses, andandréwas not recognised as a word. - 🪶 Lighter. The binary goes from 8,348,898 to 6,312,914 bytes. Running
-versionneeds ~4.2 MB of memory instead of ~15.5 MB: the word lists are only loaded at the first strength estimate. - 🔏 Signed releases. Every release contains a signature of
checksums.txt(made withcosign, a signing tool), the list of embedded libraries (SBOM) and a provenance attestation.install.shchecks the signature whencosignis installed. See Verify a release. - 🛡️ Reliability.
- No decrypted temporary file is left on disk after Ctrl+C, closing the window or a crash.
- The password copy is wiped from memory before exit.
- Password input: two pieces of code could read and write the input at the same time (a "data race"). This is fixed for the password and its confirmation.
Escin the file browser goes up one folder, instead of submitting with no file.
The file format does not change: it stays at v4.
- 🎲 Generated passphrase. At the password step, the interface offers a random 7-word French passphrase of about 128 bits. It is shown masked, can be revealed or copied, and the interface asks for confirmation that it has been saved before encrypting. On the command line:
-mode genpass [-mots N]. - 🪶 Lighter. Argon2's memory goes back to the system as soon as the key is derived: while processing a large file, the footprint drops from 272 to 17 MB, and
-mode passwdfrom 528 to 272 MB. Archiving or extracting a 5,000-file folder uses about 90 MB less, and the idle interface does 40% less work. - ⚡ Fast and safe folder extraction. Every extracted file is now synced to disk, without the cost of a full sync per file on macOS: 0.55 s for 5,000 small files instead of ~17 s. On volumes that cannot sync (exFAT, SMB, NFS), extraction no longer fails.
- 🛡️ Reliability.
- Ctrl+C interrupts the progress screen and restores the terminal during masked input.
- A source modified since encryption is never deleted, and the screen says why the source could not be recorded.
- Writing stays atomic when the input is a stream.
-out /dev/null, a named pipe or a symlink receive the bytes again. - An original name containing « : » is accepted with
-meta minimal. install.shrefuses an archive missing fromchecksums.txt.
The file format moved to v4 in this release. The two numbers are independent: the program version tracks its features, the format version tracks its binary layout.
chiffremento -mode infoshows a given file's format version. v1, v2 and v3.chtofiles stay decryptable.
- 🔐 Format v4 — key commitment: a 32-byte tag over the master key, checked before any decryption. A wrong password is reported as such instead of surfacing as an authentication failure at the end of the read, and partitioning-oracle attacks lose their footing.
- 📦 Format v4 — DEK/KEK envelope: the key that encrypts the contents is drawn at random and sealed inside the header. It no longer depends on the password, which is what makes the next item possible.
- 🔑
-mode passwd: change the password by rewriting 117 header bytes, whatever the file size. The contents are not read back. v4 files only: before that, the content key came from the password, so changing it meant re-encrypting everything. Note that the old password still opens any copy of the file predating the change — a backup, a snapshot: for a complete revocation, decrypt and re-encrypt. - ↩️ Going back in the guided interface:
↑↓move through the answers,→confirms,←returns to the previous decision — across screens, keeping the answers already given. In a text field and in the file browser, where←is already taken,shift+tabgoes back. - 🏷️ Original name restored: kept by
-meta minimal, it was stored but never surfaced. It is only readable once the contents are authenticated. - 🎭 Name and date scrambling for the produced file, in the guided interface: written under a random name —
3fb8db8ee5db3891.chto— and dated 1 January 2000. Decryption restores both. - 🗑️ Delete what was replaced, once the operation is done, in the guided interface: the original after an encryption, the
.chtoafter a decryption. An original is only erased after the ciphertext has been fully read back and authenticated. “Keep” is always the answer under the cursor. - 📏
-pad-niveau standard|fort|maximum: padding bucket width, from “a few percent” to “a whole octave comes out at the same size”.
The file format had moved to v3 in that release.
- 📁 Folders: encrypt a whole folder, packed into a tar stream as it is encrypted and recreated as-is on decryption.
- 🗜️ zstd: replaces gzip, measured ~8× faster at a comparable ratio. gzip is no longer produced, only read back: compressed v1 and v2
.chtofiles stay decryptable. Compression is now described by a header field rather than a single bit. - 📏
-pad: masks the real size of the contents by rounding up to the next bucket. - 🔗
-out,-in -,-out -: choose the destination, and use the standard streams to compose with other tools. - 🗂️ File browser in the guided interface, as an alternative to typing the path.
- 📊 Dictionary-based password strength:
azerty123is finally reported as weak. - 🔑 Derivation profiles:
-kdf standard|fort|maximum, from fastest to costliest to attack. - 🏷️
-meta minimal: keeps the original name and date inside the ciphertext, so output can use a neutral name. - 📊
-mode bench: measures the profiles and algorithm throughput on your machine, and advises a profile.
- 🖥️ Guided interface: running
chiffrementowith no arguments opens an interactive interface. Flags remain available for scripts. - 🛡️ Format v2: Argon2 parameters are now stored in the file, and the header is bound to the encryption key.
.chtofiles produced by 1.x versions remain decryptable. - 🔑 Stronger Argon2: 256 MiB instead of 32 MiB, roughly eleven times costlier to brute-force.
- 💾 Atomic writes: a failed decryption can no longer destroy an existing file.
- 🙈 No more
-keyflag: the password is never passed as an argument, so it no longer appears inpsor shell history. - 🔍
infocommand: inspect a.chtofile without a password and without decrypting it.
- 🔐 Authenticated encryption: AES-256-GCM (default) or ChaCha20-Poly1305, streamed through
minio/sio(DARE format). - 🔑 Key derivation: Argon2id, with parameters written into the file so they can be strengthened later without breaking old files.
- ⚡ Constant memory: encrypting a 100 GB file uses only a few megabytes of RAM.
- 📁 Files and folders: a folder is packed into a tar stream as it is encrypted — no intermediate archive on disk — and recreated as-is on decryption. Symlinks are rejected, and an archive can never write outside the destination folder.
- 📦 Compression: zstd, optional before encryption and offered pre-enabled for folders. It replaces gzip, measured ~8× faster at a comparable ratio; existing gzip files stay decryptable but are no longer produced.
- 📏 Size masking: the
-padoption rounds the size up to the next bucket (Padmé scheme), so a.chtono longer betrays the exact size of its contents. - 🔗 Composable:
-in -and-out -read from and write to the standard streams. - 📊 Realistic strength meter: password strength is scored by an internal copy of
zxcvbn, which recognises dictionary words (including French words and first and last names, accents included), dates and keyboard patterns.azerty123is reported at ~13 bits, not ~60. - 🎲 Generated passphrase: at the password step, the interface offers to generate a 7-word French passphrase, with capitals, separators and one digit drawn by
crypto/rand— about 128 bits. It is shown masked, can be revealed or copied to the clipboard, and the interface asks for confirmation that it has been saved before encrypting. Also on the command line:-mode genpass [-mots N]. Word list: the one compiled by Tango for Tails and the Tor Project (CC0). - 😱 Parano mode: cascaded double encryption (ChaCha20 outside, AES inside) with two independently derived keys via HKDF.
- 🔗 Authenticated header: version, flags, algorithm, Argon2 parameters, salt and key commitment all act as associated data for the envelope seal. Changing a single header byte makes decryption fail. Up to format v3, that binding went through key derivation itself.
brew tap ValMtp3/homebrew-tap
brew install --cask chiffrementoSince v2.0.0 distribution goes through a cask rather than a formula, as GoReleaser deprecated formulae. If you installed v1.x, uninstall it first with
brew uninstall chiffremento. Casks are macOS-only; on Linux, use the install script below.
- From the Releases page, download the archive for your system, the
checksums.txtfile, its signaturechecksums.txt.sigstore.json(required if cosign is installed) andinstall.sh, into the same folder. - Run:
bash install.shThe script verifies the signature (if cosign is installed), then the archive's SHA-256 checksum, before installing anything.
Each release contains checksums.txt (the checksums of every archive), its signature checksums.txt.sigstore.json, one SBOM per archive (the list of embedded libraries) and a provenance attestation. The CI signs without any key to keep: the signature proves the files come from this repository's workflow on a v* tag. To check it by hand, with cosign and the GitHub CLI:
cosign verify-blob --bundle checksums.txt.sigstore.json \
--certificate-identity-regexp '^https://github.com/ValMtp3/chiffremento-go-cli/.github/workflows/release.yml@refs/tags/v' \
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
checksums.txt
sha256sum --ignore-missing -c checksums.txt # macOS: shasum -a 256 --ignore-missing -c checksums.txt
gh attestation verify chiffremento_X.Y.Z_linux_amd64.tar.gz --repo ValMtp3/chiffremento-go-cli \
--signer-workflow ValMtp3/chiffremento-go-cli/.github/workflows/release.yml \
--source-ref refs/tags/vX.Y.ZRun these checks before bash install.sh: the script is itself the verifier, so check it first (its checksum is in checksums.txt, and the sha256sum line above covers it if install.sh is in the folder).
install.sh runs the first check itself, before reading the checksums:
- cosign installed and
checksums.txt.sigstore.jsonin the folder: the signature is verified against the identity above. If it fails, or if cosign cannot verify it (no network), installation is refused. A recent cosign is required: ≥ 2.6.2 (or ≥ 3.0.4 on v3). Below that the script refuses with "cosign trop ancien", out of caution: advisory GHSA-whqx-f9j3-ch6m describes a flaw that, under certain conditions (identity or key already compromised), prevents finding the signature's trace in the public log (Rekor). It does not make a forged signature accepted, and cosign v3 defaults are not affected; we keep the threshold anyway. - cosign missing: the script prints "signature non vérifiée : installe cosign pour plus de sûreté" and carries on. The SHA-256 checksum is still verified.
- cosign installed but
.sigstore.jsonfile missing: installation is refused, whatever the version (without a signature,checksums.txtproves nothing). Download the file from the same release page. For a release older than 2.4.0, which is not signed, use theinstall.shshipped with that release.
Without cosign, only the checksum is verified: nothing protects against a full replacement of the files (archive and
checksums.txt).
A bare binary (
chiffremento-<os>-<arch>, built bymake build-all) placed withoutchecksums.txt, or missing from that file, is installed unverified: the script only prints a warning ("Aucune empreinte disponible … installation non vérifiée"). A release archive, on the other hand, is refused if it is not listed inchecksums.txt.
make buildWith no arguments, in a terminal:
chiffrementoIt asks for the operation, then how to point at the target: type a path (or drag and drop it), or browse files. In the browser, ↑↓ move, → enters a folder, esc goes up a folder and enter selects.
Every decision follows the same grammar: ↑↓ move through the answers, → (or enter) confirms, ← goes back to the previous decision — across screens too, keeping the answers already given. In a text field and in the browser, where ← already has a job, going back is shift+tab.
It takes over the whole terminal, in a separate screen that the exit restores as it was: a bar at the top (chiffremento v2.4.0 · chiffrer › options, and ● phrase en mémoire on the right while a passphrase is kept), the frame in the middle (52 to 80 columns depending on the window), the keys of the current screen at the bottom. On a terminal that is too small, the bars disappear and the frame takes all the room. The menu comes back after every operation: a card shows the result, an error screen shows the cause and what to do, enter returns to the menu. You quit with the "quitter" line of the menu or with q. The full summaries of the session are then printed in the terminal.
Real captures (80×24 terminal, the binary run in a pseudo-terminal), the menu then the encryption options (the interface itself is in French):
chiffremento v2.4.0 · menu
┌──────────────────────────────────────────────────────────────────────────┐
│ ┃ opération │
│ ┃ > chiffrer un fichier ou un dossier │
│ ┃ déchiffrer un .chto (fichier ou dossier) │
│ ┃ vérifier un .chto (sans rien écrire) │
│ ┃ changer le mot de passe d'un .chto │
│ ┃ quitter │
│ │
│ désigner la cible │
│ saisir un chemin (ou glisser-déposer) │
│ parcourir les fichiers │
└──────────────────────────────────────────────────────────────────────────┘
↑↓ choisir → valider q quitter ? aide ctrl+c quitter
The options screen is cut at the bottom: the terminal is only 24 rows high, the interface scrolls to keep the active field visible.
chiffremento v2.4.0 · chiffrer › options
┌──────────────────────────────────────────────────────────────────────────┐
│ ┃ algorithme │
│ ┃ > aes-256-gcm (défaut) │
│ ┃ chacha20-poly1305 │
│ ┃ cascade chacha20 + aes (parano) │
│ │
│ coût de la dérivation de clé │
│ argon2id m=256MiB t=3 p=4 · 256 Mio de mémoire, exigés aussi au │
│ déchiffrement │
│ standard (défaut) │
│ fort │
│ maximum │
│ │
│ compresser avant chiffrement (zstd) │
│ réduit la taille, mais laisse fuiter la compressibilité du contenu │
│ oui │
│ non │
└──────────────────────────────────────────────────────────────────────────┘
↑↓ choisir → valider ← revenir ? aide ctrl+c quitter
And the password screen, with the strength indicator for "dupont" ("faible" means weak):
chiffremento v2.4.0 · chiffrer › options
┌──────────────────────────────────────────────────────────────────────────┐
│ ┃ mot de passe │
│ ┃ ~5 bits — faible, une phrase de passe serait bien plus sûre · cassé en │
│ ┃ quelques secondes hors ligne │
│ ┃ > ****** │
│ │
│ confirmation │
│ une faute de frappe rendrait le fichier définitivement irrécupérable │
│ > │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
└──────────────────────────────────────────────────────────────────────────┘
⏎ valider shift+tab revenir ? aide ctrl+c quitter
| Key | Role |
|---|---|
↑ ↓ |
move through the answers |
→ or ⏎ |
confirm |
← |
back to the previous decision |
shift+tab |
back, in a text field or the browser |
esc |
abandon the operation, back to the menu |
| in the browser: go up a folder | |
q |
quit, from the menu |
o |
forget the passphrase kept in memory, outside a text field |
? |
open or close this help |
ctrl+c |
quit right away |
Exit code of the session: 0 if everything succeeded, 1 if at least one operation failed, 130 on Ctrl+C, 129 if the terminal window is closed. Before it starts, an operation is abandoned without writing anything; esc does not cut a write that is already running.
After a successful operation with a typed or generated passphrase, it asks whether to keep the passphrase for the session ("ne pas la garder" by default). If yes, it is offered at the next prompt: ⏎ uses it, or you retype it. It is forgotten, bytes zeroed, after 5 minutes without a key (on the wall clock and on the monotonic clock, so also after a sleep), by o, and on exit. Only the passphrase is kept, never a derived key: Argon2 runs on every operation. Memory is not locked: like any typed passphrase, it can be written to the system's swap file.
With -mode …, or when input or output is not a terminal, nothing changes: no separate screen, the output stays plain.
When encrypting, once the original name and date are kept inside the ciphertext, it offers to scramble those of the file it writes: a randomly drawn name — 3fb8db8ee5db3891.chto — dated 1 January 2000. Decryption restores both. The creation date stays that of the actual write: no userspace call changes it, so the scrambling hides the date from an ordinary look, not from an inspection of the filesystem.
When size masking is on, it also asks for the bucket width, showing what each step costs on this file: "7.2 Mo → environ 8.0 Mo (+11.8 %) · tout ce qui pèse de 4.0 Mo à 8.0 Mo sort identique".
Once the operation is done, it finally offers to delete what it replaces: the original after encryption, the .chto after decryption. An original is only erased after the ciphertext has been read back and fully authenticated — the original is the only other copy. "Keep" is always the answer under the cursor, and deleting removes the directory entry without wiping the data from the medium.
chiffremento -mode <enc|dec|verify|info|passwd> -in <file> [options]The password is never an argument. It is prompted for with masked input, or read from standard input when that is not a terminal.
| Flag | Description |
|---|---|
-mode |
Required. enc (encrypt), dec (decrypt), verify (check without writing anything), info (inspect the header), passwd (change the password), bench (measure costs) or genpass (generate a passphrase, no -in). |
-in |
Required. Input file or folder, or - for standard input. |
-out |
Destination. Defaults to the input plus .chto for enc, the input without the extension for dec. - writes to standard output. |
-comp |
(enc) Enables zstd compression. |
-pad |
(enc) Masks the real size. Mutually exclusive with -comp. |
-pad-niveau |
(enc) Bucket width: standard (default), fort or maximum. Requires -pad. |
-chacha |
(enc) Uses ChaCha20-Poly1305 instead of AES-GCM. |
-parano |
(enc) Cascaded double encryption. Mutually exclusive with -chacha. |
-kdf |
(enc) Key derivation cost: standard (default), fort or maximum. |
-meta |
(enc) Metadata kept: none (default) or minimal (name and date). |
-force |
(enc, dec) Overwrites the destination if it already exists. Without it, the operation is refused. Never applies to an extracted folder. |
-mots |
(genpass) Number of words in the passphrase: 7 by default, from 6 to 12. |
-version |
Prints the version. |
An existing destination is refused by default: decrypting
doc.pdf.chtonext to an unrelateddoc.pdfwill not destroy it. Use-forceto overwrite deliberately. An extracted folder is never overwritten, even with-force: that would mean deleting an entire tree.
Encrypt (creates document.txt.chto):
chiffremento -mode enc -in document.txtDecrypt (recreates document.txt):
chiffremento -mode dec -in document.txt.chtoEncrypt a folder (creates photos.chto, holding the whole tree):
chiffremento -mode enc -in photosDecrypting it recreates the photos folder, which must not already exist:
chiffremento -mode dec -in photos.chtoCheck that a backup is intact and decryptable, without writing anything to disk:
chiffremento -mode verify -in backup.tar.gz.chtoMeasure costs on this machine, to pick a profile knowingly:
chiffremento -mode benchStrengthen key derivation:
chiffremento -mode enc -in secret.pdf -kdf fortKeep the original name and date inside the ciphertext, so you can output under a neutral name:
chiffremento -mode enc -in medical-report.pdf -out a3f9c2.chto -meta minimalOn decryption the name is only readable once the content is authenticated: the command line prints it without renaming anything, while the guided interface offers to give the file its name back. On Windows, a name that is legal elsewhere — rapport 2024?.pdf, aux.txt — is adapted to the system's rules, and the interface shows the exact name before renaming.
Inspect a file without decrypting it or entering a password:
chiffremento -mode info -in document.txt.chtoChange the password without re-encrypting the contents — the old one is asked for, then the new one:
chiffremento -mode passwd -in document.txt.chtoThe file must be in format v4: in earlier formats the content key comes from the password, so changing it amounts to re-encrypting everything. -mode info reports the format.
While the header is being replaced, the previous one is written next to the file as document.txt.chto.entete-precedent, then removed. It is the safety net against an interrupted write: without it, a badly timed power cut would leave a header that is neither the old nor the new one, and a file no password could open. If it survives an interruption, do not restore it blindly — first check which of the two passwords opens the file, with -mode verify.
Parano mode with compression:
chiffremento -mode enc -in backup.db -parano -compWrite somewhere other than next to the source:
chiffremento -mode enc -in photos -out /volumes/backup/photos.chtoMask the real file size:
chiffremento -mode enc -in contract.pdf -padThree bucket widths. What matters is not the bucket size but how many files come out at the same size — measured on files from 7.5 to 7.9 MB:
-pad-niveau |
distinct sizes produced | maximum overhead |
|---|---|---|
standard (default) |
7,606,005 · 7,737,141 · 7,868,277 · 7,999,413 | ~12 % |
fort |
7,606,005 · 7,868,277 · 8,130,549 | ~25 % |
maximum |
8,392,821 — a single one | ~100 % |
chiffremento -mode enc -in contract.pdf -pad -pad-niveau maximumThe bucket stays proportional to the size at every level: a fixed step — rounding everything up to the next 10 MB — would inflate a 3 KB file a thousandfold and mask nothing at 1.4 GB, where 10 MB is only 0.7 %. Adding randomness to the padding would be counter-productive for the mirror reason: a fixed bucket collapses a whole interval onto one value, whereas a random draw spreads sizes inside the bucket and hands an observer a way to tell two files apart again.
List a folder backup without extracting it, by piping the tar into tar:
chiffremento -mode dec -in photos.chto -out - | tar tf -From a script, supply the password on standard input:
echo "$PASSWORD" | chiffremento -mode enc -in backup.dbWith
-in -, standard input carries the data, so the password is asked for on the terminal (/dev/tty). With no terminal available, the tool refuses rather than reading the first line of your data as the password.
magic 8 B "CHFRMT03"
version 1 B 1 to 3 (legacy), 4 (current)
flags 1 B bit 0 = compressed (v1/v2), bit 1 = tar archive, bit 2 = padded,
bit 3 = metadata
algo 1 B 1 = AES-GCM, 2 = ChaCha20-Poly1305, 3 = cascade
argonTime 4 B uint32 big-endian ┐
argonMemory 4 B uint32 big-endian (KiB) ├ v2 onwards
argonPar 1 B uint8 ┘
compAlgo 1 B 0 = none, 1 = gzip (read-only), 2 = zstd ─ v3 onwards
salt 16 B
commit 32 B commitment to the master key ┐
wrappedDEK 48 B file key, sealed ┘ v4
v4 derivation. masterKey = Argon2id(password, salt, params), then three separate uses via HKDF-Expand, each under its own label:
| Output | Role |
|---|---|
commit (32 B) |
written in the header, compared in constant time before any decryption |
kek + nonce (44 B) |
opens the envelope holding the file key |
| — | the content keys come from the DEK, drawn at random per file |
Two properties follow:
- Key commitment. AES-GCM and ChaCha20-Poly1305 are not committing: one can craft a ciphertext valid under several keys, which is what partitioning oracle attacks exploit. The
committag closes that door, and incidentally returns a clear message — "wrong password" — instead of an authentication error hit midway through the file. - Instant password change. The content key no longer depends on the password:
-mode passwdrewrites the 117-byte header, whatever the file size.
The header stays authenticated: it is the associated data (AAD) of the envelope seal, so changing one byte — version, algorithm, salt, commitment — prevents it from opening. That replaces, in v4, the HKDF binding used by versions 2 and 3.
Version 1, 2 and 3 files are read back with their original derivation. New files are always written as version 4.
Argon2 parameters are written into every file, so they can be raised without breaking existing ones.
| Profile | Memory | Passes | Measured cost |
|---|---|---|---|
standard (default) |
256 MiB | 3 | ~140 ms |
fort |
512 MiB | 4 | ~350 ms |
maximum |
1 GiB | 4 | ~730 ms |
Decryption requires the same memory as encryption. A file sealed with
maximumwill be undecryptable on a machine that cannot spare 1 GiB for derivation.chiffremento -mode benchmeasures all three on your machine and advises the strongest that stays reasonable, taking that constraint into account.
What this tool protects:
- the contents of a file at rest: stolen disk, backup uploaded to a third party, lost USB drive;
- integrity: any modification of the ciphertext or the header is detected and decryption fails.
What it does not protect:
- the filename:
secret.pdf.chtoadvertises its own contents; - the size: it tracks the original file's size within a few dozen bytes;
- metadata: original timestamps and permissions are not preserved;
- on Windows, output files are not restricted to
0600: the system has no POSIX permission bits and access is governed by ACLs, which this tool does not touch. On macOS and Linux the restriction is applied; - with
-comp, the content's compressibility leaks through the final size; - a compromised machine: keyloggers, memory read by another process, or the original file still sitting on disk after encryption.
Security depends entirely on password strength. Argon2id makes each attempt expensive (~150 ms), but a short password is still crackable. Use a long passphrase.
Parano mode is not a substitute for a good password: it guards against a weakness being found in one of the two algorithms, nothing more.
MIT — see LICENSE. Third-party components and data (zxcvbn, the Tails/Tor word list, INSEE first and last names) are credited in NOTICE.