public string getEncryptedFilePath() { var ne = new NameEncoder.NameEncoder(); // Obfuscate the name var file_name = file_path.Split('\\').Last(); var str = ne.Encode(file_name); encrypted_file_path = file_path.Replace(file_name, str); return encrypted_file_path; }
public StorageObject(string storage_dir, string storage_file_name, bool is_dir) { if (!is_dir) { var ne = new NameEncoder.NameEncoder(); this.file_path = ne.Decode(storage_file_name); } else { this.file_path = storage_file_name; } this.storage_dir = new List<string>(){storage_file_name}; encrypted_file_path = null; }
public void DownloadFile(List<string> storage_path, string file_path) { var enc = new TwoFishEncryption(conf); var ne = new NameEncoder.NameEncoder(); var str = ne.Encode(storage_path[0]); string tmp = System.IO.Path.GetTempPath(); // Download the file first dropBoxStorage.DownloadFile("/" + str, tmp); // Then decrypt it and save to the right dir byte[] decrypted_file = enc.Decrypt(File.ReadAllBytes(tmp+str)); File.WriteAllBytes(file_path, decrypted_file); File.Delete(tmp + str); }