S
S
sorry_i_noob2019-01-28 12:02:33
PHP
sorry_i_noob, 2019-01-28 12:02:33

A few questions about the openssl_encrypt function?

Hello. I need to store API tokens in the database (for example, from Yandex.Direct, Yandex.Passport). Keeping it clean is a bad idea. Here I was advised to encrypt them. But I never encrypted anything. I read about the openssl_encrypt function. It needs a key. Where can I get the keys from? The key for each token must be different, right? Therefore, there must be many keys. It's just that you can't write them, like a salt for hashing, to the config file. Where do you get them from then?
And one more question. IV (Initialization Vector) is the same as salt, isn't it? Does it need to be written once to the config file and not generated again?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
Barmunk, 2019-01-28
@Barmunk

a simple example can be found here:
https://gist.github.com/joashp/a1ae9cb30fa533f4ad94

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question