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

Chyba: "The creation of new signatures is not permitted in the current document." #495

Open
nekromoff opened this issue Jul 26, 2024 · 3 comments · May be fixed by #498
Open

Chyba: "The creation of new signatures is not permitted in the current document." #495

nekromoff opened this issue Jul 26, 2024 · 3 comments · May be fixed by #498
Labels
good first issue Good for newcomers

Comments

@nekromoff
Copy link

nekromoff commented Jul 26, 2024

PDF asi bolo chranene heslom ci co (to vyhlasila ina podpisovacia aplikacia). Po Print to PDF podpisat kopiu ide.
Ale skor tu ide o UX, ked iba pouzivatel dostane genericku chybu - "nejde podpisat", bez uvedenia dovodu.

digital.slovensko.autogram.core.errors.UnrecognizedException: eu.europa.esig.dss.pades.exception.ProtectedDocumentException: The creation of new signatures is not permitted in the current document. Reason : PDF Permissions dictionary does not allow modification or creation interactive form fields, including signature fields when document is open with user-access!
	at digital.slovensko.autogram.core.errors.AutogramException.createFromDSSException(AutogramException.java:70)
	at digital.slovensko.autogram.core.Autogram.signCommonAndThen(Autogram.java:106)
	at digital.slovensko.autogram.core.Autogram.lambda$sign$13(Autogram.java:117)
	at java.base/java.lang.Thread.run(Unknown Source)
Caused by: eu.europa.esig.dss.pades.exception.ProtectedDocumentException: The creation of new signatures is not permitted in the current document. Reason : PDF Permissions dictionary does not allow modification or creation interactive form fields, including signature fields when document is open with user-access!
	at eu.europa.esig.dss.pades.alerts.ProtectedDocumentExceptionOnStatusAlert$1.process(ProtectedDocumentExceptionOnStatusAlert.java:43)
	at eu.europa.esig.dss.pades.alerts.ProtectedDocumentExceptionOnStatusAlert$1.process(ProtectedDocumentExceptionOnStatusAlert.java:39)
	at eu.europa.esig.dss.alert.AbstractAlert.alert(AbstractAlert.java:62)
	at eu.europa.esig.dss.pdf.PdfPermissionsChecker.alertOnForbiddenSignatureCreation(PdfPermissionsChecker.java:153)
	at eu.europa.esig.dss.pdf.PdfPermissionsChecker.checkDocumentPermissions(PdfPermissionsChecker.java:90)
	at eu.europa.esig.dss.pdf.AbstractPDFSignatureService.checkPdfPermissions(AbstractPDFSignatureService.java:758)
	at eu.europa.esig.dss.pdf.pdfbox.PdfBoxSignatureService.computeDigest(PdfBoxSignatureService.java:138)
	at eu.europa.esig.dss.pdf.AbstractPDFSignatureService.messageDigest(AbstractPDFSignatureService.java:189)
	at eu.europa.esig.dss.pades.signature.PAdESService.computeDocumentDigest(PAdESService.java:195)
	at eu.europa.esig.dss.pades.signature.PAdESService.getDataToSign(PAdESService.java:182)
	at digital.slovensko.autogram.core.SigningJob.signDocumentAsPAdeS(SigningJob.java:150)
	at digital.slovensko.autogram.core.SigningJob.signWithKeyAndRespond(SigningJob.java:55)
	at digital.slovensko.autogram.core.Autogram.signCommonAndThen(Autogram.java:95)
	... 2 more
@celuchmarek
Copy link
Member

Aha, ak je PDF chránené heslo, že sa bez hesla nedá ani zobraziť, to v Autograme vyhodí príslučnú chybovú hlášku. Toto je ale iný prípad - dokument je chránený heslo proti zmenám. Bude to treba ošetriť.

Vieš nám poradiť, kde si presne takéto PDF získal? Alebo to bola komerčná vec mimo verejných služieb?

@celuchmarek celuchmarek added the good first issue Good for newcomers label Aug 6, 2024
@nekromoff
Copy link
Author

nekromoff commented Aug 6, 2024

Nebolo chranene heslom, ale nejako uzamknute. V kazdom pripade tlac do PDF z neho vytvorila odomknute PDF, cize zjavne to az taky problem nebol (aj ked rozumiem, ze tlac nie je v naplni Autogramu).

Nejaka zmluva, cize komercna vec, nemozem poskytnut, pozriem sa ale na vlastnosti PDF a postnem ich.

@xhyrom
Copy link
Contributor

xhyrom commented Aug 8, 2024

Toto je ešte nejaký iný prípad ako hovorí @nekromoff. keďže pri pokuse podpísať PDF ktoré je chránené heslom a nedá sa bez neho ani zobraziť, dostaneme:
image
image
related #395

test-protected.pdf (heslo123)
test.pdf

presnejšie tu:

public void onUploadButtonAction() {
var chooser = new FileChooser();
var list = chooser.showOpenMultipleDialog(new Stage());
try {
onFilesSelected(list);
} catch (Exception e) {
autogram.onSigningFailed(new UnrecognizedException(e));
}
}

mali by sme teda trochu lepšie ošetriť tieto chyby s uzamknutými PDF-kami.

@xhyrom xhyrom linked a pull request Aug 19, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants