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

Tilman Hausherr commented on PDFBOX-2456:
-----------------------------------------

There it is. It may look slightly different. Some of the changes I did:
- do all the stuff to file even if it takes longer (the whole test takes 4sec 
on an old pc, and less than 2 sec on a new one). But this allows us to have all 
the output files easily available, no need to switch to debug mode or whatever.
- changed variable names so that they make more sense to me (in your code 
"inner" sometimes meant the outer file)
- removed null checks. The test file HAS ONE embedded file or else the test 
MUST fail. This keeps the code shorter and easier to understand. As "uncle Bob" 
said somewhere: "Tests tell a story". But I don't think he meant [complex 
ones|https://xkcd.com/657/large/].
- removed exception handling, not needed, this is shown anyway when it fails
- did some DRY refactoring, the code to extract the embedded file was there 
twice
- removed global variables, this is confusing sometimes (to me). Only global 
vars left is the permission stuff, because that part is disabled
- added a byte compare for the inner file.

> create TestSymmetricKeyEncryption.java
> --------------------------------------
>
>                 Key: PDFBOX-2456
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2456
>             Project: PDFBox
>          Issue Type: Improvement
>          Components: Utilities
>    Affects Versions: 2.0.0
>         Environment: java7 debian7
>            Reporter: Ralf Hauser
>             Fix For: 2.0.0
>
>         Attachments: TestSymmetricKeyEncryption.java, 
> TestSymmetricKeyEncryption.java, enc128bit_20141025_115145.pdf, 
> enc256bit_20141025_105451.pdf, preEnc_20141025_105451.pdf, 
> preEnc_20141025_115145.pdf
>
>
> similarly to org.apache.pdfbox.encryption.TestPublicKeyEncryption, also test 
> password based encryption 
> 1) 128bit
> 2) 256bit AES PDFBOX-1594



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to