Wednesday, November 1, 2017

Laravel 5 and OpenSSL

Notes on updating Apache 2.4, Laravel 5.5 with PHP 5, to PHP 7.1. 


Currently, the openssl key on my Apache server is serving encryption with AES 128. Information here is for development server environment only.

Default new Laravel applications are generated with use of encryption key type AES 256 as found in <Laravelproject>/config/app.php

The cipher key in app.php can be changed, or just generate the new required AES 256 keys.

Steps to generate the OpenSSL public and private keys;

$ openssl genrsa -aes256 -out mysitename.key 2048
$ openssl rsa -in mysitename.key -out mysitename-decrypted.key
$ openssl req -x509 -nodes -new -sha256 -key mysitename-decrypted.key -out mysitename.crt


When restarting Apache on MS Windows 10, this error appears.
"Init: SSLPassPhraseDialog builtin is not supported on Win32"

Solution is to remove the pass phrase in private key (See). In this example, the public and private ssl certs are both stored in <Apache directory>/conf/ssl/
Step 1:
Copy private key mysitename.key to secure.key

Step 2: Remove pass phrase from private key in use.
In CLI of the folder for ssl type

$ openssl rsa -in secure.key -out mysitename.key

Step 3: Open <Apache directory>/conf/extra/httpd-ssl.conf and comment out the line
# SSLPassPhraseDialog  builtin

Step 4: Restart Apache

In the event the following error appears, it means the openssl module is not loaded. Find another compatible Apache server to be installed that can load the openssl in directory extension.

PHP Startup: Unable to load dynamic library
or
Undefined method openssl_cipher_iv_length( )

No comments:

Blog Archive