We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

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 decryptFile() method doesn't throw any exception or some boolean result in case of wrong password, so I have logged an enhancement request, PDFKITJAVA-33268, in our issue tracking system. As a workaround you can use isOwnerPassword() or isUserPassword() methods of PdfViewer class for validating password and proceed accordingly.


Secondly in reference to 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 gets available.


Please feel free for contact us for any further assistance.


Best Regard,