Decrypt/Unlock a password/certificate protected Pdf with valid/invalid password check

Hello,

If I provide a wrong password, instead of giving an error or returning false, decryptFile(ownerpassword) method of PdfFileSecurity class is returning a Pdf with blank pages. My requirement is to prompt user until a valid password is provided. Is there a way to check using Aspose API if provided password is correct or not. I do not want to proceed until a valid password is provided and returning a blank Pdf is least expected.
My second question is – "Is there support from Aspose API to unlock Pdf files applied with ‘certificate security’ like digital ID?"

Thanks,
Gurpreet Singh

Hi Gupreet,


Thanks for your inquiry. We are working over your query and will answer you soon.

Best Regards,

Hi Gurpeet,

Thanks for your patience. I also observed that the decryptFile() method doesn’t throw any exception or return a boolean result in case of a wrong password, so I have logged an enhancement request, PDFKITJAVA-33268, in our issue tracking system. As a workaround, you can use the isOwnerPassword() or isUserPassword() methods of the PdfViewer class for validating the password and proceed accordingly.

Secondly, regarding digital certificate decryption, unfortunately, Aspose.Pdf doesn’t support this feature at the moment. However, I have also logged a new feature request, PDFKITJAVA-33269, in our issue tracking system. You will be notified via this thread as soon as it becomes available.

Please feel free to contact us for any further assistance.

Best Regard,