J'ai un outil de cryptage pour crypter le fichier, quand j'étudie le fichier crypté, a trouvé qu'il écrit le nom de fichier .PEM dans le fichier crypté.File_Decryption - JUNK Caractère trouvé dans le fichier décrypté
I found encryption logic is commonly used as below,
it supporting encryption of any file, it means RSA keys can not be use for encryption so here
it is creating a key(K) and encrypt it with RSA public key and then using key(K) for encrypting the file.
J'écris C# Code ci-dessous, il est bien, mais pour le grand fichier me fais un peu de caractère indésirable au milieu comme,
aaaaaaaaaaaaaaaa
??M'yaaaaaaaaaa?
mon code de déchiffrement est comme: -
System.Security.Cryptography.TripleDESCryptoServiceProvider tripleDES = new System.Security.Cryptography.TripleDESCryptoServiceProvider();
tripleDES.Key = result; // 16 byte of key
tripleDES.Mode = System.Security.Cryptography.CipherMode.CBC;
byte[] IV = { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00 };
tripleDES.IV = IV;
tripleDES.Padding = System.Security.Cryptography.PaddingMode.Zeros;
System.Security.Cryptography.ICryptoTransform cTransform = tripleDES.CreateDecryptor();
byte[] resultArray = cTransform.TransformFinalBlock(enc_data, 0, enc_data.Length);
//string s = Convert.ToBase64String(resultArray);
string x = System.Text.Encoding.ASCII.GetString(resultArray);
System.IO.File.WriteAllText(@"D:\570_f.txt", x);
tripleDES.Clear();
1) -code fonctionne très bien presque mais quelque part je trouvé 8 octets de caractère indésirable en remplacement du texte réel. [principal problème]
.................okokokookokok8bytejunkokokokokokokookko..............8bytjunkokokokokokokokokokoko............
2) - ne savent pas ce système utilise un rembourrage au cours du processus de cryptage, j'ai essayé le déchiffrement avec zéro mode de remplissage.
----testing with different length file-----
(A)
input_file |encrypted_file with_tool | decrypted_file_with_above_code
10224 byte | x | 10232 byte
ok data + last 8 hex byte 3F 00 00 00 00 00 00 00
(b)
input_file |encrypted_file with_tool | decrypted_file_with_above_code
10242 byte | x | 10248 byte
ok data + last 8 hex byte 0D 3F 3F 3F 3C 56 31 65
(C)
input_file |encrypted_file with_tool | decrypted_file_with_above_code
10258 byte | x | 10264 byte
ok data + last 24 hex byte
0A 3F 3F 14 4D 27 79 0F 61 61 61 61 61 61 61 61
61 61 3F 00 00 00 00 00
NOTE - FICHIER CONTIENT caractère seulement (HEX VALUE = 61) des conseils ici serait formidable d'entendre