I'm working with the php-encryption library to provide integration between two different applications. On one side, I have a corporative application that holds all data from users. This application will serve some sensitive data through an API.
On the other side, the other application will request some data, consuming the API. At this point, the API is using authenticated encryption to keep the data secure.
The question with the php-encryption library is: the key of encryption is a random key. I need keep that key because the other application must decrypt the data.
$key = Crypto::createNewRandomKey(); $message = "mymessage"; $ciphertext = Crypto::encrypt($message, $key);
$decrypted = Crypto::decrypt($ciphertext, $key);
What is the best way to share the key or keep the same key between different applications?