OpenSSL is a free open source module that is meant to take care of communications that takes place over computer networks. OpenSSL is a tool for Transport Layer Security (TLS) and Secure Sockets Layer (SSL) protocols.
A Secure Sockets Layer i.e SSL is used by website.The SSL certificate takes care of protecting the data between two computers by using ecryption. The two computers involved can be the data sharing between client and server. When you share data like password, credit card details, home address, social security number it has to be protected and the same is taken care by the SSL certificate.The SSL certificates makes sure the identity of both computers involved is authenticated for safe connection.
OpenSSL module is by default added to PHP. You can activate the same by removing the (;) ;extension=php_openssl.dll added at the start of the extension in php.ini. After that restart apache and to confirm if the changes are reflecting save below code as .php and execute the .php in browser.
<?php phpinfo(); ?>You should see the openssl enabled in the browser as shown below:
The openssl.cnf is the configuration file and has all the default configuration required for openssl to work.To execute openssl the first thing is that php will try to locate the config file.To get the same you will have to add the php folder to environment variable.
If you are Windows user following are the steps to setup environment variable for php folder:
1. Right click My Computer and go to Properties.
2. Go to Advanced system Settings.
3. Click on the 'Environment Variables' button.
4. Edit the path variable and click on Edit button.
5. Now add the Php folder path at the end.I am using xampp so my php folder is C:\xampp\php;
6.Once done click on Ok button.
7.Now open your command prompt and enter the command: openssl version -a.
C:\Windows\system32>openssl version -a OpenSSL 1.0.2l 25 May 2017 built on: reproducible build, date unspecified platform: mingw64 options: bn(64,64) rc4(16x,int) des(idx,cisc,2,long) idea(int) blowfish(idx) compiler: x86_64-w64-mingw32-gcc -I. -I.. -I../include -D_WINDLL -DOPENSSL_PIC -DOPENSSL_THREADS -D_MT -DDSO_WIN32 -static-libgcc -DL_ENDIAN -O3 -Wall -DWIN32_ LEAN_AND_MEAN -DUNICODE -D_UNICODE -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DO PENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DRC4_ASM -DSHA1_ASM -DSHA256_ASM -DSH A512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM OPENSSLDIR: "/etc/ssl"
Now php will be able to locate the openssl.cnf configuration file.
|Sr.No||Function & Description||Version|
Returns a resource identifier that has new private and public key pair
Returns the private key
Returns the public key
Exports the key to a file
Encrypts the data with the private key
Encrypts the data with public key
Decrypts the data with the public key
Decrypts the data with the private key
34 Lectures 4 hours
84 Lectures 5.5 hours