Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Encryption with PHP Phar

Tags:

php

phar

Is it possible to encrypt/password-protect a Phar archive to enable closed-source software distribution?

like image 659
MidnightLightning Avatar asked Oct 17 '11 16:10

MidnightLightning


2 Answers

Phar supports zip, and zip files can be password-protected. But you would need a monkey for typing in the zip password whenever a request comes in. So no, not useful for closed-source software.

But to make this a somewhat serious answer, no it really doesn't work:

PHP Warning: include(phar://phar.zip): failed to open stream: phar error: Cannot process encrypted zip files in zip-based phar "phar.zip" in php shell code on line 1

like image 80
mario Avatar answered Sep 23 '22 07:09

mario


Wanting to have a company purchase closed-source software,

In that case, phar alone will not help you. Look for a bytecode compiler like ioncube.

like image 43
cweiske Avatar answered Sep 25 '22 07:09

cweiske