Skip to content

This program allows encrypting, decrypting, signing, and verifying files using various cryptographic algorithms (AES, DES, RSA, DSA). It runs as a command-line tool and uses files for inputs, outputs, and keys.

Notifications You must be signed in to change notification settings

Zyphorah/CryptoConsoleManager

Repository files navigation

User manual

Overview

This program allows encrypting, decrypting, signing, and verifying files using various cryptographic algorithms (AES, DES, RSA, DSA). It runs as a command-line tool and uses files for inputs, outputs, and keys.

General commands

  • chiffrer : encrypt a file with the specified key
  • dechiffrer : decrypt a file with the specified key
  • Keygen : generate a new key for the chosen algorithm

Command syntax

AES

  • Encryption:
    dotnet run -- aes chiffrer <input_file> <key_file> <output_file>
  • Decryption:
    dotnet run -- aes dechiffrer <input_file> <key_file> <output_file>
  • Key generation:
    dotnet run -- aes Keygen

DES

  • Encryption:
    dotnet run -- des chiffrer <input_file> <key_file> <output_file>
  • Decryption:
    dotnet run -- des dechiffrer <input_file> <key_file> <output_file>
  • Key generation:
    dotnet run -- des Keygen

RSA

  • Encryption:
    dotnet run -- rsa chiffrer <input_file> <public_key> <output_file>
  • Decryption:
    dotnet run -- rsa dechiffrer <input_file> <private_key> <output_file>
  • Key generation:
    dotnet run -- rsa Keygen

DSA (Signature)

  • Signing:
    dotnet run -- dsa chiffrer <input_file> <private_key> <signature_file>
  • Verification:
    dotnet run -- dsa dechiffrer <input_file> <public_key> <signature_file>
  • Key generation:
    dotnet run -- dsa Keygen

File details

  • Racine/input.txt : file to be encrypted or signed
  • Racine/output.txt : output file for encrypted/decrypted text
  • Racine/signature.txt : file containing the digital signature
  • CLES/cle_aes, CLES/cle_des, CLES/cle_rsa, CLES/cle_rsa.pub, CLES/cle_dsa, CLES/cle_dsa.pub : key files generated or used

Example

AES

  • Encryption:
    dotnet run -- aes chiffrer Racine/input.txt CLES/cle_aes Racine/output.txt
  • Decryption:
    dotnet run -- aes dechiffrer Racine/output.txt CLES/cle_aes Racine/input.txt
  • Key generation:
    dotnet run -- aes Keygen

Theoretical questions

1. Initialization Vector (IV)

An initialization vector (IV) is a random or pseudo-random value used with symmetric encryption algorithms to ensure that encrypting the same message with the same key produces different ciphertexts each time.

Role of the IV:

  • Ensures uniqueness: same message + same key = different ciphertexts
  • Prevents frequency analysis attacks
  • Prevents detection of repeating patterns in the encrypted data
  • Must be unique for each encryption operation
  • Does not need to be secret but should be unpredictable

In AES and DES, the IV is combined with the first data block before encryption.

2. Incompatibility between DES and AES

It is IMPOSSIBLE to decrypt data encrypted with Triple DES using AES, and vice versa.

Reasons:

  1. Different algorithms: DES and AES use completely different mathematical operations
  2. Different block sizes: DES uses 64-bit blocks, AES uses 128-bit blocks
  3. Different key sizes: DES uses 56-bit keys (or 168 bits for Triple DES), AES uses 128, 192, or 256-bit keys
  4. Different internal structures: the encryption rounds, S-boxes, and permutations are specific to each algorithm

Result: attempting to decrypt with the wrong algorithm will produce corrupted data or an exception.

About

This program allows encrypting, decrypting, signing, and verifying files using various cryptographic algorithms (AES, DES, RSA, DSA). It runs as a command-line tool and uses files for inputs, outputs, and keys.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages