Free Support Forum -

Check if a file is password protected using Java


We are planning to use groupdocs for conversion, as a part of that we need to convert the password protected files as well.

Before converting the password protected document, we need to check whether the file is password protected or not and if protected we need to prompt user for password.

So my question is what is the way to check a file [ex: office documents] is password protected ?

Tirumala Reddy


Thanks for taking interest in GroupDocs.Conversion and posting your concerns.
Can you please confirm if you are evaluating API for Java or .NET platform? We’ll then further investigate this scenario.

Java API. And is there any way to check a file is password protected using java core APIs.

1 Like


Thanks for the details.

We are investigating this scenario. There could be other Java APIs to detect files encryption but they may not support all the file formats offered by GroupDocs.Conversion for Java API.
Your investigation ticket ID is CONVERSIONJAVA-546. As we have any further update on it, we’ll notify you.


This feature will be added in some future release of the API. We’ll notify you as release gets on-board.

How can we do this using java APIs ? (should work for office documents)


This feature is not yet supported in the API.
But it will be available in some upcoming release. We’ll then update you how you can check if a file is password protected.

Once this feature is released, it will support all these formats.

If the file is password protected, GroupDocs conversionHandler.convert API is throwing GroupDocsException. How do we know whether it is ‚Äúcom.groupdocs.conversion.exceptions.PasswordProtectedException‚ÄĚ . or not ?


Whenever you try to process a password protected document. API will always throw following exception:
Exception of type ‚ÄėGroupDocs.Conversion.Exceptions.PasswordProtectedException‚Äô was thrown.

I am using java conversion API, and not able to access PasswordProtectedException class at all.

exception class com.groupdocs.conversion.exceptions.c: Exception of type System.Exception was thrown.
com.groupdocs.conversion.domain.documents.q.a(Unknown Source)

Screen Shot 2019-03-07 at 3.31.24 PM.png (12.0 KB)


We are investigating this issue ID: CONVERSIONJAVA-567. As we have any further information, we’ll update you.