简体   繁体   English

使用CopyFileEx复制另一个用户的加密文件

[英]Use CopyFileEx to copy encrypted file of another user

I want to copy some encrypted files of other user from one computer to another using CopyFileEx API in c#. 我想使用c#中的CopyFileEx API将其他用户的一些加密文件从一台计算机复制到另一台计算机。

CopyFileEx decrypts file before copy to target. CopyFileEx在复制到目标之前解密文件。 Files can be decrypted by the only user who encrypted them. 文件可以由加密它们的唯一用户解密。

In this case, I will get error message of Access Denied. 在这种情况下,我将收到拒绝访问的错误消息。

Is there a way using CopyFileEx to achieve this? 有没有办法使用CopyFileEx来实现这一目标?

It is obvious that to access encrypted file content you should be authorized as specific user. 很明显,要访问加密文件内容,您应该被授权为特定用户。 That is the purpose of encryption. 这就是加密的目的。

If your task is backup only, you can use ReadEncryptedFileRaw and WriteEncryptedFileRaw pair to backup/restore encrypted files without actually decrypting it. 如果您的任务仅为备份,则可以使用ReadEncryptedFileRawWriteEncryptedFileRaw对来备份/恢复加密文件,而无需实际解密。

But if still want to access file encrypted by another user and you have his credentials, you can use impersonation . 但是,如果仍然想要访问由其他用户加密的文件并且您拥有其凭据,则可以使用模拟

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

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