Check with PHP if a file is encrypted

  encryption, php

I have a form that uploads a file via PHP to my server.

For security I analyze these files with ClamAV, however, encrypted files (eg.: zip with password, pdf with password) cannot be analyzed.

I tried via fopen to see if there was any error reading the file, but it reads the file normally, displaying the encrypted content without triggering errors.

Is it possible via PHP to detect if this file is encrypted and display an error message to the user?

Source: Ask PHP

LEAVE A COMMENT