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.
chiffrer: encrypt a file with the specified keydechiffrer: decrypt a file with the specified keyKeygen: generate a new key for the chosen algorithm
- 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
- 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
- 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
- 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
Racine/input.txt: file to be encrypted or signedRacine/output.txt: output file for encrypted/decrypted textRacine/signature.txt: file containing the digital signatureCLES/cle_aes,CLES/cle_des,CLES/cle_rsa,CLES/cle_rsa.pub,CLES/cle_dsa,CLES/cle_dsa.pub: key files generated or used
- 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
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.
It is IMPOSSIBLE to decrypt data encrypted with Triple DES using AES, and vice versa.
Reasons:
- Different algorithms: DES and AES use completely different mathematical operations
- Different block sizes: DES uses 64-bit blocks, AES uses 128-bit blocks
- Different key sizes: DES uses 56-bit keys (or 168 bits for Triple DES), AES uses 128, 192, or 256-bit keys
- 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.