V
V
Vladislav Radzimovsky2015-03-03 17:34:14
PHP
Vladislav Radzimovsky, 2015-03-03 17:34:14

How to generate public_key based on user's password?

Good time of the day.
The problem is this.
I need to encrypt a string in a database with one key but decrypt it with another.
Those. when adding a record to the database, the system encrypts the string with the password "password1". When the user needs to decrypt this string, he enters his password "pass2" and it is decrypted.
I was interested in the RSA algorithm, but as I understand it, public and privat keys are completely random there.
Is there a way to solve this problem..? Or perhaps I approached the question from the wrong side?
Thanks in advance for your replies.
UPD1: Thank you very much for your replies. Turns out it wasn't that hard...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SagePtr, 2015-03-03
@Lafafm

Generate a pair of public and private keys, keep the public open, encrypt the private symmetrically based on the user's password.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question