Page 113 - Nodejs 교과서 개정2판
P. 113
۾ crypto.getCiphers()ܳ ഐೞݶ ࠅ ࣻ णפ
• cipher.update(문자열, 인코딩, 출력 인코딩) ঐഐചೡ ࢚җ ࢚ ੋ٬ ۱ Ѿҗޛ ੋ٬ਸ
֍णפ ࠁా ޙৌ VUG ੋ٬ਸ ঐഐח CBTF ܳ ݆ ࢎਊפ
• cipher.final(출력 인코딩) ۱ Ѿҗޛ ੋ٬ਸ ֍ਵݶ ঐഐചо ৮ܐؾפ
• crypto.createDecipheriv(알고리즘, 키, iv) ࠂഐചೡ ٸ ࢎਊפ ঐഐചೡ ٸ ࢎਊ೮؍ ঌҊ્ܻ
җ ః ivܳ Ӓ۽ ֍যঠ פ
• decipher.update(문자열, 인코딩, 출력 인코딩) ঐഐചػ ޙ Ӓ ޙ ੋ٬ ࠂഐചೡ ੋ٬ਸ
֍णפ createCipheriv update ীࢲ VUG CBTF ࣽਵ۽ ֍ݶ createDecipheriv update()
ীࢲח CBTF VUG ࣽਵ۽ ֍ਵݶ ؾפ
• decipher.final(출력 ੋ٬ ࠂഐച Ѿҗޛ ੋ٬ਸ ֍णפ
콘솔
$ node cipher
암호화: iiopeG2GsYlk6ccoBoFvEH2EBDMWv1kK9bNuDjYxiN0=
복호화: 암호화할 문장
ਗې ޙਵ۽ ઁ۽ ࠂഐചغणפ
Әө ߓ ݫࢲ٘ ৻ীب DSZQUP ݽٕ নߑೱ ࠺டഋ ঐഐച )."$ ١җ э নೠ ঐഐചܳ ઁ
ҕೞҊ ਵפ ঐഐചо ਃೞݶ ݽٕ যڃ ݫࢲٜ٘ਸ ਗೞח ഛੋ೧ࠁݶ જणפ ֢٘ ҕध ޙࢲ IUU
QT OPEFKT PSH BQJ DSZQUP IUNM ীࢲ ഛੋೡ ࣻ णפ ખ ؊ рױೞѱ ঐഐചܳ ೞҊ रݶ OQN ಁః
ੋ DSZQUP KT IUUQT XXX OQNKT DPN QBDLBHF DSZQUP KT ܳ ୶ୌפ
VUJM
VUJMۄח ܴۢ пઙ ಞ ӝמਸ ݽইك ݽٕੑפ ҅ࣘ೧ࢲ "1*о ୶оغҊ ਵݴ оՔ EFQSFDBUFE
غয ࢎۄח ҃ب णפ
/PUF EFQSFDBUFEۆ
EFQSFDBUFEח ۽Ӓې߁ ਊয۽ rਃبо ڄযઉ ؊ ࢚ ࢎਊغ ঋҊ খਵ۽ח ࢎۄѱ ؼs Ѫۄח ڷੑפ ࢜۽
ӝמ ա৬ࢲ ӝઓ ӝמࠁ ؊ જਸ ٸ ӝઓ ӝמਸ EFQSFDBUFE ܻೞҌ פ ࢎਊܳ ਤ೧ ӝמਸ ઁѢೞח
ঋ݅ ҍ হচ ۽ ؊ ࢚ ࢎਊೞ ݈ۄח ੑפ
VUJMীࢲ ࢎਊغח ف ݫࢲ٘ܳ ࣗѐפ
util.js