If you ever happen to deal with GPGME and PHP, or if you just want to encrypt and decrypt with the power of GnuPG, this code might help you!
Note that this technique makes use of public and private keys, which increases encryption security. You should create your own keys separately.
Also, note that we are trying to let PHP to use GnuPG, which requires to write a few files to the $GNUPGHOME folder, known as user keys. They are created automagically in the background. Let your web server write to that folder and make 100% sure that it is not accessible via web (do not put it under your /var/www folder!). The $GNUPGHOME folder must be a regular folder (not /tmp) that belongs to the actual web server user (i.e: www-data), your server setup might be different, so it is up to you to setup everything correctly.
Let’s see the code:
If you ever have to test password hashing strength, or just play to be a cracker for a bit, this PHP class might help you get started with brute force attack methods.
Lua is an embeddable scripting language. If you are trying to embed it in PHP follow this instructions that may help you:
$ sudo apt-get install phpize liblua5.1-0-dev
$ git clone git://repo.or.cz/phplua.git src
$ cd src/
At this point you are almost done, BUT please edit the file Makefile and change the line:
LUA_SHARED_LIBADD = -llua
LUA_SHARED_LIBADD = -llua5.1
Then is time to finish cooking:
$ sudo make install
Almost done, do a test:
$ make tests #all will fail, that is fine by now
My d.o profile says that I'm a 3 years old drupaler, and I love it. From my personal vision, God blessed me a lot since I'm working with Drupal. Not only in my job, also had the wonderful opportunity to meet so nice people, and visit 3 new countries in just one year!
What about PHP? well..., we have a trading agreement :D