How to validate if the uploaded documents are password protected on UI

Need to validate any uploaded document which is password protected, display message and not allow those if they are password protected.

Please help.

  Discussion posts and replies are publicly visible