热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

文件加密标识-OSR经典对白

文件加密标识-OSR经典对白

文件加密标识 -OSR经典对白






第一篇
FS Filter Driver question
________________________________________
Dear NTDev folks,

We are writing a FileSystem Filter Driver, that mangles the contents of
a particular file, such that:
1) the content is Mangled on Write, and
2) Unmangled on Read.

Our Mangling actually increases the size of the file, and we also insert
our own header data in the beginning of the file.

However we still want to present the "correct" file-length to the client
programs (e.g. they shouldn't know that the data is actually mangled
before it's stored in the file).

We have been able to do this, to some degree, by handling the Read/Write
IRPs, and modifying the length fields in the QueryInformation IRPs (for
both File Information, and Directory Listings).

However, we are worried that interactions between the underlying
FileSystem Driver, and the Cache Manager may expose the real length of
the file in some cases (e.g. through the FileSize field in the
FSRTL_FCB_COMMON_HEADER structure stored in the FsContext field of the
FileObject), or cause other problems.  We are not able to find a good
discussion on Data Modifying filter drivers in the IFS kit documentation
or in the "Windows NT File System Internals" Book by Rajeev Nagar.

FileSystem Filter Drivers that do non-length-preserving Encryption or
Compression must face the same issues that we are coming across.  We
would really appreciate it if you folks could shed some light on how the
cache manager may affect FileSystem Filter Drivers that mangle the
content of the file such that the actual file length changes, or if you
could suggest some resources where this information is available.

Re: FS Filter Driver question
________________________________________
Why put the "header" at the beginning?  It is the most difficult place to put it
and maintain any semblance of obfuscation.  Put it at the end and give yourself
enough space to permit expanding it easily.  I would recommend that the last
128, 256, 512, etc bytes be the "header/trailer".  If expansion becomes required
later, you can expand downwards from that fixed part of the header that will let
you know the file is yours.

The following are questions you need to answer before you design your solution:

1.    Can the file be accessed in "mangled" form by any program, at any time? 
Backup?
2.    Can the file be modified by any of the Microsoft Office programs?
3.    Why do you care if one program "knows" the file size if wrong?  What can
be revealed?



Re: FS Filter Driver question
________________________________________
I don't see any problem with FCB's FileSize having bigger value than what
you report through other interfaces.
However, I must agreed with David that having header at the beginning of
the file is not the best solution. The only significant advantage
I can see is that you simplify handling of file expansion (only
considering that header has fixed size). However you gain a lot of
complications
trying to keep the header out of the cache, dealing with
FileObject->CurrentByteOffset for sequential files (these are just from
the top of my head).
So, unless there are particular reasons why you want to have your header
at the beginning of the file, I would suggest to put it at the end or even
strip it completely from the file and keep it somewhere else.

Regards,

Vladimir



Re: FS Filter Driver question
If you're on NTFS you could consider keeping it in an alternate stream in the file.


Re: FS Filter Driver question
________________________________________
Hi David, Vlad, Peter,

Thanks so much for your helpful suggestions.

- We keep the fixed-size header data in the file for our own informational
purpose, and this header is not necessarily related to the content-mangling
algorithm (with which we mangle the actual contents of the file).

- Even if we don't keep the header in the beginning of the file, doesn't the
problem of trying to hide it from the Cache Manager still exist?
(we currently do adjust the FileObject->CurrentByteOffset for certain IRPs to
skip the header, and we keep the header in the beginning for only the reasons
that Vlad mentioned).

- Also, let's assume that we keep no header in the file, our mangling algorithm
still increases the length of the file (similar to an encryption algorithm), if
the Cache Manager is able to read the "increased size" of the file, but then it
is not able to get all the data (because we are un-mangling and giving it the
actual data (which is smaller in size)), will that cause problems?

- The files we mangle can be binaries or data files, e.g. MS Office Programs can
certainly use them as documents, or DLLs. (if our driver is loaded, these files
will be read correctly, if our driver is not loaded, then the file will be seen
as containing garbage data).

- Lastly, we need to be agnostic of File System types (i.e. we can't rely on
NTFS features, which would have been nice :-) ).


Re: FS Filter Driver question (Tony Mason - DDK MVP)
________________________________________
The only way I've seen this work is to construct a filter that works much
like the compression support for NTFS - that is, your "filter" integrates
into the cache manager and then creates different file objects which it
sends to the underlying FSD.  The version YOU maintain in the cache has the
right length/size information, which is what will be used by application
programs.

Then your "filter" calls the underlying FSD to obtain the data (in mangled +
offset) form.  That the file size underneath you is different doesn't
matter.

Of course, when you are done what you have is more like a stacked file
system than a filter - these are the most complex filters that I've seen,
and I think are harder to develop than a file system.

Re: FS Filter Driver question
________________________________________
Ways to keep the header out of the cache are conceptually different for those two cases. In case if header is at the end you may not even care if it gets into the cache (unless you don't want to expose its content). And event if you don't want anybody to see what is in it, you can simply get its valid content in the read completion routine and then fill the buffer with some garbage. But if you have the header at the beginning you can't afford it to get cached at all because in this case you will end up screwing actual file content when file gets memory mapped. I’m not saying it is impossible. I just think that avoiding this problem will give you more headaches than supporting file expansion with the header at the end.


Re: FS Filter Driver question
________________________________________
Tony: Isn’t “shrinking” bigger file into cache significantly different than expanding smaller file? Since in this case CM will allocate enough pages to fit actual file content? And what does it mean “filter" integrates into the cache manager”? Do you mean that filter will initialize (and whole 9 yards) FO that it receives in the create dispatch and use actual FS just to read/write mangled file? Or there is something else?



                                    第二篇




On Fly encryption filter driver

I am developing a file system filter driver on windows 2000, which does on fly encryption and decryption. I would like to know what is best method to mark the file for encryption. My plan is to add a header information to the encrypted file so that the filter driver will use this information to identify the encrypted file when it is read or written to the disk. Does this solution have any side-effects ? One more issue I have identifed is with temporary files that are created by applications like MS-Word, Visual studio. For example, if an encrypted word document is opened with MS-Word, it creates a temporary document with the same contents and when the document is saved it deletes the original document and renames the temporary document to the orignal name. Since the temoprary document is not marked for encryption its contents will NOT be in encrypted format and when it is renamed to orginal document it is still unencrypted. But the user thinks that the original document is encrypted and hence it is a bug. Is there any solution for this ?


Re: On Fly encryption filter driver
________________________________________
> I am developing a file system filter driver on windows 2000, which does on
> fly encryption and decryption. I would like to know what is best method to
> mark the file for encryption.

Sideband data in the registry, INI file or such.

> My plan is to add a header information to the encrypted file so that the

This will require major effort in dealing with 2 concepts of file sizes.

The encryption filter which adds a header or changes the file size if not a
filter, but more like a complete FSD (which its own FCBs, own file sizes and
Cc/Mm interaction) built on top of another FSD.

For a simple filter, avoid changing the file size and avoid adding headers.

 

推荐阅读
  • DAO(Data Access Object)模式是一种用于抽象和封装所有对数据库或其他持久化机制访问的方法,它通过提供一个统一的接口来隐藏底层数据访问的复杂性。 ... [详细]
  • com.sun.javadoc.PackageDoc.exceptions()方法的使用及代码示例 ... [详细]
  • 本文详细介绍了 PHP 中对象的生命周期、内存管理和魔术方法的使用,包括对象的自动销毁、析构函数的作用以及各种魔术方法的具体应用场景。 ... [详细]
  • 本文深入解析了JDK 8中HashMap的源代码,重点探讨了put方法的工作机制及其内部参数的设定原理。HashMap允许键和值为null,但键为null的情况只能出现一次,因为null键在内部通过索引0进行存储。文章详细分析了capacity(容量)、size(大小)、loadFactor(加载因子)以及红黑树转换阈值的设定原则,帮助读者更好地理解HashMap的高效实现和性能优化策略。 ... [详细]
  • 本文介绍了如何利用Shell脚本高效地部署MHA(MySQL High Availability)高可用集群。通过详细的脚本编写和配置示例,展示了自动化部署过程中的关键步骤和注意事项。该方法不仅简化了集群的部署流程,还提高了系统的稳定性和可用性。 ... [详细]
  • 深入剖析Java中SimpleDateFormat在多线程环境下的潜在风险与解决方案
    深入剖析Java中SimpleDateFormat在多线程环境下的潜在风险与解决方案 ... [详细]
  • 在Cisco IOS XR系统中,存在提供服务的服务器和使用这些服务的客户端。本文深入探讨了进程与线程状态转换机制,分析了其在系统性能优化中的关键作用,并提出了改进措施,以提高系统的响应速度和资源利用率。通过详细研究状态转换的各个环节,本文为开发人员和系统管理员提供了实用的指导,旨在提升整体系统效率和稳定性。 ... [详细]
  • ### 优化后的摘要本学习指南旨在帮助读者全面掌握 Bootstrap 前端框架的核心知识点与实战技巧。内容涵盖基础入门、核心功能和高级应用。第一章通过一个简单的“Hello World”示例,介绍 Bootstrap 的基本用法和快速上手方法。第二章深入探讨 Bootstrap 与 JSP 集成的细节,揭示两者结合的优势和应用场景。第三章则进一步讲解 Bootstrap 的高级特性,如响应式设计和组件定制,为开发者提供全方位的技术支持。 ... [详细]
  • 使用 ListView 浏览安卓系统中的回收站文件 ... [详细]
  • Python 伦理黑客技术:深入探讨后门攻击(第三部分)
    在《Python 伦理黑客技术:深入探讨后门攻击(第三部分)》中,作者详细分析了后门攻击中的Socket问题。由于TCP协议基于流,难以确定消息批次的结束点,这给后门攻击的实现带来了挑战。为了解决这一问题,文章提出了一系列有效的技术方案,包括使用特定的分隔符和长度前缀,以确保数据包的准确传输和解析。这些方法不仅提高了攻击的隐蔽性和可靠性,还为安全研究人员提供了宝贵的参考。 ... [详细]
  • 本文详细介绍了在 Oracle 数据库中使用 MyBatis 实现增删改查操作的方法。针对查询操作,文章解释了如何通过创建字段映射来处理数据库字段风格与 Java 对象之间的差异,确保查询结果能够正确映射到持久层对象。此外,还探讨了插入、更新和删除操作的具体实现及其最佳实践,帮助开发者高效地管理和操作 Oracle 数据库中的数据。 ... [详细]
  • Web开发框架概览:Java与JavaScript技术及框架综述
    Web开发涉及服务器端和客户端的协同工作。在服务器端,Java是一种优秀的编程语言,适用于构建各种功能模块,如通过Servlet实现特定服务。客户端则主要依赖HTML进行内容展示,同时借助JavaScript增强交互性和动态效果。此外,现代Web开发还广泛使用各种框架和库,如Spring Boot、React和Vue.js,以提高开发效率和应用性能。 ... [详细]
  • Ihavetwomethodsofgeneratingmdistinctrandomnumbersintherange[0..n-1]我有两种方法在范围[0.n-1]中生 ... [详细]
  • 单片微机原理P3:80C51外部拓展系统
      外部拓展其实是个相对来说很好玩的章节,可以真正开始用单片机写程序了,比较重要的是外部存储器拓展,81C55拓展,矩阵键盘,动态显示,DAC和ADC。0.IO接口电路概念与存 ... [详细]
  • 本文主要探讨了Java中处理ActionEvent事件的接口,以及一些常见的编程问题和解决方案,包括方法重载、成员变量访问、镜片质量检测等。 ... [详细]
author-avatar
V铿锵花木兰V
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有