Как зашифровать пароль в javascript (на стороне клиента) и расшифровать в laravel (на стороне сервера)? [закрыто]Php

Кемеровские программисты php общаются здесь
Anonymous
Как зашифровать пароль в javascript (на стороне клиента) и расшифровать в laravel (на стороне сервера)? [закрыто]

Сообщение Anonymous »

я хочу зашифровать пароль на стороне клиента и пытаюсь зашифровать пароль на стороне сервера с помощью laravel, но это не работает
Перед отправкой я зашифровал пароль в javascript на стороне клиента его на сторону сервера, как показано ниже
function encryptPassword(password, encryptionKey) {
var encryptedPassword = CryptoJS.AES.encrypt(password, encryptionKey).toString();
return encryptedPassword;
}

function encryptAndSubmit() {
var password = document.getElementById('password').value;
var encryptedKey = "used Secret_key here";

// Extract the base64 encoded part of the key
var base64Key = encryptedKey.split(":")[1];

var encryptionKey = CryptoJS.enc.Base64.parse(base64Key);

var encryptedPassword = encryptPassword(password, encryptionKey);

document.getElementById('password').value = encryptedPassword;

document.getElementById('loginForm').submit();
}

и вот как я пытался расшифровать пароль на стороне сервераpublic function authenticate(): void
{
$this->ensureIsNotRateLimited();

// Get the user by email
$user = User::where('email', $this->input('email'))->first();

// Check if the user exists and the passwords match
if ($user && password_verify($this->input('password'), $user->password)) {
// Log in the user
Auth::login($user, $this->boolean('remember'));
} else {
// Increment the rate limiter and throw validation exception
RateLimiter::hit($this->throttleKey());

throw ValidationException::withMessages([
'email' => trans('auth.failed'),
]);
}

// Clear the rate limiter if login is successful
RateLimiter::clear($this->throttleKey());
}


Подробнее здесь: https://stackoverflow.com/questions/781 ... -laravel-o

Вернуться в «Php»