简体   繁体   English

ProtectedData.Protect和硬件更改

[英]ProtectedData.Protect and hardware changes

I've just been watching some Microsoft Virtual Academy videos on C# and there was a lesson on encryption. 我刚刚看过一些有关C#的Microsoft Virtual Academy视频,并且有关于加密的课程。 At some point the lecturers used a ProtectedData.Protect method. 在某些时候,讲师使用了ProtectedData.Protect方法。 Last argument is a flag that shows the level of access - only current users or local machine. 最后一个参数是一个标志,显示访问级别-仅当前用户或本地计算机。

They also said if one stoles your HDD then he can't get access to the encrypted files. 他们还说,如果有人窃取了您的HDD,那么他将无法访问加密文件。 At this point I suppose that this encryption depends on some hardware combination of current machine, isn't it? 在这一点上,我认为这种加密取决于当前计算机的某种硬件组合,不是吗?

So when you remove an HDD even with the OS that has encrypted files, you still can't access them. 因此,即使在具有加密文件的操作系统中删除硬盘时,仍然无法访问它们。 If so, what if I change some of my PC's hardware? 如果是这样,如果我更改某些PC硬件该怎么办? Will it affect possibility of decrypting previously encrypted files? 它会影响解密以前加密的文件的可能性吗? And if I am totally wrong and missed something very important and misunderstand the whole conception, can anyone explain it in a few words? 如果我完全错了,错过了很重要的东西,并且误解了整个概念,那么有人能用几句话来解释吗?

Under the hood ProtectedData.Protect uses a native library crypt32.dll which is an interface to Windows Data Protection API. 后台 ProtectedData.Protect使用本机库crypt32.dll ,它是Windows Data Protection API的接口。 As far I know in order to protect/encrypt data DPAPI uses something known as MasterKey which is randomly generated and it is stored on the disk - it means that changes in your PC hardware will not affect possibility to decrypt previously encrypted files. 据我所知,为了保护/加密数据,DPAPI使用了称为MasterKey的东西,它是随机生成的,并且存储在磁盘上-这意味着PC硬件的更改不会影响解密以前加密的文件的可能性。

As to the situation when your disk was stolen. 至于磁盘被盗的情况。 My understanding is that if DataProtectionScope.LocalMachine mode was used, then the one who stole your disk would be able to gain access to your data. 我的理解是,如果使用了DataProtectionScope.LocalMachine模式,那么偷走磁盘的人将能够访问您的数据。 Be noted what documentation says about this mode: 请注意有关此模式的文档说明:

We highly recommended that this flag not be used on workstations to protect user's data. 我们强烈建议不要在工作站上使用此标志来保护用户数据。 It does make sense, however, for a server process to use the flag on a server where untrusted users are not allowed to logon. 但是,对于服务器进程来说,在不允许不可信用户登录的服务器上使用该标志确实是有道理的。 It also makes sense for a local machine process to use the flag to protect data to be stored off the machine or on a shared drive. 对于本地计算机进程来说,使用该标志来保护要在计算机外或共享驱动器上存储的数据也很有意义。

See also this question. 另请参阅问题。

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

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