OpenSSL์„ ์ด์šฉํ•œ ๋น„๋Œ€์นญํ‚ค ์•”ํ˜ธํ™”
Security

OpenSSL์„ ์ด์šฉํ•œ ๋น„๋Œ€์นญํ‚ค ์•”ํ˜ธํ™”

1. ๋น„๋Œ€์นญํ‚ค ์ƒ์„ฑ

- RSA ์•Œ๊ณ ๋ฆฌ์ฆ˜ ์‚ฌ์šฉ

openssl genrsa -out privatekey.pem
openssl rsa -in privatekey.pem -out publickey.pem -pubout

 

2. ์•”ํ˜ธํ™”

- ๊ณต๊ฐœํ‚ค ์‚ฌ์šฉ

openssl rsautl -encrypt -inkey publickey.pem -in plaintext.txt -pubin -out ciphertext.txt

์•”ํ˜ธ๋ฌธ ํ™•์ธ ๊ฐ€๋Šฅ

 

3. ๋ณตํ˜ธํ™”

- ๋น„๊ณต๊ฐœํ‚ค ์‚ฌ์šฉ

openssl rsautl -decrypt -inkey privatekey.pem -in ciphertext.txt -out plaintext_out.txt

ํ‰๋ฌธ ํ™•์ธ ๊ฐ€๋Šฅ