How to determine if a file is encrypted using EFS?

Is there any library method to find out if a file has been encrypted with EFS? I can see the methods Encrypt()and Decrypt()in the FileInfo, but I'm looking for a way to request the status of the file.

+3
source share
2 answers

To expand on bdolan and matte comment:

<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
}
+6
source

Source: https://habr.com/ru/post/1720851/


All Articles