moosongsong / project-ssl-security-c

๐Ÿ“œ ๋ˆ์•„๋ฆฌ : SSL ์—ฐ๊ฒฐ๊ณผ ์ธ์ฆ์„œ๋ฅผ ์ด์šฉํ•œ ์„œ๋ฒ„ ์š”์ฒญ ํ”„๋กœ์ ํŠธ ๐Ÿ“œ

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

๋ณด์•ˆ ํ”„๋กœ๊ทธ๋ž˜๋ฐ

1. ์ปดํŒŒ์ผ ๊ณผ์ •

gcc -g -Wall -pthread -c reentrant.c -o reentrant.o gcc -g -Wall -pthread -c common.c -o common.o

gcc -g -Wall -pthread -c client.c -o client.o gcc -g -Wall -pthread -c server.c -o server.o

gcc -g -Wall -pthread -o client client.o common.o reentrant.o -lssl -lcrypto gcc -g -Wall -pthread -o server server.o common.o reentrant.o -lssl -lcrypto

2. ์ธ์ฆ์„œ ๋งŒ๋“ค๊ธฐ

/usr/bin/openssl req -newkey rsa:1024 -sha1 -keyout rootkey.pem -out rootreq.pem -config root.cnf

/usr/bin/openssl x509 -req -in rootreq.pem -sha1 -extfile root.cnf -extensions certificate_extensions -signkey rootkey.pem -out rootcert.pem

/bin/cat rootcert.pem rootkey.pem > root.pem

/usr/bin/openssl req -newkey rsa:1024 -sha1 -keyout serverCAkey.pem -out serverCAreq.pem -config serverCA.cnf

/usr/bin/openssl x509 -req -in serverCAreq.pem -sha1 -extfile serverCA.cnf -extensions certificate_extensions -CA root.pem -CAkey root.pem -CAcreateserial -out serverCAcert.pem

/bin/cat serverCAcert.pem serverCAkey.pem rootcert.pem > serverCA.pem

/usr/bin/openssl req -newkey rsa:1024 -sha1 -keyout serverkey.pem -out serverreq.pem -config server.cnf -reqexts req_extensions

/usr/bin/openssl x509 -req -in serverreq.pem -sha1 -extfile server.cnf -extensions certificate_extensions -CA serverCA.pem -CAkey serverCA.pem -CAcreateserial -out servercert.pem

/bin/cat servercert.pem serverkey.pem serverCAcert.pem rootcert.pem > server.pem

/usr/bin/openssl req -newkey rsa:1024 -sha1 -keyout clientkey.pem -out clientreq.pem -config client.cnf -reqexts req_extensions

/usr/bin/openssl x509 -req -in clientreq.pem -sha1 -extfile client.cnf -extensions certificate_extensions -CA root.pem -CAkey root.pem -CAcreateserial -out clientcert.pem

/bin/cat clientcert.pem clientkey.pem rootcert.pem > client.pem

3. ์‹คํ–‰๊ณผ์ •

1) ./server ์‹คํ–‰ -> ์ธ์ฆ์„œ ๋งŒ๋“ค๋•Œ ์‚ฌ์šฉํ–ˆ๋˜ ๋น„๋ฐ€๋ฒˆํ˜ธ ์ž…๋ ฅ
2) ./client ์‹คํ–‰ (๋‹ค์ค‘์‹คํ–‰๊ฐ€๋Šฅ) -> ์ธ์ฆ์„œ ๋งŒ๋“ค๋•Œ ์‚ฌ์šฉํ–ˆ๋˜ ๋น„๋ฐ€๋ฒˆํ˜ธ ์ž…๋ ฅ
3) client, server ์ข…๋ฃŒ์‹œ Ctrl + c ๋กœ ์ข…๋ฃŒ

cf) zipํŒŒ์ผ์— ์ œ๊ณต๋œ ์ธ์ฆ์„œ์˜ ๋น„๋ฐ€๋ฒˆํ˜ธ๋Š” 130613์ž…๋‹ˆ๋‹ค.

About

๐Ÿ“œ ๋ˆ์•„๋ฆฌ : SSL ์—ฐ๊ฒฐ๊ณผ ์ธ์ฆ์„œ๋ฅผ ์ด์šฉํ•œ ์„œ๋ฒ„ ์š”์ฒญ ํ”„๋กœ์ ํŠธ ๐Ÿ“œ


Languages

Language:C 100.0%