witwall / origami-pdf

Automatically exported from code.google.com/p/origami-pdf
GNU Lesser General Public License v3.0
0 stars 0 forks source link

Cannot compute correct okey in AESv3 R5 #20

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

In step 3 of algorithm 3.2a of [1], the algorithm to computer the intermediate 
owner is described as following:

file_encryption_key = AES256 {
    data: OE
    key: SHA256(owner_password + O[40:48] + U) 
    mode: CBC, no-padding
    IV: 0
}

However, the implementation seems to forget the U key part when calculating 
AES256 key. This patch adds self.U to conform [1].

[1] Adobe Supplement to ISO 32000, BaseVersion 1.7, ExtensionLevel 3 
(http://www.adobe.com/devnet/pdf/pdf_reference.html)

Original issue reported on code.google.com by czchen on 26 Apr 2013 at 10:48

Attachments:

GoogleCodeExporter commented 9 years ago
Damn, that's right.
And the derivation of the key was also wrong for AESv3 R6. I just fixed it in 
the latest commit.

Thank you for your patch!
Guillaume

Original comment by guilla...@security-labs.org on 2 May 2013 at 4:27