Encrypt with specific key
I want to encrypt a string with a specific key, different for each encryption. I found a stackoverflow answer saying that this would work:
Crypt::setKey($encryption_key);
$encrypted_message = Crypt::encrypt( $message );
It seems that the setKey method was removed in 5.0 however. How can I achieve this in 5.2?
@freddinator This should still work:
$newEncrypter = new \Illuminate\Encryption\Encrypter( $theOtherKey, Config::get( 'app.cipher' ) );
$encrypted = $newEncrypter->encrypt( $plainTextToEncrypt );
$decrypted = $newEncrypter->decrypt( $encrypted );
Please or to participate in this conversation.