Security 소개
고도몰의 Security 를 소개하는 내용입니다.
📌 Encryptor
대칭 키 암호화 알고리즘인 RIJNDAEL 256
(레인달 256)을 이용하여 정보를 보호할수 있고,
BCRYPT HASH
를 이용해 패스워드를 관리할 수 있습니다.
Encrypt
$encrypted = Encryptor::encrypt('value');
Encrypt with salt string
$encrypted = Encryptor::encrypt('value', 'some salt string');
Decrypt
$decrypted = Encryptor::decrypt('value');
Decrypt with salt string
$decrypted = Encryptor::decrypt('value', 'some salt string');
MySQL AES 호환
MySQL의 AES 함수이 구현되어 있으므로 암호화를 위해 MySQL에 연결하지 않아도 됩니다.
MySQL AES Encrypt
$encrypted = Encryptor::mysqlAesEncrypt('value', 'some encryption key');
MySQL AES Decrypt
$decrypted = Encryptor::mysqlAesDecrypt('value', 'some encryption key');
📌 Password
Hashing
$hash = Password::hash('somepassword');
Verifying
$result = Password::verify('somepassword', $hash);
Re-Hashing
// cost 12
$hash = Password::hash('somepassword', ['cost' => 12]);
// 이후에 cost 가 바뀌거나, hash 알고리즘이 바뀐 경우 (검증은 정상적으로 됨)
if (Password::needsRehash($hash, ['cost' => 20])) {
$hash = Password::hash('somepassword', ['cost' => 20]);
// save...
}
Last updated
Was this helpful?