[ 
https://issues.apache.org/jira/browse/PDFBOX-6313?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18147100#comment-18147100
 ] 

Tilman Hausherr edited comment on PDFBOX-6313 at 11/19/26, 6:04 AM:
--------------------------------------------------------------------

Thank you. I searched for a usage in github and didn't find any except this one:
https://github.com/shinguakira/pdfbox-go/pull/19

This is a guy who has ported PDFBox to GO and found many bugs, so this might 
become another large set of TODOs, I have opened PDFBOX-6321 for that one.


was (Author: tilman):
Thank you. I searched for a usage in github and didn't find any except this one:
https://github.com/shinguakira/pdfbox-go/pull/19

This is a guy who has ported PDFBox to GO and found many bugs, so this might 
become another large set of TODOs.

> PDEncryption.hasSecurityHandler() returns the inverse of what its javadoc says
> ------------------------------------------------------------------------------
>
>                 Key: PDFBOX-6313
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-6313
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel
>    Affects Versions: 2.0.37, 3.0.8 PDFBox, 4.0.0
>            Reporter: Martin Mirchev
>            Priority: Major
>
> The javadoc says "Returns true if the security handler specified in the 
> dictionary's Filter is available", but the method returns {{securityHandler 
> == null}}:
> {code:java}
> public boolean hasSecurityHandler()
> {
>     return securityHandler == null;
> }
> {code}
> So it is {{true}} when there is no handler and {{false}} when there is one:
> {code:java}
> new PDEncryption().hasSecurityHandler();     // true, no handler
> // RC4-128 document saved with StandardProtectionPolicy, then 
> Loader.loadPDF(bytes, ""):
> doc.getEncryption().getSecurityHandler();    // StandardSecurityHandler
> doc.getEncryption().hasSecurityHandler();    // false
> {code}
> Checked on trunk (bd0c9c0); the same code is on the 3.0 and 2.0 branches. 
> Nothing in PDFBox itself calls the method, so only API users are affected. 
> The fix is {{return securityHandler != null;}}.
> This issue was found by an LLM-assisted tool and verified manually.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to