http
가 ssl
을 이용한것이 https
ssl
이란?ssl
로 얻을 수 있는것 ?받은 정보가 내가 원하던 사람이 보낸 정보가 맞나 ?
a키를 가진 사람이 내가 원하던 사람이는 것 보증
sudo apt install linbnss-tools
wget -O mkcert https://github.com/FiloSottile/mkcert/releases/download/v1.4.3/mkcert-v1.4.3-linux-amd64
//mkcert깃클론
chmod +x
sudo cp mkcert /usr/local/bin/
mkcert -install
mkcert -key-file key.pem -cert-file cert.pem localhost 127.0.0.1 ::1
혹은
옵션으로 추가한 example.com 도메인에서 사용할 수 있는 인증서 발급
mkcert -key-file key.pem -cert-file cert.pem example.com *.example.com
const https = require('https');
const fs = require('fs');
https
.createServer(
{
key: fs.readFileSync(__dirname + '/key.pem', 'utf-8'),
cert: fs.readFileSync(__dirname + '/cert.pem', 'utf-8'),
},
function (req, res) {
res.write('Congrats! You made https server now :)');
res.end();
}
)
.listen(3001);
혹은 express
const https = require('https');
const fs = require('fs');
const express = require('express');
const app = express();
https
.createServer(
{
key: fs.readFileSync(__dirname + '/key.pem', 'utf-8'),
cert: fs.readFileSync(__dirname + '/cert.pem', 'utf-8'),
},
app.use('/', (req, res) => {
res.send('Congrats! You made https server now :)');
})
)
.listen(3001);
어떠한 문자열에 임의의 연산(암호화)을 적용하여 다른 문자열로 변환하는 것
암호화 할 값에 어떤 '별도의 값 salt'를 추가하여 결과를 변형한다.
문자열
+ salt값
=>>> hash값
salt
를 사용하여 알고리즘 노출시 위험을 줄여준다.
- salt 는 유저와 패스워드 별로 유일한 값을 가져야함
- 계정생성 및 비번변경이 일어날때마다 새로운 salt필요
- 재사용불가
- DB의 유저테이블에 함께 저장된다.
클라이언트(브라우저) 로컬에 저장되는 키-값
형태의 데이터이다.
Request Header
를 포함한다.cookie: {
domain: 'localhost',
path: '/',
maxAge: 24 * 6 * 60 * 10000,
sameSite: 'None',
httpOnly: true,
secure: true,
},