Chức năng chính

Một phần của tài liệu vấn đề bảo mật mạng wimax và ứng dụng (Trang 68 - 81)

Chương trình cho phép thực hiện các chức năng sau: - Mã hóa một File văn bản.

4.2 HƢỚNG DẪN SỬ DỤNG CÁC CHỨC NĂNG CHÍNH 4.2.1 Giao diện chƣơng trình

Mở File cần mãhóa hoặc giải

Lƣu file đã mã hóa hoặc giải

Kết quả mã hóa, giải mã

Mã hóa Giải mã

4.2.2 Quy trình mã hóa

Bƣớc 1: Mở trang Web mã hóa AES.

Bƣớc 2: Mở File cần mã hóa, nhấn nút Browse ở phần Load file Encryption and Decryption.

Bƣớc 3: Nhập vào Khóa mã hóa, ở phần Input Key. Bƣớc 4: Mã hóa, nhấn vào nút File Encryption. Bƣớc 6: Lưu File đã được mã hóa, nhấn nút Save.

4.2.3 Quy trình giải mã

Bƣớc 1: Mở trang Web mã hóa AES.

Bƣớc 2: Mở File giải mã, nhấn nút Browse ở phần Load file Encryption and Decryption.

Bƣớc 3: Nhập vào Khóa mã hóa, ở phần Input Key. Bƣớc 4: Giải mã, nhấn vào nút File Decryption. Bƣớc 6: Lưu File đã được giải mã, nhấn Save.

4.3 CÁC MODULE CHÍNH TRONG CHƢƠNG TRÌNH

// Mã hóa

public override string EncryptionStart(string PlainText, string CipherKey, bool IsTextBinary)

{

StringBuilder binaryText = null; if (IsTextBinary == false) { PlainText = BaseTransform.FromTextToBinary(PlainText); } else { binaryText = new StringBuilder(BaseTransform.setTextMutipleOf128Bits(PlainText)); StringBuilder EncryptedTextBuilder = new

StringBuilder(binaryText.Length);

#region Make All-round keys Matrix Matrix_CipherKey = new

Matrix(BaseTransform.FromHexToBinary(CipherKey)); Keys key = new Keys();

key.setCipherKey(Matrix_CipherKey); key = this.KeyExpansion(key, false); #endregion

#region Initialize Progress Bar

OnInitProgress(new ProgressInitArgs(binaryText.Length)); #endregion

for (int j = 0; j < (binaryText.Length / 128); j++) {

Matrix state = new

Matrix(binaryText.ToString().Substring(j * 128, 128)); state = this.AddRoundKey(state, key, 0); for (int i = 1; i < 11; i++)

{

if (i == 10) {

state = this.SubBytes(state, false); state = this.ShiftRows(state, false); state = this.AddRoundKey(state, key, i); }

else {

state = this.SubBytes(state, false); state = this.ShiftRows(state, false); state = this.MixColumns(state, false);

state = this.AddRoundKey(state, key, i); }

}

EncryptedTextBuilder.Append(state.ToString()); #region Increase Progress Bar

OnIncrementProgress(new ProgressEventArgs(state.ToString().Length)); #endregion } return EncryptedTextBuilder.ToString(); } //Giải mã

public override string DecryptionStart(string PlainText, string CipherKey, bool IsTextBinary)

{ string binaryText = ""; if (IsTextBinary == false) { binaryText = BaseTransform.FromTextToBinary(PlainText); } else { binaryText = PlainText; }

StringBuilder DecryptedTextBuilder = new StringBuilder(binaryText.Length);

#region Make All-round keys Matrix Matrix_CipherKey = new

Matrix(BaseTransform.FromHexToBinary(CipherKey)); Keys key = new Keys();

key.setCipherKey(Matrix_CipherKey); key = this.KeyExpansion(key, false); #endregion

#region Initialize Progress Bar

OnInitProgress(new ProgressInitArgs(binaryText.Length)); #endregion

for (int j = 0; j < (binaryText.Length / 128); j++) {

Matrix state = new Matrix(binaryText.Substring(j * 128, 128));

state = this.AddRoundKey(state, key, 10); for (int i = 9; i >= 0; i--)

{

if (i == 0) {

state = this.SubBytes(state, true);

state = this.AddRoundKey(state, key, i); }

else {

state = this.ShiftRows(state, true); state = this.SubBytes(state, true); state = this.AddRoundKey(state, key, i); state = this.MixColumns(state, true); }

}

#region It's for correct subtracted '0' that have added for set text multiple of 128bit

if ((j * 128 + 128) == binaryText.Length) {

StringBuilder last_text = new StringBuilder(state.ToString().TrimEnd('0'));

int count = state.ToString().Length - last_text.Length; if ((count % 8) != 0) { count = 8 - (count % 8); } string append_text = "";

for (int k = 0; k < count; k++) { append_text += "0"; } DecryptedTextBuilder.Append(last_text.ToString() + append_text); } #endregion else { DecryptedTextBuilder.Append(state.ToString()); }

#region Increase Progress Bar OnIncrementProgress(new ProgressEventArgs(state.ToString().Length)); #endregion } return DecryptedTextBuilder.ToString(); } #endregion //Hàm SubBytes #region SubBytes

public Matrix SubBytes(Matrix state, bool IsReverse) {

for (int i = 0; i < state.Rows; i++)

{

for (int j = 0; j < state.Columns; j++) {

int row = Convert.ToInt32(state[i, j].Substring(0, 4), 2); int column = Convert.ToInt32(state[i, j].Substring(4, 4), 2); if (IsReverse == false) {

state[i, j] = TransformTables.sbox[row, column]; } else { state[i, j] = TransformTables.inverse_sbox[row, column]; } } } return state; } #endregion //Hàm ShiftRows #region ShiftRows public Matrix ShiftRows(Matrix state, bool IsReverse) {

for (int i = 1; i < state.Rows; i++) { if (IsReverse == false) { state.setRow(this.CircularLeftShift(state.getRow(i), i) , i); } else { state.setRow(this.CircularRightShift(state.getRow(i), i) , i); } } return state; }

private string[] CircularLeftShift(string[] row, int count) {

for (int i = 0; i < count; i++) {

string temp = row[0]; row[0] = row[1]; row[1] = row[2]; row[2] = row[3]; row[3] = temp; } return row;

}

private string[] CircularRightShift(string[] row, int count) {

for (int i = 0; i < count; i++) {

string temp = row[3]; row[3] = row[2]; row[2] = row[1]; row[1] = row[0]; row[0] = temp; } return row; } #endregion //Hàm MixColumns #region MixColumns

public Matrix MixColumns(Matrix state, bool IsReverse) { if (IsReverse == false) { state = MatrixMultiplication.Multiply(TransformTables.MixColumnFactor, state, true); } else { state = MatrixMultiplication.Multiply(TransformTables.Inverse_MixColumnFactor, state, true); } return state; } #endregion //Hàm AddRoundKey #region AddRoundKey

public Matrix AddRoundKey(Matrix state, Keys key, int Round) {

if (Round > key.RoundKeys.Count - 1) {

throw new IndexOutOfRangeException("The round key is must between 0 and 10 in 128bit AES.");

} return MatrixMultiplication.XOR(state, key.RoundKeys[Round]); } #endregion #region KeySchedule

public Keys KeyExpansion(Keys key, bool IsReverse) {

for (int i = 4; i < key.RoundKeys.Count * 4; i++) {

string[] Wi_1 = key.RoundKeys[(i - 1) / 4].getWord((i - 1) % 4);

Matrix mat_Wi_1 = new Matrix(4, 1); mat_Wi_1.setWord(Wi_1, 0);

if (i % 4 == 0) {

Wi_1 = this.RotWord(Wi_1); mat_Wi_1.setWord(Wi_1, 0);

mat_Wi_1 = this.SubBytes(mat_Wi_1, false);

mat_Wi_1 = MatrixMultiplication.XOR(mat_Wi_1,

TransformTables.Rcon[(i-1)/4]);

}

Matrix Wi_4 = new Matrix(4, 1);

Wi_4.setWord(key.RoundKeys[(i - 4) / 4].getWord((i - 4) % 4), 0);

Matrix temp = MatrixMultiplication.XOR(mat_Wi_1, Wi_4); string[] Wi = temp.getWord(0);

key.RoundKeys[i / 4].setWord(Wi, i % 4); }

return key; }

private string[] RotWord(string[] state) {

return this.CircularLeftShift(state, 1); }

KẾT LUẬN

Wimax là công nghệ không dây đang nhận được nhiều sự quan tâm hiện nay. Tuy nhiên, cũng giống như các mạng không dây khác, nhược điểm lớn nhất của Wimax là tính bảo mật do sự chia sẻ môi trường truyền dẫn và những lỗ hổng tại cơ sở hạ tầng vật lý. Mặc dù vấn đề bảo mật được coi là một trong những vấn đề chính trong quá trình xây dựng giao thức mạng của IEEE nhưng kỹ thuật bảo mật mà IEEE qui định trong IEEE 802.16 (WiMAX) vẫn tồn tại nhiều nhược điểm. Việc xây dựng các thuật toán mã hóa, để mã hóa dữ liệu trên đường truyền của mạng Wimax được coi là một trong những giải pháp có nhiều triển vọng và kinh tế nhất trong việc đảm bảo an toàn dữ liệu trên đường truyền.

Luận văn tập trung tìm hiểu cấu trúc của mạng Wimax, quy trình bảo mật và tìm ra các điểm yếu trong quy trình bảo mật của mạng Wimax, từ đó làm cơ sở để xây dựng phương án khắc phục. Nhằm đảm bảo an toàn và bảo mật thông tin khi truyền trên mạng Wimax. Bên cạnh đó, việc tìm hiểu và xây dựng thuật toán mã hóa AES cũng hỗ trợ và tăng mức độ an toàn trong việc truyền tin qua mạng Wimax, có thể khắc phục phần nào hạn chế trong kiến trúc bảo mật của mạng Wimax.

Luận văn đã đạt được các kết quả chính sau:

1). Nghiên cứu tài liệu để tổng hợp lại các vấn đề:

+ Cấu trúc và đặc điểm của mạng Wimax.

+ Kiến trúc và quy trình bảo mật trong mạng Wimax.

+ Ứng dụng thuật toán mã hóa AES, mã hóa dữ liệu truyền trên mạng Wimax.

2). Xây dựng thử nghiệm chương trình với các chức năng sau:

+ Mã hóa File văn bản truyền trên mạng Wimax.

+ Giải mã một File văn bản đã được mã hóa.

Hướng phát triển luận văn: nghiên cứu và xây dựng chương trình mã hóa hoàn thiện để ứng dụng gửi đề thi qua mạng Wimax, tại các tỉnh miền núi.

TÀI LIỆU THAM KHẢO

TIẾNG VIỆT

[V1] Đỗ Ngọc Anh, Wimax di động – Tổng quan kỹ thuật đánh giá, tạp chí BCVT, 03-11-2006.

[V2] Nguyễn Thế Anh, Bùi Thị Ngọc Huyền, Nguyễn Thị Tới, Nguyễn Thị Quỳnh Trang, Bảo mật trong Wimax, D04VT1, Tháng 10/2007.

[V3] Nguyễn Bình, Giáo trình mật mã học. NXB Bưu điện 01/2004.

[V4] Lê Bá Dũng, Bài giảng mạng Wimax cho lớp cao học Điện tử - truyền thông viện Mở

[V5] Nguyễn Việt Hùng (5/2007), Công nghệ truy cập mạng NGN – Tổng công ty Bưu chính Viễn thông Việt Nam – Học viện công nghệ Bưu chính Viễn thông.

[V6] Nguyễn Quốc Khương, Nguyễn Văn Đức, Nguyễn Trung Kiên, Nguyễn Thu Hà (13/03/2006), Wimax - Công nghệ truy nhập mạng không dây băng rộng.

www.tapchibcvt.gov.vn/viVN/congnghetruyenthong/2006/4/16376.bcvt?Searc hTerm=Wimax

[V7] Nguyễn Phương Mai (2007), Đôi nét về mật mã – Ban Cơ yếu Chính phủ - Tạp chí An toàn thông tin, số 03 (004).

[V8] Ngô Tứ Thành & Lê Minh Thanh (2007), Thông tin lượng tử, Nhà xuất bản ĐHQG HN.

[V9] Lê Nhật Thăng, Hoàng Đức Tỉnh (14/12/2007), Bảo mật trong Wimax, Tạp chí BCVT&CNTT.

TIẾNG ANH

[E1] A. Menezes, P. van Oorschot, and S. Vanstone (1996), Handbook of Applied Cryptography, CRC Press.

[E2] Laurent Haan (5/14/2007), Advanced Encryption Standard (AES), Public Research Centre Henri Tudor, Luxembourg.

[E3] Federal Information Processing Standards Publication (November 26, 2001), Announcing the Advanced Encryption Standard (AES).

[E4] Business Systems International Ltd (2004), Cryptography A-Z - SSH Communications Security, House 59 Markham Street, London, SW3 3NR, UK, +44 (0) 20 7352 7007, SSH@e-business.com .

[E5] By Wenbo Mao Hewlett-Packard Company (2003), Modern Cryptography : Theory and Practice, Prentice Hall PTR.

[E6] David jonhston and Jesse Walker (2004), Overview of IEEE 802.16 Security, IEEE Security & Privacy.

[E7] Douglas Stinson(1995), Cryptography: Theory and Practice, CRC Press, CRC Press LLC.

[E8] Dr. Kitti Wongthavarawat (2005), IEEE 802.16 Wimax Security, Thai Computer Emergency Response Team (ThaiCERT) National Electronics and Computer Technology Center Thailand.

[E9] Fred Piper and Sean Murphy (2002), Cryptography: A Very Short Introduction, Oxford University Press.

[E10] G.S.V.Radha Krishna Rao, G.Radhamani (2008), Wimax – A wireless Technology Revolution, Auerbach Publications, Taylor & Francis Group.

[E11] Loutfi Nuaymi, John Wiley & Sons (2007), Wimax Technology for Broadband Wireless Access.

[E12] Michel Barbeau (2005), Wimax/802.16 Threat Analysis, School of Computer Science, Carleton University, Canada, October.

[E13] Rolf Oppliger (2005), Contemprary Cryptography, Artech House Computer Security Series.

[E14] Sen Xu, Manton Mathews, Chin-Tser Huang (2006), Security Issues in Privacy and Key Management Protocols of IEEE 802.16, Department of Computer Science and Engineering University of South Carolina, Columbia, SC 29208, USA.

[E15] Taylor & Francis Group, Wimax Standards and Security, CRC Press 2008, , Edited by SYED AHSON and MOHAMMAD ILYAS (p37 to p48) [E16] Wimax Forum (2005), Fixed, nomadic, portable and mobile applications for 802.16-2004 and 802.16e Wimax networks.

[E17] Wimax forum, Wimax Forum ® Wimax ™ Technology Forecast (2007- 2012), Copyright 2008 Wimax Forum.

Một phần của tài liệu vấn đề bảo mật mạng wimax và ứng dụng (Trang 68 - 81)

Tải bản đầy đủ (PDF)

(81 trang)