Error Undefined offset 1 in decrypt with openssl line 11

1

I try to decrypt a password and when the password is correct it does not show an error, and if the password is incorrect it shows this: Notice: Undefined offset 1 in C: .... on line 11

public static function decrypt($data, $key) {
    $encryption_key = base64_decode($key);
    list($encrypted_data, $iv) = explode('::', base64_decode($data), 2);// ESTA ES LA LINEA 11
    return openssl_decrypt($encrypted_data, 'RC4', $encryption_key, 0, $iv);
    }
    
asked by Pablo Cripting Step 21.01.2018 в 00:09
source

1 answer

0

I would recommend instead of decrypting the key from the database and comparing it with the password entered by the user, encrypting the password entered by the user and comparing that with the key in the database, it ends up being a better practice for security reasons, since the password always remains encrypted when you log in

    
answered by 21.01.2018 / 02:54
source