J'aimerais récupéré l'état d'avancement du chiffrement du fichier, j'ai tenté des petits trucs avec des while pour récupéré le nombre de bytes écrits mais du coup je n'arrive plus à utiliser la fonction de déchiffrement :
private void DecryptFile(string source, string destination, string sKey)
{
DESCryptoServiceProvider DES = new DESCryptoServiceProvider();
//A 64 bit key and IV is required for this provider.
//Set secret key For DES algorithm.
DES.Key = ASCIIEncoding.ASCII.GetBytes(sKey);
//Set initialization vector.
DES.IV = ASCIIEncoding.ASCII.GetBytes(sKey);
//Create a file stream to read the encrypted file back.
FileStream fsread = new FileStream(source,
FileMode.Open,
FileAccess.Read);
//Create a DES decryptor from the DES instance.
ICryptoTransform desdecrypt = DES.CreateDecryptor();
//Create crypto stream set to read and do a
//DES decryption transform on incoming bytes.
CryptoStream cryptostreamDecr = new CryptoStream(fsread,
desdecrypt,
CryptoStreamMode.Read);
//Print the contents of the decrypted file.
StreamWriter fsDecrypted = new StreamWriter(destination);
fsDecrypted.Write(new StreamReader(cryptostreamDecr).ReadToEnd());
fsDecrypted.Flush();
fsDecrypted.Close();
}
Du coup j'aimerais récupéré l'avancement du chiffrement ou du déchiffrement peut importe la forme tant que cela peut être fait pendant le chiffrement ou le déchiffrement.
Pouvez-vous nous donner le code que vous avez fait ?
Je ne vois pas pourquoi l'interpolation d'une valeur changerait le flux en sortie.
Je recherche un CDI/CDD/mission freelance comme Architecte Logiciel/ Expert Technique sur technologies Microsoft.
Progression écriture CryptoFileStream
× Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
× Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
Corentin-Aryox