Fix crash on rekey when password contains a single quote by escaping string