简体   繁体   English

带文件的框,从Windows无法看到

[英]box with files, which cannot be seen from Windows

Good day, is there any option how to create a box, which cannot be seen from Windows? 美好的一天,有什么选择如何创建一个从Windows无法看到的盒子? I would like to insert some files into this box. 我想在这个框中插入一些文件。 These files should be accessible only through my application, not from Windows. 这些文件只能通过我的应用程序访问,而不能从Windows访问。 Thank you in advance. 先感谢您。

How many files and how do you need to access them? 有多少文件,您需要如何访问它们? If they are only for reading and you don't have too many, you always have the option to store them as a resource in your project. 如果它们仅用于阅读而您没有太多,则您始终可以选择将它们存储为项目中的资源。 Have a look at this link on MSDN on how to store various file types directly inside your assembly. 在MSDN上查看如何直接在程序集中存储各种文件类型的链接

NOTE: If you are planning on storing passwords or security-sensitive data, you shouldn't use this approach. 注意:如果您计划存储密码或安全敏感数据,则不应使用此方法。

Another alternative would be to store you files inside a database. 另一种方法是将文件存储在数据库中。 If you were to use something such as SQLite ( here is the .Net data provider ), Windows would have access to the database file, but not to the files contained within the database (which could be encrypted). 如果您要使用诸如SQLite这里是.Net数据提供程序 )之类的东西,Windows将可以访问数据库文件,但不能访问数据库中包含的文件(可以加密)。 Depending on your data, you'd have to store the file information as a binary large object (blob). 根据您的数据,您必须将文件信息存储为二进制大对象(blob)。 See here for an example of how to do this. 请参阅此处以获取如何执行此操作的示例。

It depends on the layer of abstraction you want. 这取决于你想要的抽象层。 All files created by an application are at some level accessible by windows, however, you can mask the content of these files (ie encrypt them). 应用程序创建的所有文件都可以通过Windows访问某些级别,但是,您可以屏蔽这些文件的内容(即加密它们)。

Generally speaking, you could still store the files in a folder, and apply encryption. 一般来说,您仍然可以将文件存储在文件夹中,并应用加密。 Here's the msdn article on the point. 这是关于这一点的msdn文章 The other issue is where do you store the key used for encryption. 另一个问题是您在哪里存储用于加密的密钥。

A simple solution is to hard-code the key in some variable. 一个简单的解决方案是在一些变量中对密钥进行硬编码。 However, if the assembly is decompiled, the key will become apparent. 但是,如果组件被反编译,密钥将变得明显。 On the other hand, if you want the user that created the files to begin with, to be the only one to access the files, then you can use the Data Protection API . 另一方面,如果您希望创建文件的用户开始,则只能访问文件,那么您可以使用Data Protection API

如果您的问题是如何隐藏框,那么无论您对此“框”使用何种控件,都可以将“可见”属性设置为false。

if your box does not include a lot of files or not large file, you can try save it in a compress file like .zip and add a password for it. 如果您的盒子不包含大量文件或不包含大文件,您可以尝试将其保存在.zip等压缩文件中并为其添加密码。 also add the hidden attribute on that box. 还要在该框中添加隐藏属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM