Simple two-way encryption that will be used both on the PHP server and on the iOS client

For private use only , I create and host on my web server a PHP application that extracts all my passwords for various accounts from the MySQL database and serves them for a client, which is an iPhone application that should also be able to insert new passwords to the database.

Instead of sending this data over the Internet in plain text, I would like to encrypt it before sending, but I am very new to encryption, so I feel a little disoriented among all the possible encryption algorithms.

Although the mcrypt function in PHP seems very flexible and compatible with many encryption algorithms, I could not find anything like it on iOS.

I would like some algorithm to be easily implemented in both PHP and Objective-C, which, given some plain text and an encryption key (stored both on the server and on the client), will encrypt and decrypt plain text .

For more detailed information about the connection between the server and the client, I had in mind the following:

  • The client sends a request containing a specific application-application identifier and a service whose password the server should return
  • The server checks if this client identifier is allowed to receive this information.
  • If the client is allowed, the server queries the database and retrieves the password
  • The server encrypts the password and sends it to the client
  • The client decrypts the password and shows it to the user

This thing is intended for personal use only, so I do not need indestructible security, because probably no one will take care of it. I do this for research only and start with encryption. I know this is not safe.

Guys, do you know any two-way encryption algorithm that is easy to use on both php and Objective-C, which I can use to encrypt passwords on the server and decrypt them in iOS?

+4
source share
1 answer

Do not worry about your own encryption. You just need to use the SSL link, for example.

 https://yourserver.example.com/getpasswords.php ^--- 

SSL gives you encryption for free, and as a bonus, the iOS client can be sure that it connects to YOUR server, and not to a malicious fake server.

+2
source

Source: https://habr.com/ru/post/1479939/


All Articles