Archive for 2月, 2013

I made sample php native extension to decrypt ms-office 2007 document.

Source code is here

What php-ole can is to ..

1 . Read ole object stream as php-stream
2 . Compute secret key from EncryptionInfo Stream and password ( you specified )
EncryptionInfo Stream

So php-ole can’t decrypt oox document exactly.
But you can decrypt document to use php mcrypt extension and computed secret key.
Please refer to php sample code if you want to more details.

Requirement

1 . Unix or linux style os
2 . libgsf , libgsf-devel ( 3rd library )
3. PHP 5.3 or more
4. mcrypt php extension ( to decrypt AES document in sample php code)

Prepared to build
#yum install libgsf libgsf-devel

I just wrote to use pkg-config for libgsf in config.m4.

How to build

1. download zip (src files ) from github

2. build from src

#cd php-ole
#phpize
#./configure --enable-ole
#make; make install;
How to run the sample PHP code in archives
$cd php-ole
$php -f php/ole.php php/test/password_abc.docx

or ( if you don’t want to install so file )

$cd php-ole
$php -d extension=.libs/ole.so -f php/ole.php php/test/password_abc.docx

You can show the document password ‘abc’ in sample code( php/ole.php).
So when you use your own document file,
Please change the password.

expected console output

------ Class OleInfile method list --------
array(6) {
  [0]=>
  string(11) "__construct"
  [1]=>
  string(4) "open"
  [2]=>
  string(11) "numChildren"
  [3]=>
  string(9) "statIndex"
  [4]=>
  string(15) "getStreamByName"
  [5]=>
  string(17) "getEncryptionInfo"
}
=== document entries === 
array(2) {
  ["name"]=>
  string(11) "DataSpaces"
  ["size"]=>
  int(0)
}
array(2) {
  ["name"]=>
  string(14) "EncryptionInfo"
  ["size"]=>
  int(224)
}
array(2) {
  ["name"]=>
  string(16) "EncryptedPackage"
  ["size"]=>
  int(10328)
}
------ Class OleEncryptionInfo method list --------
array(4) {
  [0]=>
  string(14) "verifyPassword"
  [1]=>
  string(12) "getSecretKey"
  [2]=>
  string(11) "getVerifier"
  [3]=>
  string(15) "getVerifierHash"
}
====== OK ==== 
RSS
Add to Google
2013年2月
« 11月    
 12
3456789
10111213141516
17181920212223
2425262728