Request some encryption / Decryption guidace

General discussions related to php

Moderators: egami, macek, gesf

Post Reply
IChaps
php-forum Fan User
php-forum Fan User
Posts: 131
Joined: Tue Mar 01, 2016 3:07 pm

Tue Mar 28, 2017 10:12 am

Hello.

May I please request some help with encryption / decryption, as in the next few days or so, I'll be looking to:-

1. I have 4 or 5 files, which hold's the databases Username, Password, Host, Database Name. I would like to encrypt theses files, and when I load my site, I'd like to decrypt them so they cane be read.

2. Database: I'd like to enquire how I would encrypt the data within the database, and decrypt it when needed.

I'd be greatful if someone, would write a sample code for me to look at. I've tried php.net but was not able to figure out, what I was reading.

Thank You.
AdoptiveSolution
php-forum Super User
php-forum Super User
Posts: 167
Joined: Wed Jun 15, 2016 8:35 am

Tue Mar 28, 2017 10:45 am

I searched for php encrypt decrypt

Found this :

https://naveensnayak.wordpress.com/2013 ... d-decrypt/
chorn
php-forum GURU
php-forum GURU
Posts: 626
Joined: Fri Apr 01, 2016 2:18 am

Wed Mar 29, 2017 3:37 am

the main problems i always see: where do you want to store the key, do you want to store it for each user and what to do if you or the users lost it? tools are provided by your database itself (MySQL or PostgreSQL), or i would recommend to use a maintained third party tool like libsodium.
IChaps
php-forum Fan User
php-forum Fan User
Posts: 131
Joined: Tue Mar 01, 2016 3:07 pm

Fri Mar 31, 2017 10:43 am

Hello AdoptiveSolution and chorn.

Thank you very much for your valued replies.

AdoptiveSolution, I've looked at the site, you've suggested, and I'm about to try out the code properly. I attempted it first time, but was too tired to work on it. But I do appreciate your time.

chorn, Once I was considering encrypting the e-mail and password fields in the database, but use the sample method on the site AdoptiveSolution suggested.

It may take a while to work on it, as I'm going to be busy over the next few days.

I do appreciate both of you for your replies and help.

Kind Regards :) :)
Post Reply