Digital Signature in PHP:
OpenSSL is used for generation and verification of signatures and for sealing (encrypting) and opening (decrypting) data.

Installation Help Provided at Php site (www.php.net)
To use PHP’s OpenSSL support you must also compile PHP –with-openssl[=DIR].

Note: Note to Win32 Users


In order for this extension to work, there are DLL files that must be available to the Windows system PATH. For information on how to do this, see the FAQ entitled “How do I add my PHP directory to the PATH on Windows”. Although copying DLL files from the PHP folder into the Windows system directory also works (because the system directory is by default in the system’s PATH), this is not recommended. This extension requires the following files to be in the PATH: libeay32.dll

Additionally, if you are planning to use the key generation and certificate signing functions, you will need to install a valid openssl.cnf file on your system. As of PHP 4.3.0, we include a sample configuration file in our win32 binary distributions. PHP 4.3.x and 4.4.x has the file in the openssl directory. PHP 5.x and 6.x has the file in the extras/openssl directory. If you are either using PHP 4.2.x or missing the file, you can obtain it from » the OpenSSL binaries page or by downloading a recent PHP release. Be aware that Windows Explorer hides the .cnf extension by default and says the file Type is SpeedDial.

PHP will search for the openssl.cnf using the following logic:
* the OPENSSL_CONF environmental variable, if set, will be used as the path (including filename) of the configuration file.
* the SSLEAY_CONF environmental variable, if set, will be used as the path (including filename) of the configuration file.
* The file openssl.cnf will be assumed to be found in the default certificate area, as configured at the time that the openssl DLL was compiled. This is usually means that the default filename is c:\usr\local\ssl\openssl.cnf.


In your installation, you need to decide whether to install the configuration file at c:\usr\local\ssl\openssl.cnf or whether to install it someplace else and use environmental variables (possibly on a per-virtual-host basis) to locate the configuration file. Note that it is possible to override the default path from the script using the configargs of the functions that require a configuration file.


Steps to follow:
Installation:

  • Install latest WAMP server from  http://www.wampserver.com/en/
  • Wamp server should be in workin condition http://localhost/
  • Get the Latest OpenSSL setup for Windows from http://gnuwin32.sourceforge.net/packages/openssl.htm Sources setup
  • For instaling Missing Dll’s visit http://support.microsoft.com/kb/259403 and downlad Vcredist.exe (msvcrt.dll and msvcp60.dll); In the location to specify for installation of dll’s, give path of Windows/System or Windows/System32 folder
  • Now To configure the Php, edit php.ini (c:\wamp\bin\php & c:\wamp\bin\apache\Apache2.2.11\bin)
  • Un-Comment the line “extension=php_openssl.dll” do it by removing ;
  • Now restart the Wamp Server.

2 Responses to " Tutorial For Digital Signature in Php "
 
Shahbaz Khan
August 4th, 2009

This is good. Can you make one for Linux as well? Another good point will be to use the TCG specification for SSL/TLS.

 
Matt
October 11th, 2010

Thanks Mudaser!

Leave a Reply


(Required)

(Required)