dimanche 7 août 2022

Laravel Generate key for decrypt password

I am working on a code

if (!function_exists('decrypt_password')) {
    function decrypt_password( $iv, $value)
    {
        $key = config('services.decrypt.key');

        $string_iv =hex_to_string($iv);
        $encrypter = new Encrypter($key, 'AES-256-CBC');

        $dec['iv'] = base64_encode($string_iv);
        $dec['value'] = $value;
        $dec['mac'] = hash_hmac('sha256',  $dec['iv'] . $dec['value'], $key);
       
        return ($encrypter->decrypt(base64_encode(json_encode($dec)),false));
    }
}

this piece of code should make a layer of decrypting the password, and key is missing in config and I can't get one or generate a new one. any help!



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/A2ycxl9
via IFTTT

Aucun commentaire:

Enregistrer un commentaire