Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when incorrect password #8

Open
SpirikleOfficial opened this issue Dec 22, 2023 · 0 comments
Open

Error when incorrect password #8

SpirikleOfficial opened this issue Dec 22, 2023 · 0 comments

Comments

@SpirikleOfficial
Copy link

Bug Description
Receiving error when a user inputs an incorrect password to a protected pdf file. Version used: 0.5.9

Error

 PlatformException(pdfDecryption_exception, com.itextpdf.kernel.exceptions.BadPasswordException: Bad user password. Password is not provided or wrong password provided. Correct password should be passed to PdfReader constructor with properties. See ReaderProperties#setPassword() method.
I/flutter ( 9272): 	at com.itextpdf.kernel.crypto.securityhandler.StandardHandlerUsingStandard40.checkPassword(StandardHandlerUsingStandard40.java:214)
I/flutter ( 9272): 	at com.itextpdf.kernel.crypto.securityhandler.StandardHandlerUsingStandard40.initKeyAndReadDictionary(StandardHandlerUsingStandard40.java:198)
I/flutter ( 9272): 	at com.itextpdf.kernel.crypto.securityhandler.StandardHandlerUsingStandard40.<init>(StandardHandlerUsingStandard40.java:81)
I/flutter ( 9272): 	at com.itextpdf.kernel.crypto.securityhandler.StandardHandlerUsingStandard128.<init>(StandardHandlerUsingStandard128.java:60)
I/flutter ( 9272): 	at com.itextpdf.kernel.pdf.PdfEncryption.<init>(PdfEncryption.java:235)
I/flutter ( 9272): 	at com.itextpdf.kernel.pdf.PdfReader.readDecryptObj(PdfReader.java:1406)
I/flutter ( 9272): 	at com.itextpdf.kernel.pdf.PdfReader.readPdf(PdfReader.java
I/flutter ( 9272): #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:652:7)
I/flutter ( 9272): #1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:310:18)
I/flutter ( 9272): <asynchronous suspension>
I/flutter ( 9272): #2      MethodChannelPdfManipulator.pdfDecryption (package:pdf_manipulator/src/pdf_manipulator_method_channel.dart:107:26)
I/flutter ( 9272): <asynchronous suspension>
I/flutter ( 9272): #3      _EnterPasswordDialogState.build.<anonymous closure> (package:scanclan/Components/myDialogs/my_custom_dialog.dart:1707:21)
I/flutter ( 9272): <asynchronous suspension>
I/flutter ( 9272): ----------------------------------------------------

Steps to reproduce the behavior in the code:
Just open any protected pdf whose password is not 'userpw', in the example project of the package.

Expected behavior
Instead of throwing an error, we should receive information if password entered was incorrect. Throwing an error is not good practice for production apps.

Please look into this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant