หากคุณเคยสงสัยว่าสิ่งต่าง ๆ ได้รับการรักษาความปลอดภัยบนอินเทอร์เน็ตอย่างไร โดยเฉพาะอย่างยิ่งเมื่อพิจารณาว่ามีตัวแทนที่มุ่งร้ายหลายรายที่พยายามทำลายคลังข้อมูลอยู่ตลอดเวลา การเข้ารหัสเป็นหนึ่งในคำตอบที่เหมาะกับคำถามที่สุด

อย่างที่คุณทราบกันดีว่า การเข้ารหัส เป็นเพียงวิธีการหนึ่งที่ใช้ในการปกป้องข้อมูลและการสื่อสาร แต่นั่นไม่ได้หมายความว่าจะง่ายไม่ว่าจะด้วยวิธีใด ๆ อันที่จริง เทคโนโลยีนี้เป็นเทคโนโลยีที่ผ่านการพัฒนาอย่างต่อเนื่องเพื่อให้มั่นใจว่ามาตรฐานที่ใช้นั้นอยู่ในอันดับต้นๆ เสมอ

ตัวอย่างของมาตรฐานดังกล่าวคือ AES ซึ่งเป็นตัวย่อที่คุณอาจเคยพบมาก่อนโดยเฉพาะอย่างยิ่งหากคุณใช้แอปการสื่อสารเช่นซอฟต์แวร์ WhatsApp, Signal หรือ Telegram หรือ VPN เป็นประจำ ในบทความนี้ เราจะเน้นที่ AES และช่วยให้คุณเข้าใจได้ดีขึ้น

การเข้ารหัส AES

AES คืออะไร

AES ซึ่งย่อมาจาก Advanced Encryption Standard เป็นรูปแบบการเข้ารหัสยอดนิยมที่มีการใช้งานมาระยะหนึ่งแล้วเพื่อให้แน่ใจว่าข้อมูลจะถูกเก็บไว้อย่างปลอดภัย จากการสอดรู้สอดเห็น

สิ่งที่ทำให้การเข้ารหัส AES โดดเด่นในที่อื่นคือวิธีการเข้ารหัสที่รวดเร็วและปลอดภัย และความยืดหยุ่นทำให้ใช้งานได้กับผลิตภัณฑ์ที่หลากหลาย ตั้งแต่แอปแบบวันต่อวันอย่าง WhatsApp หรือ ส่งสัญญาณ ไปยังระบบรักษาความปลอดภัยทางทหารและแม้แต่ฮาร์ดแวร์

การเข้ารหัสทำงานอย่างไร

คุณอาจทราบว่าการเข้ารหัสทำงานอย่างไร หากคุณไม่ทำ ให้เตือนความจำสั้นๆ ว่าการเข้ารหัสจะใช้ข้อความธรรมดาและแปลงเป็นรูปแบบที่มีการเข้ารหัส ซึ่งทำให้ดูเหมือนเป็นอักขระแบบสุ่ม พูดได้อย่างปลอดภัยว่า AES เป็นประเภทการเข้ารหัสแบบสมมาตร เนื่องจากใช้คีย์เดียวกันในการเข้ารหัสและถอดรหัสข้อมูล

มาตรฐานการเข้ารหัสนี้ใช้อัลกอริธึมการเปลี่ยนรูปแบบเครือข่าย (อัลกอริทึม SPN) เพื่อใช้การเข้ารหัสหลายรอบเพื่อปกป้องข้อมูล การใช้หลายรอบทำให้ AES แทบเข้าถึงไม่ได้

AES ไม่ได้เป็นเพียงรหัสแรกเท่านั้น แต่ยังเป็นรหัสที่เข้าถึงได้แบบสาธารณะเพียงรหัสเดียวที่ได้รับการอนุมัติจาก NSA (หน่วยงานความมั่นคงแห่งชาติ) ให้ปกป้องข้อมูลลับสุดยอด ในขั้นต้น มาตรฐานการเข้ารหัสนี้เรียกว่า Rijndael ตามชื่อของนักพัฒนาทั้งสองคือ Vincent Rijmen และ Joan Daemen (ทั้งจากเบลเยียม)

AES ความยาวหลายคีย์

AES ประกอบด้วยบล็อกไซเฟอร์สามตัว และแต่ละรหัสบล็อกเหล่านี้มีจำนวนคีย์ผสมที่เป็นไปได้ต่างกันดังนี้:

  • AES-128: ความยาวคีย์ 128 บิต=3.4 * 1038
  • AES-192: ความยาวคีย์ 192 บิต=6.2 * 1057
  • AES-256: ความยาวของคีย์ 256 บิต=1.1 * 1077

แม้ว่าจะมีรหัสบล็อกสามตัว แต่แต่ละตัวเข้ารหัสและถอดรหัสข้อมูลใน 128 บล็อก บิตโดยใช้ความยาวคีย์ที่แตกต่างกัน (เช่น 128, 192 และ 256 ตามที่ระบุไว้ด้านบน) ดังนั้นจึงปลอดภัยที่จะบอกว่าแม้ว่าความยาวของคีย์จะแตกต่างกัน แต่ขนาดบล็อกก็เหมือนกันเสมอ (128 บิตหรือ 16 ไบต์ก็เหมือนกัน)

ความจริงที่ว่า AES ใช้ความยาวของคีย์ที่แตกต่างกันทำให้เกิดคำถามในหมู่ผู้ใช้ เช่น เหตุใดเราจึงต้องมีความยาวคีย์หลายตัวตั้งแต่แรก คนอื่นๆ อาจตั้งคำถามถึงความจำเป็นในการมีความยาวหลายคีย์ ดังนั้นเมื่อพิจารณาว่าคีย์ 256 บิตน่าจะปลอดภัยที่สุด

แม้ว่าคีย์ AES แบบ 256 บิตจะเป็นเพียง แข็งแกร่งที่สุด หนึ่งในกลุ่ม แต่บ่อยครั้งที่มักถูกเรียกว่า”ระดับทหาร”มันไม่ได้ถูกปรับใช้โดยค่าเริ่มต้นเสมอไป และเหตุผล เหตุใดจึงเกิดขึ้นเพราะทรัพยากรที่มีอยู่หรือดีกว่ายังไม่มี

AES-128 เทียบกับ AES-256

ยิ่งคีย์มีขนาดใหญ่เท่าใดก็จะยิ่งใช้ทรัพยากรมากขึ้นเท่านั้นดังนั้นจึงปลอดภัยที่จะกล่าวได้ว่าระบบที่มีความสามารถน้อยมักจะใช้คีย์ 128 บิต AES แทนการใช้คีย์ 256 บิตคู่กัน ตัวอย่างเช่น หากคุณใช้การเข้ารหัส 256 บิต AES บนโทรศัพท์ของคุณ อาจทำให้แบตเตอรี่หมดเร็วกว่ามาตรฐานการเข้ารหัสเดียวกันรุ่น 128 บิต

คีย์ AES 256 บิตนั้นยากต่อการบังคับเดรัจฉานมากกว่าคีย์ 128 บิต อย่างไรก็ตาม แม้จะมีพลังประมวลผลมหาศาล คีย์ AES 128 บิตก็ยังถอดรหัสแทบไม่ได้ ดังนั้นการใช้เวอร์ชันนี้แทนคีย์ 256 บิตอาจเป็นทางเลือกที่ดีกว่าหากคุณกังวลเกี่ยวกับพลังงานหรือเวลาแฝง โดยเฉพาะใน อุปกรณ์พกพา (เช่น สมาร์ทโฟน)

ในด้านสว่างความก้าวหน้าของเทคโนโลยีทำให้ความแตกต่างทั้งในด้านพลังงานคอมพิวเตอร์และอายุการใช้งานแบตเตอรี่ระหว่างการใช้ AES-256 และ AES-128 นั้นมีน้อยมากทำให้ AES แบบ 256 บิตเป็นที่ ได้รับความนิยมมากที่สุด > ทางเลือก เนื่องจากผู้ใช้ส่วนใหญ่ต้องการความสบายใจ

ประโยชน์ของการใช้ AES

AES 256

ความจริงที่ว่าวิธีการเข้ารหัสที่บังคับใช้โดย AES นั้นรวดเร็วและเข้าใจง่าย ทำให้ AES เป็นตัวเลือกยอดนิยมในหลากหลายสาขา AES ไม่เพียง แต่รวดเร็วและปลอดภัย แต่ยัง ใช้งานง่าย อีกด้วยซึ่งช่วยเพิ่มความนิยมโดยธรรมชาติ

นอกจากนี้ ยังสามารถถอดรหัสข้อมูลที่ได้รับการป้องกันได้เร็วที่สุดเท่าที่จะเข้ารหัสได้ และใช้หน่วยความจำและพลังประมวลผลน้อยกว่ามาตรฐานการเข้ารหัสยอดนิยมอื่นๆ (เช่น DES) ซึ่งทำให้ได้เปรียบ

สุดท้ายแต่ไม่ท้ายสุด หากสถานการณ์เรียกร้อง AES มีความยืดหยุ่นเพียงพอที่จะให้คุณรวมเข้ากับโปรโตคอลความปลอดภัยอื่นๆ ได้ เช่น TKIP, WPA2, WEP แต่ยังรวมถึงประเภทการเข้ารหัสอื่นๆ เช่น SSL

ต่อไปนี้คือข้อดีที่สำคัญบางประการของการเลือก AES เหนือมาตรฐานการเข้ารหัสอื่นๆ:

  • รองรับการใช้งานทั้งในฮาร์ดแวร์และซอฟต์แวร์
  • การรองรับความยาวคีย์สามคีย์ทำให้คุณมีความยืดหยุ่นในเรื่องความปลอดภัยและความเร็ว (ประสิทธิภาพ)
  • คีย์ทั้งสามประเภทมีความยาวเพียงพอ ซึ่งทำให้ AES เป็นเป้าหมายที่บังคับไม่ได้
  • จนถึงตอนนี้ ยังไม่มีการพิสูจน์การโจมตีด้วยการเข้ารหัสว่าสามารถต่อต้าน AES ได้
  • คุณสามารถหาพบได้แทบทุกที่ เนื่องจากรัฐบาลสหรัฐฯ กำหนดให้เป็นมาตรฐาน
  • ใช้งานง่ายโดยไม่คำนึงถึงปลายทาง (มีรายงานว่าการใช้ฮาร์ดแวร์ง่ายกว่าซอฟต์แวร์)
  • ไม่ใช้หน่วยความจำมากเท่ากับการเข้ารหัสประเภทอื่นๆ (เช่น DES)
  • ง่ายต่อการรวมเข้ากับโปรโตคอลความปลอดภัยและประเภทการเข้ารหัสอื่น ๆ

การใช้งานทั่วไปของ AES

แม้ว่าเราจะกล่าวไปแล้วว่าโดยทั่วไปจะใช้ AES ในทุกที่ที่ได้รับการสนับสนุน แต่ก็มีบางตัวอย่างที่มีโอกาสเผชิญหน้าสูงกว่า กล่าวคือ:

  • VPN
    • วิธีการทำงานของ VPN คือการกำหนดเส้นทางการรับส่งข้อมูลของคุณใหม่ แต่ไม่ใช่ก่อนที่จะเข้ารหัสเพื่อให้คนอื่นมองไม่เห็นในกรณีที่พวกเขากำลังตรวจสอบการเชื่อมต่อของคุณ ยิ่งไปกว่านั้น การรับส่งข้อมูลจะต้องถูกถอดรหัสที่จุดออก ซึ่งเกี่ยวข้องกับความต้องการมาตรฐานการเข้ารหัส AES-256 ถูกใช้โดยค่าเริ่มต้นโดยผู้ให้บริการ VPN หลายราย รวมถึง NordVPN, Surfshark และ ExpressVPN
  • ผู้จัดการรหัสผ่าน
    • ตัวจัดการรหัสผ่านทำงานโดยให้คุณใส่รหัสผ่านทั้งหมดลงในตัวจัดการและป้องกันด้วยรหัสผ่านเดียวโดยใช้วิธีการเข้ารหัส โซลูชันซอฟต์แวร์การจัดการรหัสผ่านต่างๆ ในตลาดได้เลือก AES เป็นมาตรฐานการเข้ารหัสที่ใช้งานได้ โดยพิจารณาว่าใช้งานง่าย รวดเร็ว และปลอดภัย
  • เครือข่าย Wi-Fi
    • หากไม่มีการเข้ารหัสการรับส่งข้อมูลผู้โจมตีสามารถนั่งอยู่นอกเครือข่ายไร้สายของคุณจับภาพแพ็กเก็ตที่ไม่ได้เข้ารหัสโดยใช้อแด็ปเตอร์ WiFi ที่เหมาะสมและตรวจสอบสถานที่ออนไลน์ทั้งหมดของคุณโดยไม่ต้องดูแลโลก โชคดีที่การเข้ารหัส AES ซึ่งมักจะควบคู่ไปกับมาตรฐานความปลอดภัยเพิ่มเติม (WPA2 เป็นที่นิยมที่สุดในขณะนั้น) สามารถป้องกันไม่ให้สิ่งนี้เกิดขึ้นได้
  • เว็บเบราว์เซอร์
    • คุณอาจรู้อยู่แล้วว่าขณะนี้เว็บเบราว์เซอร์ได้เข้ารหัสการเชื่อมต่อของผู้ใช้แล้ว เพื่อปกป้องพวกเขาจากภัยคุกคามทางไซเบอร์ต่างๆ เช่น การโจมตี MITM (Man-In-The-Middle) การปลอมแปลง หรือการตรวจสอบปริมาณการใช้งาน
    • หลี่>

  • การเข้ารหัสดิสก์
    • แม้ว่าฟีเจอร์นี้ส่วนใหญ่จะใช้กับอุปกรณ์พกพา เช่น สมาร์ทโฟนและแท็บเล็ต แต่การเข้ารหัสดิสก์ของคุณก็ไม่ใช่เรื่องแปลก หากคุณต้องการเพิ่มความเป็นส่วนตัวและความปลอดภัย ปัจจุบัน AES เป็นหนึ่งในวิธีที่นิยมใช้ในการเข้ารหัสและถอดรหัสเนื้อหาในดิสก์
  • ซอฟต์แวร์บีบอัดไฟล์
    • ไม่ว่าจะเป็น WinRar, WinZip หรือ 7z ก็ตามที่เรากำลังพูดถึง ยูทิลิตีการเก็บถาวรและการบีบอัด/คลายการบีบอัดไฟล์ในตลาดใช้ AES เป็นมาตรฐานการเข้ารหัสแบบ go-to เพื่อป้องกันการรั่วไหลของข้อมูลโดยไม่ได้ตั้งใจขณะจัดการไฟล์ของคุณ
    • หลี่>

  • แอปการสื่อสาร
    • WhatsApp, Signal, Telegram, Snapchat, Messenger และอื่นๆ ที่เรายังไม่ได้กล่าวถึง ใช้การเข้ารหัส AES เพื่อให้แน่ใจว่าคุณจะได้รับประโยชน์จากความเป็นส่วนตัวอย่างสมบูรณ์ ไม่ว่าคุณจะส่งรูปภาพ วิดีโอ เอกสาร หรือไฟล์ธรรมดา ข้อความผ่านแอปเหล่านี้
  • ไลบรารีภาษาโปรแกรม
    • หากคุณเป็นโปรแกรมเมอร์ คุณควรรู้ว่าไลบรารีของภาษาการเขียนโปรแกรมบางภาษา ซึ่งรวมถึงแต่ไม่จำกัดเพียง C++, Java และ Python ใช้ประโยชน์จากการเข้ารหัส AES เพื่อช่วยปกป้องข้อมูลและโครงการของคุณจากการเข้าถึงโดยไม่ได้รับอนุญาต
  • ส่วนประกอบของระบบปฏิบัติการ
    • เพื่อเพิ่มชั้นความปลอดภัยเพิ่มเติมระบบปฏิบัติการบางระบบได้เพิ่มการเข้ารหัส AES ให้กับส่วนประกอบบางอย่าง

AES ทำงานอย่างไร

โดยทั่วไปแล้ว คุณจำเป็นต้องรู้หรือเรียนรู้วิธีการทำงานของเทคโนโลยีเฉพาะ เพื่อที่จะได้รับประโยชน์จากความสามารถอย่างเต็มศักยภาพ ในกรณีนี้ คุณควรทราบสิ่งหนึ่งหรือสองอย่างเกี่ยวกับวิธีการทำงานของ AES ก่อนที่จะนำไปใช้หรือใช้งานอย่างไม่ตั้งใจในโครงการของคุณหรือในสภาพแวดล้อมของคุณ

1. ข้อมูลจะถูกแบ่งออกเป็นบล็อค

ดังที่คุณอาจจำได้จากการกล่าวถึงข้างต้น AES คือ บล็อกการเข้ารหัส ซึ่งหมายความว่าจะเข้ารหัสข้อมูลที่ได้รับเป็นบล็อกของบิตซึ่งต่างจากการเข้ารหัสทีละบิต

ดังนั้น ขั้นตอนแรกของการเข้ารหัส AES คือการแยกข้อมูลออกเป็นบล็อค แต่ละบล็อกเหล่านี้มีคอลัมน์ 4 คูณ 4 ที่มีขนาด 128 บิต หรือ 16 ไบต์ เมื่อพิจารณาว่าหนึ่งไบต์ประกอบด้วย 8 บิต เรามี 16 x 8=128 บิต ซึ่งเป็นขนาดของบล็อก

ตัวอย่างเช่น คุณต้องการเข้ารหัส ‘addictivetips.com’ โดยใช้ AES สิ่งแรกที่กระบวนการเข้ารหัสทำคือการแยกข้อมูลออกเป็นบล็อค อย่างไรก็ตาม บล็อกหนึ่งสามารถเก็บได้เพียง 16 อักขระ ดังนั้นบล็อกแรกจะไม่รวม’m’ที่ส่วนท้ายของข้อความ’m’จะถูกส่งไปยังบล็อกถัดไป

ดังนั้นหลังจากใช้ AES กับ” addictivetips.com “ส่วนแรกของข้อความนี้จะมีลักษณะเหมือนบล็อกด้านล่าง:

s
d t t .
ฉัน ฉัน c
ฉัน v p o

2. การขยายคีย์

ขั้นตอนการขยายที่สำคัญซับซ้อนกว่าขั้นตอนที่เราได้อธิบายไว้ข้างต้นเล็กน้อย ต้องใช้คีย์เริ่มต้นและใช้กำหนดการคีย์ของ Rijndael เพื่อสร้างชุดคีย์เพิ่มเติมที่จะใช้สำหรับกระบวนการเข้ารหัสทุกรอบ

ตัวอย่างเช่น หากคุณใช้คีย์ “AESencryption12” ในข้อความธรรมดาของเราด้านบน (addictivetips.com) คุณจะได้รับสตริงที่ดูเหมือนสุ่ม ตัวเลข

o
E n p
c t 1
r ฉัน 2

อย่างไรก็ตาม ตารางคีย์ Rijndael ใช้กระบวนการที่เจาะจงมากในการเข้ารหัสทุกสัญลักษณ์ในวลีเริ่มต้น

ผลลัพธ์จะมีลักษณะเหมือนบล็อกด้านล่าง:

7e 04 0b 20
52 6c 1c 56
a7 bf 8e 84
30 03 3d 20

อีกครั้ง แม้ว่าจะดูเหมือนตัวเลขที่พูดพล่อยๆ และสุ่ม นั่นคือจุดที่แน่นอนของขั้นตอนการเข้ารหัสทั้งหมด: เพื่อซ่อนข้อมูลหลังรหัส ทำให้ผู้ใช้ที่ไม่รู้ว่ารหัสนั้นคืออะไรและทำให้มันเข้าถึงไม่ได้ เป็นไปไม่ได้ที่จะถอดรหัสได้

ยิ่งไปกว่านั้น ยังไม่สิ้นสุด เนื่องจากกระบวนการเข้ารหัสจะต้องใช้คีย์ที่เราเพิ่งสร้างขึ้นสำหรับการเข้ารหัสแต่ละรอบ แต่จะเพิ่มเติมในภายหลัง

3. การเพิ่มแป้นกลม

นี่เป็นการเข้ารหัสรอบแรก เนื่องจากเรากำลังจะเพิ่มคีย์เริ่มต้น (‘การเข้ารหัส AES12‘) ลงในบล็อกข้อความของเรา (‘addictivetips.com‘) ดังตัวอย่างด้านล่าง ซึ่งอาจไม่เข้าใจในตอนแรก

s
d t t .
d ฉัน ฉัน c
ฉัน v p o

และ

o
E p n
c t 1
  r ฉัน 2

แม้ว่าอาจรู้สึกว่าเป็นไปไม่ได้ที่จะเพิ่มข้อความสองช่วงตึกเข้าด้วยกัน แต่โปรดจำไว้ว่านี่เป็นเพียงการแสดงภาพกราฟิกของกระบวนการเข้ารหัสเพื่อให้คุณเข้าใจได้ดีขึ้น ในความเป็นจริง AES ใช้ รหัสไบนารี ทำให้เราพยายามเพิ่มสองช่วงของข้อความไม่เพียง แต่เป็นไปได้อย่างสมบูรณ์ แต่ยังเป็นไปได้ทั้งหมดด้วย

การดำเนินการนี้ (ของการเพิ่มข้อความสองช่วงด้วยกัน) ทำได้โดยใช้ รหัส XOR และผลลัพธ์สามารถดูได้ที่ด้านล่าง:

32 d5 5c d9
f3 24 a8 46
7e 1c 37 f3
82 5e 3f 03

4. การแทนที่ไบต์

เพื่อปรับปรุงการปกป้องข้อมูลของคุณให้ดียิ่งขึ้น (ในกรณีของเราคือข้อความธรรมดาที่เรากำลังพยายามเข้ารหัส) ขั้นตอนนี้ของกระบวนการนี้จะแทนที่แต่ละไบต์ของบล็อกด้วยค่าที่กำหนดไว้ล่วงหน้าตามตารางที่เรียกว่า Rijndael S-box คุณสามารถดูตารางด้านล่าง:

  00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f
00 63 7c 77 7b f2 6b 6f c5 30 01 67 2b เฟ d7 ab 76
10 ca 82 c9 7d ฟะ 59 47 f0 โฆษณา d4 a2 af 9c a4 72 c0
20 b7 fd 93 26 36 3f f7 cc 34 a5 e5 f1 71 d8 31 15
30 04 c7 23 c3 18 96 05 9a 07 12 80 e2 eb 27 b2 75
40 09 83 2c 1a 1b 6e 5a a0 52 3b d6 b3 29 e3 2f 84
50 53 d1 00 เอ็ด 20 fc b1 5b 6a cb เป็น 39 4a 4c 58 cf
60 d0 ef aa fb 43 4d 33 85 45 f9 02 7f 50 3c 9f a8
70 51 a3 40 8f 92 9d 38 f5 bc b6 ดา 21 10 ff f3 d2
80 cd 0c 13 ec 5f 97 44 17 c4 a7 7e 3d 64 5d 19 73
90 60 81 4f dc 22 2a 90 88 46 อี b8 14 เริ่มต้น 5e 0b db
a0 e0 32 3a 0a 49 06 24 5c c2 d3 ac 62 91 95 e4 79
b0 e7 c8 37 6d 8 วัน d5 4e a9 6c 56 f4 ea 65 7a เอะ 08
c0 ba 78 25 2e 1c a6 b4 c6 e8 dd 74 1f 4b bd 8b 8a
d0 70 3e b5 66 48 03 f6 0e 61 35 57 b9 86 c1 1d 9e
e0 e1 f8 98 11 69 d9 8e 94 9b 1e 87 e9 ซี 55 28 df
f0 8c a1 89 0d bf e6 42 68 41 99 2d 0f b0 54 bb 16

แม้ว่าตารางนี้จะดูเหมือนชุดอักขระสุ่ม คุณสามารถใช้เพื่อตรวจสอบว่าค่าใดที่ไบต์ที่ถูกแทนที่จะมีค่า ตัวอย่างเช่น c9 จะกลายเป็น dd, 26 จะกลายเป็น f7, ff จะ กลายเป็น 16 และในไม่ช้า ใช้งานได้ไม่ยากเมื่อคุณชินแล้ว

p

ตอนนี้เราได้เห็นตารางแล้วเรามาดูกันว่าบล็อกใหม่ที่เราสร้างขึ้นข้างต้นจากการเข้ารหัสรอบแรกจะเปลี่ยนไปอย่างไรหลังจากการแทนที่ไบต์ตามกล่อง Rijndael S:

23 03 4a 35
0d 36 c2 5a
f3 9c 9a 0d
13 58 75 7b

โปรดทราบว่าจริงๆแล้วเราได้แทนที่การบล็อกโดยใช้ตาราง Rijndael S-box ด้วยตนเอง ดังนั้นคุณสามารถตรวจสอบอีกครั้งและพยายามจำลองผลลัพธ์ได้หากคุณสนใจ วิธีนี้จะทำให้คุณติดตามได้ง่ายขึ้น โดยเฉพาะอย่างยิ่งหากคุณหลงใหลในการเรียนรู้เพิ่มเติมเกี่ยวกับการเข้ารหัส

5. การเปลี่ยนแถว

ในขั้นตอนนี้ของกระบวนการเข้ารหัส AES แถวต่างๆ จะถูกย้ายเพื่อใส่ข้อมูลของคุณไว้เบื้องหลังกำแพงการป้องกันเพิ่มเติม ในขณะที่แถวแรกยังคงไม่ถูกแตะต้อง แถวสามแถวถัดไปจะเปลี่ยนไปในลักษณะต่างๆ ดังนี้:

  • แถว วินาที ถูกเลื่อนไปทางซ้าย หนึ่ง ไบต์ (เซลล์)
  • แถว ที่สาม ถูกเลื่อนไปทางซ้าย สอง ไบต์ (เซลล์)
  • แถวที่ ที่สี่ และสุดท้ายถูกเลื่อนไปทางซ้าย สาม ไบต์ (เซลล์)
23 03 4a 35
36 c2 5a 0d
9a 0d f3 9c
7b 13 58 75

6. การผสมคอลัมน์

แม้ว่าเราอยากที่จะรักษาความถูกต้องให้มากที่สุดเท่าที่จะเป็นไปได้ ขั้นตอนนี้เกี่ยวข้องกับการใช้ชุดสูตรทางคณิตศาสตร์ที่ซับซ้อนกับบล็อก ซึ่งทำให้เรามีบล็อกที่ต่างไปจากเดิมอย่างสิ้นเชิงเมื่อสิ้นสุดขั้นตอน

เพื่อให้มีความเฉพาะเจาะจงขึ้นอีกเล็กน้อย แต่ละคอลัมน์จะถูกคูณด้วยเมทริกซ์ที่กำหนดไว้ล่วงหน้าในระหว่างขั้นตอนนี้ ผลลัพธ์จะเป็นบล็อกโค้ดใหม่ ซึ่งจะนำไปใช้เพื่อเพิ่มความแข็งแกร่งของรหัสลับ และลดโอกาสที่รหัสจะถูกเปิดออกในวงกว้าง

เมื่อสิ้นสุดกระบวนการผสมคอลัมน์ เราจะได้รับบล็อกโค้ดที่มีลักษณะดังนี้:

43 4d 33 85
c8 37 6d 8d
9a 33 85 9c
42 68 41 99

7. เพิ่มคีย์รอบพิเศษ

จำได้ไหมว่าก่อนหน้านี้เราได้บอกคุณว่าเราต้องการคีย์ที่เราสร้างขึ้นในระหว่างขั้นตอนการขยายคีย์ เราเคยใช้มันมาแล้วครั้งหนึ่งในการแย่งชิงทุกอย่าง ตอนนี้เราจะต้องการแย่งชิงกับข้อมูลที่เราเพิ่งได้รับมาอีกครั้ง

ดังนั้นเราจึงนำบล็อกข้อมูลที่เราได้รับหลังจากรันขั้นตอนการผสมคอลัมน์ และเพิ่มคีย์กลมอีกอันเข้าไป เช่นเดียวกับที่เราทำในขั้นตอนที่ 3 ในคำแนะนำของเรา ดังนี้:

43 4d 33 85
c8 37 6d 8d
9a 33 85 9c
42 68 41 99

และ

32 d5 5c d9
f3 24 a8 46
7e 1c 37 f3
82 5e 3f 03

As you’d expect, this step will generate yet another block of data for us to process, but we’ll stop here. We have a feeling that you got the point. However, the encryption process is still far from being over, as the block of data we just generated will undergo several more modifications.

8. More steps

These modifications that we’ve mentioned above include everything we’ve done so far: shifting rows, byte substitution, adding round keys, and mixing columns, so it’s easy to understand why we had to stop here as far as exemplifying goes.

These rounds are identical and the number of times these rounds are repeated depend on the AES key length, as follows:

  • AES-128 uses 9 rounds
  • AES-192 uses 11 rounds
  • AES-256 uses 13 rounds

So if you’re planning to use AES-256, the steps we’ve previously mentioned and explained will be repeated 13 times in a row, which you can agree is a tremendous amount. It’s also easy to understand why AES is so difficult to crack and is a go-to encryption standard in a lot of environments.

However, we’re not done yet. After the 9, 11, or 13 rounds of encryption we’ve briefly talked about above, there’s an additional round, during which the algorithm only substitutes bytes, shifts rows, and adds a round key (it skips mixing columns).

It may sound ridiculous that after 9, 11, or 13 rounds of running all the steps above the mixing columns step gets dropped. The reason is that at this point it’s somewhat redundant, and this step is skipped only to preserve some processing power.

So actually, after running all the steps of the encryption process, the input data (our plaintext we’ve used in the beginning in this case) will have gone through 10, 12, or 14 rounds, depending on the key length you chose and will look like a set of random characters. Not that it didn’t look like that for a long time now, since we started the encryption process and all.

So, to recap, while undergoing encryption, the data you feed to the AES encryption tools undergoes the following processes, in this order:

  1. Block division
  2. Key expansion
  3. Adding a round key
  4. Byte substitution
  5. Row shifting
  6. Column mixing
  7. Adding a round key
  8. Steps 4-7 are repeated for 9, 11, or 13 times depending on the key length
  9. Byte substitution
  10. Row shifting
  11. Adding a round key

At the end of this complex and seemingly endless process, addictivetips.com, the text we’ve attempted to encrypt, will look like the code below if encrypted using a 128-bit key and ‘AESencryption12‘ as our secret key:

  • RcadDaLDuP5fHtor3/Rfnq5EijEfhP02pvrlGkGr1Gc=

Although it may look like complete gibberish, once again, that’s the point of using encryption: making data as simple as plain text look like something went horribly wrong during its transmission and now it looks like gibberish.

How to decrypt AES

We understand that AES and the whole encryption process can be a bit of a handful, as the multitude of steps, as well as the fact that they’re repeated for an ungodly amount of time, can be a bit intimidating.

However, if you take a step back and look at the big picture, the whole thing actually starts to make sense, even for someone who didn’t spend their whole life studying cryptography and designing the perfect way to encrypt or decrypt information.

That’s precisely why we’re pretty confident you’ll have no trouble understanding AES decryption if the encryption process along with all of its steps made sense to you. To put it shortly, AES decryption follows the exact same steps as the encryption process, only they’re reversed.

So, in our case, if we want to go back to ‘addictivetips.com’ from RcadDaLDuP5fHtor3/Rfnq5EijEfhP02pvrlGkGr1Gc=, all we have to do is trace our steps back up until we reach the initial one, like so:

  1. Inverse adding round key
  2. Inverse row shifting
  3. Inverse byte substitution
  4. Inverse adding round key
  5. Inverse column mixing
  6. Inverse row shifting
  7. Inverse byte substitution
  8. Repeat steps 4-7 for 9, 11, or 13 times depending on key length
  9. Inverse add round key

After performing all the steps above, we should end up with our original text fragment, ‘addictivetips.com’.

Is AES encryption secure?

AES encryption examples

One of the most pressing questions when it comes to all encryption standards (not only AES) is if it can provide you with an optimum level of security. In this case, the question would be: is AES encryption secure?

Although you could see for yourself that this encryption standard deploys a huge number of steps, each of which scrambles the original text and twists it beyond recognition, this didn’t seem to stop attackers from designing potential ways to circumvent these means of protection.

Note that in a real-life situation, an attacker (commonly known as a hacker or cracker) won’t go after the tallest, thickest wall in its attempt to invade the virtual fortress that is your PC, database, archive, or whatever you’re trying to protect.

Instead, they will circle the proverbial walls several times trying to find any cracks worth exploiting, and then start drilling there. In our situation, attackers may want to spot any vulnerabilities in the AES encryption process and start working their way up from there.

Thankfully, cryptography researchers constantly try to find vulnerabilities with the AES encryption process, so as to be able to prevent a potential attack from someone who discovers the flaws first and (obviously) doesn’t share them with the whole world.

Up until now, the researchers have been able to identify a series of attacks that could compromise AES, but these are either purely theoretical, side-channel attacks, or cracking attempts with a known security key, as you’ll soon learn from the following sections.

1. Known-key distinguishing attack

An attack that used a known key was designed by cryptography researchers and observed in action, and it showed some promising results. The attack was introduced in 2007 by Vincent Rijmen and Lars Knudsen.

While that’s not exactly great for the AES encryption method, this attack had two flaws that make it unlikely to be used in a real-life scenario: the fact that it used a known key, and that it was tested against a seven-round version of AES-128.

Considering that most of the time the key is not known to the attacker (unless they happen to just stumble upon it with precise instructions regarding its purpose) and that AES-128 has 10 rounds of encryption, everyday AES-128 can rest assured that the attack is not likely to occur.

The fact that most services that offer AES-128 also feature native support for AES-256 means that boosting your encryption couldn’t be easier in case you’re worried about being targeted by a known-key distinguishing attack.

2. Related key attack

Related key attacks are more of a category, as they represent all forms of cryptanalysis where attackers can analyze the way a cipher works under multiple keys. In this type of attack, the attacker doesn’t know the values of the keys used in the cipher.

However, although unknown, the keys also have some sort of mathematical relation one to another, which the attacker does know. One of the simplest examples would be that the attacker knows that the first 16 bits of the keys are always the same, but has no idea what the bits actually are.

Although related key attacks could be successful if applied correctly, they are of no real concern in the real world. In order for such an attack to work, an attacker would need to successfully persuade a cryptographer to encrypt data using various secret keys that are connected to each other mathematically, then share the secret with the attacker.

Thus, this type of attack servers merely as a reminder that human error could contribute to putting some kinks in the AES armor by being subject to poor implementation of this encryption standard.

3. Side-channel attack

Although AES is, at the time being, virtually uncrackable, there have been many attempts to design theoretical attacks that could demonstrate some of this encryption standard’s vulnerabilities.

Even if it’s been 20 years since AES has been introduced, and technology has made some huge advancements over these past 20 years, the amount of computing power needed to brute-force AES is still not enough, and we’d still need billions of years to be able to crack it.

However, a different breed of attempts to break the security of AES encryption is the side-channel attack. This type of attack combines multiple types of data leaks to extract enough data from an algorithm that it can be cracked.

For instance, attackers could focus on power consumption, electromagnetic radiation, the time it takes various computations to be performed, and even the sounds produced during computation to extract more information about the algorithm.

There are several classes of side-channel, including:

  • Timing attacks
    • Timing attacks revolve around measuring the time it takes for certain computations to be performed (for instance comparing a known password against an unknown one).
  • Cache attacks
    • These attacks are only viable if the attacker can access some of the victim’s caches in various environments, whether it’s virtualization environments (virtual machines), shared physical systems, or cloud services we’re talking about.
  • Electromagnetic attacks
    • Electromagnetic attacks are based on electromagnetic radiation leaks, which can be used to extract various bits of information. Measuring electromagnetic radiation leaks can sometimes lead to discovering cryptographic keys.
  • Power-monitoring attacks
    • Attackers monitor the power consumption of the hardware during certain computation steps in order to extract information about the algorithm.
  • Acoustic cryptanalisis
    • Similar to the power-monitoring attacks, but attackers listen to and analyze the sounds that hardware makes when performing certain computation steps and extract information from these findings.
  • Data remanence
    • This type of attack revolves around sensitive data that can still be accessed and read even after being deleted.
  • Optical analysis
    • In this complex type of attack, high-resolution cameras are used to capture secrets or sensitive data (such as analyzing hard disk activity indicators or transistors switching states).
  • Differential fault analysis
    • This type of attack is based on discovering secrets by inputting faults in computation in order to trigger an error.

Although you can agree that these side-channels are nothing short of creative and their authors can use them to turn even the most seemingly insignificant detail into a veritable piece of information, they only work if the system being audited is leaking information.

For that reason, avoiding side-channel attacks can be easily achieved either by making sure that the systems that could be attacked don’t leak any data or by ensuring that there’s no association between the algorithmic processes and leaked data, regardless of its nature.

4. Key recovery attacks

Last, but not least, the key recovery attacks are a tough contestant when it comes to efficient ways to crack AES encryption. In 2011, such an attack was attempted to prove its efficacy against the AES encryption mechanism.

This type of attack is not exactly likely to occur, seeing as it involves the attacker getting its hands on at least a pair of encrypted and decrypted messages from the soon-to-be-compromised system.

The attack showed promising results, as it was approximately four times as fast as brute-forcing. However, considering that a brute-force attack would take literally billions of years to complete, key recovery attacks are still far from being ideal, which makes them unlikely to be used in an attack.

Furthermore, even if it took a shorter amount of time to complete, changing the security key often could render the pair of encrypted and decrypted messages useless.

Is AES secure?

Considering everything you’ve learned by going through this guide, we think that you can be the judge of whether or not AES is a safe encryption standard.

AES has been around since 2001, and since its introduction, there were numerous attempts to break it, which makes it safe to say that it stood the test of time, and it’s still a solid choice when it comes to encryption algorithms.

The sheer amount of steps the algorithmic process goes through in order to make the data unreadable is tremendous, and it would take literally billions of years to crack AES, even with today’s computation power and technology advancements.

So, to answer your question considering all of the above: yes, AES is secure. Even AES-128 proved to be downright impossible to crack, not to mention its more powerful counterparts, AES-192, and AES-256.

AES Encryption – CONCLUSION

All things considered, after reading our extensive guide we hope you learned more about AES, including how it works, what processes it goes through during the encryption process, where it can be used, and how it could be (at a theoretical level) compromised.

The fact that 20 years after its introduction it’s still fast, secure, and can be implemented on a huge variety of hardware and software environments makes it truly deserve its title of being the “gold standard” of encryption techniques.

Categories: IT Info