Quá trình gửi tin nhắn được bảo mật

Một phần của tài liệu Nghiên cứu giải pháp bảo mật thông tin di động sử dụng công nghệ CDMA (Trang 80)

Hình 3.16: Quá trình bảo mật SMS Soạn SMS Nhập contact nhận SMS Mã hóa SMS Kênh truyền Giải mã SMS Lƣu SMS

3.7. Triển khai thực tế

Để kiểm chứng hiệu quả của phần mềm bảo mật SMS đã được xây dựng. Đề tài đã tiến hành triển khai cài đặt và chạy thử phần mềm trên mạng điện thoại Vinaphone 3G. Điện thoại được sử dụng là của hãng Nokia.

Với ưu thế của ngôn ngữ lập trình J2ME (Java) và phương pháp mã hóa khóa công khai dựa trên đường cong Elliptic đã đem đến nhiều lợi điểm cho phần mềm bảo mật SMS đó là:

- Dễ cài đặt

- Tốc độ mã hóa và giải mã nhanh

- Tốn ít dụng lượng bộ nhớ của điện thoại di động

- Chống dịch ngược chương trình để lấy password hoặc thông tin cá nhân - Dễ dàng nâng cấp phần mềm trong tương lai

Thực tế đã cho thấy phần mềm đã đáp ứng được yêu cầu về bảo mật tin nhắn SMS của hệ thống thông tin di động CDMA

3.8. Kết luận

Trên cơ sở phân tích hiện trạng giải pháp bảo mật thông tin di động CDMA trên thế giới, hiện trạng các mạng thông tin di động CDMA tại Việt Nam, đánh giá sự mất an toàn của các mạng di động CDMA tại Việt Nam, nhu cầu bảo mật thông tin di động CDMA trong An ninh Quốc phòng đặc biệt là lực lượng Công an, Chương 3 đã đưa ra giải pháp bảo mật thông tin di động CDMA sử dụng hệ mật mã khóa công khai dựa trên đường cong Elliptic và xây dựng ứng dụng bảo mật tin nhắn SMS cho mạng thông tin di động CDMA.

KẾT LUẬN

Việc thực hiện mã hóa thông tin mạng điện thoại di động CDMA là rất cần thiết đặc biệt với nhu cầu bảo mật thông tin liên lạc trong Công an. Việc triển khai này là dễ thực hiện trên môi trường điện thoại di động do những lợi thế của phương pháp mã hóa trên đường cong Elliptic (an toàn, yêu cầu về phần cứng thấp, độ dài khóa thấp, tốc độ mã hóa cao), và tính ưu việt của J2ME trong lập trình cho điện thoại di động. Giải pháp đề tài đưa ra là hoàn toàn độc lập với nhà cung cấp dịch vụ từ đó đảm bảo tính an toàn cao nhất có thể, phù hợp với đặc thù của ngành Công an.

Đề tài đã nghiên cứu các giải pháp bảo mật thông tin di động sử dụng công nghệ CDMA trên thế giới và Việt Nam, phân tích các nguy cơ gây mất an toàn thông tin di động sử dụng công nghệ CDMA tại Việt Nam. Từ đó đề tài đề xuất giải pháp bảo mật thông tin di động sử dụng công nghệ CDMA đó là đi xây dựng ứng dụng phần mềm mã hóa thông tin di động (Sử dụng phương pháp mã hóa dựa trên đường con Elliptic). Với phạm vi của một luận văn thạc sỹ, đề tài giới hạn chỉ xây dựng ứng dụng phần mềm mã hóa tin nhắn SMS của mạng thông tin di động CDMA. Giải pháp đã được thử nghiệm thực tế. Phần mềm mã hóa tin nhắn SMS đã được cài đặt trên điện thoại di động sử dụng dịch vụ thông tin di động CDMA và cho kết quả tốt. Tin nhắn SMS sau khi được mã hóa bằng phần mềm và gửi sang thuê bao khác được đảm bảo an toàn, bí mật.

HƢỚNG PHÁT TRIỂN CỦA ĐỀ TÀI

Đề tài mới thực hiện được việc xây dựng phần mềm bảo mật cho tin nhắn SMS, hướng phát triển tiếp theo của đề tài là xây dựng phần mềm bảo mật thông tin thoại và dữ liệu (data) cho hệ thống thông tin di động CDMA.

TÀI LIỆU THAM KHẢO Tiếng Việt

1. Phan Đình Diệu, “Lý thuyết mật mã và an toàn thông tin”, Đại học

Quốc gia Hà Nội.

2. Nguyễn Phạm Anh Dũng (2006), “Lý thuyết trải phổ”, Học viện Công nghệ bưu chính viễn thông.

3. Phương Lan (2003), “Java”, NXB Lao động xã hội.

4. Nguyễn Viết Kính – Trịnh Anh Vũ (2007), "Thông tin số", NXB Giáo dục.

5. Trịnh Nhật Tiến (2004), Bài giảng: “Một số vấn đề về an toàn dữ liệu”.

Tiếng Anh

6. Andrew S. Tanenbaum (2003), “Computer Network 4ed”, Prentice Hall PTR.

7. Keiji Tachikawa (2002), “W-CDMA Mobile Communications System”, John Wiley & Sons, LTD.

8. Samuel C. Yang (1998), “CDMA RF System Engineering”, Artech House.

9. William Stallings (2005), “Cryptography and Network Security Principles and Practices, Fourth Edition”, Prentice Hall.

WebSite

10.http://www.certicom.com

PHỤ LỤC 1: GIAO DIỆN CHƢƠNG TRÌNH (adsbygoogle = window.adsbygoogle || []).push({});

PHỤ LỤC 2: MÃ NGUỒN MỘT SỐ MODULE TRONG CHƢƠNG TRÌNH

================== Đối tượng đường cong Elliptic ====================

package interfaceSMS; import java.lang.Math.*; public class ObjElliptic{ int ax, bx;

int Zp;

PointOfEll basePoint; int keySent, keyReceived; public ObjElliptic()

{

//Chon duong cong Elliptic y2=x3+ax+b ax = 1;

bx = 6;

//Chon diem co so, diem sinh

basePoint = new PointOfEll(2,133); // Chon truong so nguyen

Zp = 137;

// Key mac dinh khi sender biet key public keySent = 6; //Alice key

keyReceived = 4; //Bob key }

public int hamMuDongDuZp(int a, int p) {

int kq=1;

for(int i=1; i<=p; i++) {

kq = (kq*a)%Zp; }

return kq; }

{

int lamda;

if((x1==x2)&&(y1==y2)) //if Px=Qx {

int lamda1 = (3*x1*x1+ax)%Zp;

int lamda2 = hamMuDongDuZp(((2*y1)%Zp),(Zp-2)); //theo dinh ly Fermat

lamda = (lamda1*lamda2)%Zp; //lamda = (3x1binhphuong+ax)/(2y1) }

else{

int lamda1 = y2>y1? (y2-y1)%Zp:(Zp+y2-y1);

int lamda2 = x2>x1? hamMuDongDuZp((x2-x1),(Zp- 2)):hamMuDongDuZp((Zp+x2-x1),(Zp-2));

lamda = (lamda1*lamda2)%Zp; //lamda = (y2-y1)/(x2-x1) mod Zp }

return lamda; }

public PointOfEll addPoint(int x1, int y1, int x2, int y2) { (adsbygoogle = window.adsbygoogle || []).push({});

int x3; int y3;

int lamda = tolamda(x1,y1,x2,y2); PointOfEll kq = new PointOfEll(0,0); x3 = lamda*lamda - x1 - x2;

kq.x = x3>0? x3%Zp:(2*Zp+x3)%Zp; //truong hop lamda ~ 0, x1,x2~Zp

y3 = lamda*(x1-kq.x)-y1;

kq.y = y3>0? y3%Zp:(Zp*Zp+y3)%Zp; // truong hop y3<-zp return kq;

}

public PointOfEll nhanPoint(int n, int x1, int y1) {

PointOfEll kq = new PointOfEll(x1,y1); for(int i=1; i<n; i++)

{

kq = addPoint(kq.x, kq.y, x1, y1); }

return kq; }

public PointOfEll makeKey(int privateKey) {

return nhanPoint(privateKey, basePoint.x, basePoint.y); } } ======================= Mã hóa SMS ======================= import interfaceSMS.*; import javax.microedition.midlet.*; import javax.microedition.lcdui.*;

public class encryptMsg extends MIDlet implements CommandListener{ Display mDisplay;

MenuScreen ms; MainList mainMenu;

Command cmdExit, cmdBackCanvas; CreateMessageForm textboxMsg;

Command cmdBackSpace, cmdBack, cmdSend, cmdSaveMsg, cmdClear, cmdExitEditor;

Command cmdBacktoEdit; InputPhoneNumber frmPhone;

Command cmdOK, cmdOkNormal, cmdSearch; ListContact addPhone;

ListInbox listInbox; ListDraft listDraft; ListSentItem listSent;

MsgAlert alert;

DeleteOption delOption; public encryptMsg(){

mDisplay = Display.getDisplay(this); // Menu

mainMenu = new MainList();

cmdBackCanvas = new Command("Back", Command.EXIT, 0); mainMenu.addCommand(cmdBackCanvas);

mainMenu.setCommandListener(this); //Menu screen

ms = new MenuScreen(mDisplay, mainMenu, this); cmdExit = new Command("Exit", Command.EXIT, 1); ms.addCommand(cmdExit);

ms.setCommandListener(this); // create Msg

textboxMsg = new CreateMessageForm();

cmdBackSpace = new Command("BackSpace", Command.BACK, 0); cmdSend = new Command("Send", Command.SCREEN, 1); (adsbygoogle = window.adsbygoogle || []).push({});

textboxMsg.addCommand(cmdBackSpace);

cmdBack = new Command("Back", Command.BACK, 1); textboxMsg.addCommand(cmdSend);

cmdSaveMsg = new Command("Save message", Command.SCREEN, 2); cmdClear = new Command("Clear text", Command.SCREEN, 3);

cmdExitEditor = new Command("Exit editor", Command.SCREEN, 4); textboxMsg.addCommand(cmdSaveMsg);

textboxMsg.addCommand(cmdClear); textboxMsg.addCommand(cmdExitEditor); textboxMsg.setCommandListener(this);

// input phone number

frmPhone = new InputPhoneNumber(mDisplay);

frmPhone.addCommand(cmdOK);

cmdOkNormal = new Command("Normally send", Command.ITEM, 2); frmPhone.addCommand(cmdOkNormal);

cmdSearch = new Command("Search", Command.ITEM, 1); frmPhone.addCommand(cmdSearch);

cmdBacktoEdit = new Command("Back", Command.BACK, 1); frmPhone.addCommand(cmdBacktoEdit);

frmPhone.setCommandListener(this); //Inbox

listInbox = new ListInbox(mDisplay, mainMenu); //Alert

alert = new MsgAlert(); //Delete messages

delOption = new DeleteOption(mDisplay, mainMenu); }

private void refreshTextBoxMsg(){

textboxMsg.removeCommand(cmdBack); textboxMsg.addCommand(cmdBackSpace); textboxMsg.setString("");

}

public void startApp(){

mDisplay.setCurrent(ms); }

public void pauseApp(){}

public void destroyApp(boolean unconditional){}

public void commandAction(Command c, Displayable d){

switch(mainMenu.getSelectedIndex()) { case 0: refreshTextBoxMsg(); mDisplay.setCurrent(textboxMsg); break; case 1: mDisplay.setCurrent(listInbox); break; case 2: //Sent items

listSent = new ListSentItem(mDisplay, mainMenu); mDisplay.setCurrent(listSent);

break; case 3: //Draft

listDraft = new ListDraft(mDisplay, mainMenu, textboxMsg); mDisplay.setCurrent(listDraft); break; case 4: mDisplay.setCurrent(delOption); break; default: notifyDestroyed(); } }else

if(c == cmdExit){ //Thoat Menu chinh

listInbox.close(); //dong ket noi nhan tin nhan notifyDestroyed();

}else (adsbygoogle = window.adsbygoogle || []).push({});

mDisplay.setCurrent(ms); }else if(c == cmdBackSpace){ textboxMsg.actionBackSpace(); if(textboxMsg.msgBlank){ textboxMsg.removeCommand(cmdBackSpace); textboxMsg.addCommand(cmdBack); } }else if(c == cmdSend){ frmPhone.amendForm(textboxMsg.getText()); mDisplay.setCurrent(frmPhone); }else if(c == cmdSaveMsg){ textboxMsg.saveMsg(); alert.savingMsg(); mDisplay.setCurrent(alert); }else if(c == cmdClear){ textboxMsg.clearText(); mDisplay.setCurrent(textboxMsg); }else if(c == cmdExitEditor){ mDisplay.setCurrent(mainMenu); }else if(c == cmdBacktoEdit){ mDisplay.setCurrent(textboxMsg); }else if(c == cmdOK){ alert.sendingMsg(); frmPhone.actionSend(textboxMsg.getText(), frmPhone.getPhoneNumber(), "s"); mDisplay.setCurrent(alert, mainMenu);

}else if(c == cmdOkNormal){ alert.sendingMsg(); frmPhone.actionSend(textboxMsg.getText(), frmPhone.getPhoneNumber(), "n"); mDisplay.setCurrent(alert, mainMenu); }else if(c == cmdSearch){

addPhone = new ListContact(mDisplay, frmPhone); mDisplay.setCurrent(addPhone); // frmPhone.txtPhone.setString(addPhone.strPhoneNumber); } if(c == cmdBack){ refreshTextBoxMsg(); mDisplay.setCurrent(mainMenu); } } } =================== Tạo khóa ============================== package interfaceSMS; import javax.microedition.lcdui.*; import javax.microedition.rms.RecordStore; import java.io.ByteArrayOutputStream; import java.io.DataOutputStream;

public class MakeEllKey extends Form implements CommandListener{

Display kDisplay; Displayable objBack;

Command cmdBack, cmdApply; StringItem strNote;

int key;

int pk1, pk2; //public key

public MakeEllKey(Display d, Displayable da){ super("Change my key");

this.kDisplay = d; this.objBack = da;

key = 6; //key mac dinh

txtPrivateKey = new TextField("Private Key=", "", 4, TextField.PHONENUMBER);

strNote = new StringItem("Your public key ", "will loss."); this.append(txtPrivateKey);

this.append(strNote);

cmdBack = new Command("Back", Command.EXIT, 0); cmdApply = new Command("Apply", Command.OK, 1); this.addCommand(cmdBack);

this.addCommand(cmdApply); setCommandListener(this); }

private void saveKey(){ RecordStore rs=null;

ByteArrayOutputStream byteOut; DataOutputStream dataOut;

try {

rs = RecordStore.openRecordStore("Key", true); byteOut = new ByteArrayOutputStream();

dataOut = new DataOutputStream( byteOut );

dataOut.writeInt(key); dataOut.writeInt(pk1); dataOut.writeInt(pk2);

byte[] data = byteOut.toByteArray(); rs.addRecord( data, 0, data.length ); dataOut.close();

rs.closeRecordStore(); }

catch (Exception ex) {

System.out.println("rsm write key " + ex); }

}//end of save

private void deleteKey(){ try{

RecordStore.deleteRecordStore("Key"); }catch(Exception e){

System.out.println("rsm delete RecordStore Key"+e); } (adsbygoogle = window.adsbygoogle || []).push({});

}

public void commandAction(Command c, Displayable dd){ if(c == cmdApply){

deleteKey();

int k = Integer.parseInt(txtPrivateKey.getString()); ObjElliptic ell = new ObjElliptic();

PointOfEll pk = ell.makeKey(k); strNote.setText(""+pk.x+","+pk.y); this.key = k; pk1 = pk.x; pk2 = pk.y; saveKey(); } else{ kDisplay.setCurrent(objBack); }

} } =================== Màn hình menu ========================= package interfaceSMS; import java.io.IOException; import javax.microedition.lcdui.*; import javax.microedition.midlet.MIDlet;

public class MenuScreen extends Canvas{ private Image title;

private Font font; private int fontHeight; private int width; private int height;

private String[] menuItems={"Call", "Message", "Contact group", "Change Key"};

private int activeMenuItem =0; private int lastActiveMenuItem =-1; private int maxItemWidth=-1;

private int backgroundColor = 0x0178FD;//0x003399; private boolean first =true;

private Display gDisplay; private MainList toMainMenu; private MIDlet myMID;

public MenuScreen(Display d, MainList ml, MIDlet mlet) { this.gDisplay =d; this.toMainMenu =ml; this.myMID = mlet; width =getWidth(); height =getHeight();

font =Font.getFont(Font.FACE_SYSTEM, Font.STYLE_BOLD,Font.SIZE_MEDIUM);

fontHeight =font.getHeight(); }//end construction

private void showMenu(Graphics g) {

g.setFont(font);

//toa do dat menu theo chieu doc

int y= height/2; //height/2 -

menuItems.length*fontHeight+20;//menuY; if(maxItemWidth <0) { for(int j =0;j<menuItems.length;j++) { maxItemWidth = Math.max(maxItemWidth, font.stringWidth(menuItems[j])); } }//end if

int menuWidth = maxItemWidth; g.setColor(0xffffff);

//boxX :toa do dat menu theo ngang int boxX = (width-menuWidth)/2; for(int i=0;i<menuItems.length;i++) {

//dat mau cho vung duoc chon

g.setColor(i== activeMenuItem ?

0x0000ff:backgroundColor);

//ve o chon cho menu

g.fillRect(boxX-30, y+fontHeight*i+2, menuWidth+60, fontHeight);

//dat mau chu

g.setColor(0xffffff); //ve chu

g.drawString(menuItems[i], width/2- font.stringWidth(menuItems[i])/2, y+i*fontHeight+2, 0); (adsbygoogle = window.adsbygoogle || []).push({});

}

//ve o vuong phia ngoai

g.drawRect(boxX-30,y, menuWidth+60,

fontHeight*menuItems.length+3); } //end show menu

public void paint(Graphics g) { if(first) { try { title = Image.createImage("/logo.png"); } catch (IOException e) {

// TODO Auto-generated catch block e.printStackTrace();

}

g.setColor(backgroundColor); g.fillRect(0, 0, width, height);

g.drawImage(title, (getWidth()-title.getWidth())/2, (height/2- title.getHeight()), Graphics.TOP|Graphics.LEFT); lastActiveMenuItem =-1; first = false; } if(lastActiveMenuItem!=activeMenuItem) { showMenu(g); lastActiveMenuItem=activeMenuItem; } }//end paint

public void keyPressed(int keycode) {

int key =keycode;

int game_Key = getGameAction(keycode); if(key ==getKeyCode(UP))

{

activeMenuItem =activeMenuItem-1 >=0? activeMenuItem- 1: menuItems.length-1;

repaint();

}else if(key == getKeyCode(DOWN)) {

activeMenuItem =(++activeMenuItem%(menuItems.length)); repaint();

}else if(key == Canvas.KEY_NUM5 || game_Key ==Canvas.FIRE) { //System.out.print(getKeyName(GAME_A)); menuAction(activeMenuItem); } }//end keyPressed

private void menuAction(int active) {

switch (active) { case 0:

ManagePhoneCall mc = new ManagePhoneCall(gDisplay, this, myMID); // MsgAlert alert = new MsgAlert();

// alert.deleteAll("Not available"); gDisplay.setCurrent(mc); break; case 1: gDisplay.setCurrent(toMainMenu); break; case 2:

gDisplay.setCurrent(listC); break;

case 3:

MakeEllKey mk = new MakeEllKey(gDisplay, this); gDisplay.setCurrent(mk);

break; }

}//end menuAction

public void showNotify() {

first =true; }

(adsbygoogle = window.adsbygoogle || []).push({});

Một phần của tài liệu Nghiên cứu giải pháp bảo mật thông tin di động sử dụng công nghệ CDMA (Trang 80)