如何确定文件是否使用EFS加密?

Mat*_*att 3 .net c# encrypting-file-system ntfs

是否有某个库方法用于确定文件是否已使用EFS加密?我在FileInfo上看到了Encrypt()Decrypt()方法,但我正在寻找一种查询文件状态的方法.

Atr*_*ige 6

扩展bdolan&matt的评论:

<snip>
using System.IO;
<snip>
FileInfo fi = new FileInfo(uri); //uri is the full path and file name
if (fi.Attributes.HasFlag(FileAttributes.Encrypted))
{
//FILE IS ENCRYPTED
}
else
{
//FILE IS SAFE
}
Run Code Online (Sandbox Code Playgroud)