Khai thỏc và định hướng phỏt triển cỏc ứng dụng cỏc thể húa thẻ chip

Một phần của tài liệu Nghiên cứu giải pháp và xây dựng chương trình phát hành thẻ thông minh theo chuẩn EMV (Trang 74)

Đ Tiếp tục nõng cấp PASCPM, PersoAppMPR3K để nõng cao hiệu sất làm việc, khả năng quản lý luồng dữ liệu tốt hơn, hỗ trợđược nhiều chuẩn thẻ hơn.

Đ Nõng cấp và phỏt triển PersoAppMPR3K thành PersoAppCondor chạy trờn PWF + Condor bằng SmartGear thế hệ mới của SPMWIN. Dõy chuyền chạy trờn mỏy Condor của Phỏp này cú khả năng sản xuất 1350 thẻ trong một giờ. Đõy cú thể coi như giải phỏp mỏy để bàn qui mụ vừa và nhỏ cú thể sử dụng cỏ thể húa tại cho thẻ

bảo hiểm y tế cấp tỉnh hoặc tại cỏc bệnh viện lớn …

Hỡnh 68: Mỏy in Condor - Giải phỏp cỏ thể húa thẻ chip để bàn.

Đ Phỏt triển PersoAppMPR3K cho thẻ chip cho cỏc ngành khỏc như thẻ SIM cho viễn thụng, thẻ bảo hiểm y tế, thẻ khụng tiếp xỳc RFID cho giao thụng vận tải, kiểm soỏt và ra…

Đ Phỏt triển PersoAppMPR3K cho cỏc thẻđa năng sử dụng nhiều ứng dụng (Multi-Applications) phục vụ cỏc ứng dụng liờn ngành viễn thụng, ngõn hàng, giao thụng, bảo hiểm,…

KẾT LUẬN

Cựng với xu thế phỏt triển mạnh của ngành cụng nghiệp thẻ trờn thế giới. Trong lĩnh vực tài chớnh ngõn hàng, việc sử dụng thẻ từ đó trở nờn lỗi thời do thời gian sử dụng ngắn, tớnh an toàn khụng cao tạo điều kiện thuận lợi cho kẻ gian lợi dụng. Trờn thế giới, ước tớnh mỗi năm cú hàng trăm nghỡn vụ gian lận tài chớnh trong đú cú khụng ớt vụ liờn quan đến giả mạo thẻ tớn dụng. Để hạn chế được vấn nạn này, tổ chức Europay, Maste Card and Visa (EMV) đó đưa ra chuẩn thẻ chip cho hệ thống thanh toỏn là EMV ‘96, sau này được nõng cấp thành chuẩn EMV 2000. Với ưu điểm vượt trội (như đó đề cập trong luận văn) so với thẻ từ, thẻ chip ngày càng được cỏc ngõn hàng uy tớn sử dụng lan rộng khắp thế giới. Ở Việt Nam, để hũa nhập với xu thế chung đú, cỏc ngõn hàng đang dần chuyển đổi phương thức sử dụng thẻ từ truyền thống sang thẻ chip để đảm bảo tớnh an toàn, thống nhất và đặc biệt giảm chi phớ gia tăng sau này. Đi đầu trong xu thế chuyển đồi này là ngõn hàng Vietcombank, VIB, VPbank,…

Trong tương lai gần thẻ thụng minh sẽ là một thiết bị cầm tay đa năng cú thể bao gồm cỏc chức năng: thẻ SIM điện thoại, vớ tiền, vộ tàu xe, chứng minh thư, chỡa khoỏ,… Chớnh điều này sẽ mở ra một ngành cụng nghiệp, dịch vụ gia tăng mới phục vụ cho thẻ thụng minh, mang lại giỏ trị kinh tế lớn, phục vụ lợi ớch nước nhà.

Với phạm vi ứng dụng rộng lớn của thẻ thụng minh, luận văn này chỉ nghiờn cứu một phần nhỏ, ứng dụng thẻ thụng minh trong lĩnh vực tài chớnh ngõn hàng.

Luận văn đó đạt được kết quả chớnh sau: Tỡm hiểu, nghiờn cứu và hệ thống lại cỏc vấn đề sau: Đ Tổng quan về thẻ thụng minh. - Phõn loại thẻ thụng minh, cấu trỳc thẻ thụng minh. - Cỏc giao thức với thẻ thụng minh. Đ Hệđiều hành trong thẻ thụng minh.

- Tổ chức hệ thống file trong thẻ thụng minh. - Ứng dụng EMV (VSDC, MCHIP).

Đ Xỏc thực và bảo mật với thẻ thụng minh.

- Cỏc thuật toỏn mó hoỏ với thẻ thụng minh. - Vấn đề xỏc thực với thẻ thụng minh.

- Sử dụng thuật toỏn 3DES, RSA cho xỏc thực và bảo mật thẻ thụng minh.

Đ Xõy dựng được chương trỡnh ghi dữ liệu vào thẻ thụng minh, chạy trờn hệ mỏy sản xuất thẻ cụng nghiệp MPR3000, DC9000, tạo ra một sản phẩm thương mại cú giỏ trị.

Do hầu hết tài liệu tham khảo chủ yếu bằng tiếng Anh, trỡnh độ cũn hạn chế, nờn một số thuật ngữ chuyờn mụn dựng trong luận văn cũn chưa thực sự chớnh xỏc. Chỳng tụi rất mong nhận được sự gúp ý của cỏc thầy giỏo và cỏc bạn. Luận văn này cú thể dựng làm tài liệu tham khảo cho việc xõy dựng cỏc ứng dụng cho thẻ thụng minh, như chuẩn EMV dựng trong lĩnh vực ngõn hàng, tài chớnh, chuẩn GSM trong lĩnh vực viễn thụng, cũng như cỏc lĩnh vực khỏc.

TÀI LIỆU THAM KHẢO

1. DataCard, “Reference Guide for Smart Card Personalization Manager (SCPM) Applications”, June 2004.

2. DataCard, “Reference Guide for Affinađ Personalization Manager Applications”, March 2006.

3. EMVCo, “EMV ’96 Integrated Circuit Card Terminal Specification for Payment Systems”, Version 3.0, June 30, 1996.

4. EMVCo, “EMV Integrated Circuit Card Specifications for Payment Systems”, Books(1, 2, 3, 4), Version 4.1, 2004.

5. EMVCo, LCC, “EMV Card Personalization Specification”, Version 1.0, June 2003.

6. EMVCo, LCC, “EMV Issuer Security Guidelines”, Version 0.5, October 31, 2000. 7. Eur Ing Chris Hills BSc(Hons), “Encryption and Ciphers using 7816 for Smart

Cards”, C. Eng., MIEE, FRGS September 2001.

8. Gemalto(9-2007), “MPCOS-EMV R5 Reference Manual”.

9. Gemplus, August 1999, “MPCOS-EMV Reference Manual Version 3.1”. 10.Global Platform, “Card Specification”, Version 2.2, March 2006.

11.Global Platform, “Global Platform Smart Card Security Target Guidelines”, Version 1.0, October 2005.

12.IBM, “OpenCard Framework 1.2 Programmer's Guide”.

13.Jorge Ferrari, Robert Mackinnon, Susan Poh, Lakshman Yatawara, “Smart Cards: A Case Study”, IBM.

14.Klaus Finkenzeller, “RFID Hand Book, Fundementals and Applications in Contactless Smart Cards and Identification (Second Edition)”, Giesecke & Devrient GmbH, Munich, Germany - 2003. (adsbygoogle = window.adsbygoogle || []).push({});

15.MasterCard, “MasterCardđ Chip - Minimum Card Requirements for Debit and Credit”, Version 4.0, August 2001.

16.MasterCard, “Card Personalization Validation Guide”, September 2006

17.Mike Hendry, “Smart Card Security and Applications (Second Edition)”, Artech House - Boston London - 2001.

18.Marcel Aumont, Senior Technology Consultant, CGI, “Public Key encryption and digital signature - How do they work?”

19.Smart Card Application Development Using Java (Second Edition) - Martin S.Nicklous & Thomas Schack & Achim Schneider & Frank Seliger - Springer - 2002.

20.Scott B.Guther & Mary J.Cronin, “Mobile Application Development with SMS and the SIM Toolkit”, McGraw- Hill Telecom - 2002.

21.Security in the GSM system, By Jeremy Quirke | Last updated 1st May 2004, â 2004 AusMobile. http://www.ausmobile.com

22.SmarTEC, “GSM Application Notes”. http://www.smartecos.com/

23.Stephane BAUSSON(1995), “ISO 7816 asynchronous smartcard information”, No 4, Rue de Grand F-88630 Chermisey, France.

24.Timothy M.Jurgensen & Scott B.Guthery, “Smart Cards: The development toolkit”, Prentice Hall - 2002.

25.Visa, “Visa Integrated Circuit Card - Card Specification”, Version 1.4.0, April 2001.

26.Visa, “Visa Smart Debit Credit (VSDC) - Personalization Guide for Global Platform Cards”, May 2003.

27.Visa, “Visa Global Platform 2.1.1 - Guidelines for Developing Java Card Applets”, version 1.0, November 2003.

28.Wolfgang Rankl and Wolfgang Effing, Smart Card Handbook (Third Edition), Giesecke & Devrient GmbH, Munich, Germany.

29.Zhiqun Chen, “Java Card Technology for Smart Cards: Architecture and Programmer’s Guide” 30.http://www.emvco.com 31.http://www.emvlab.org 32.http://www.javacardforum.org 33.http://www.globalplatform.org 34.http://www.openscdp.org 35.http://www.opensc-project.org 36.http://www.usasmartcard.com 37.http://www.wrankl.de

PHỤ LỤC A. Ứng dụng vớ điện tử (wallet)

Đõy là một ứng dụng được viết cho thẻ thụng minh JCOP v2.2 (Java Card Open Platform) của hóng NXP. Ứng dụng cho phộp người dựng thay đổi mó PIN, truy vấn tài khoản, cú thể tăng/giảm giỏ trị tài khoản khi thanh toỏn.

/*

* Copyright 2003 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ // // Workfile:@(#)Wallet.java 1.9 // Version:1.9 // Date:06/06/03 // // Modified:06/06/03 17:06:00 // Original author: Zhiqun Chen //

package com.sun.javacard.samples.wallet; import javacard.framework.*;

public class Wallet extends Applet { /* constants declaration */

// code of CLA byte in the command APDU header final static byte Wallet_CLA =(byte)0x80;

// codes of INS byte in the command APDU header final static byte VERIFY = (byte) 0x20;

final static byte CREDIT = (byte) 0x30; final static byte DEBIT = (byte) 0x40;

final static byte GET_BALANCE = (byte) 0x50; // maximum balance

final static short MAX_BALANCE = 0x7FFF; // maximum transaction amount

final static byte MAX_TRANSACTION_AMOUNT = 127; // maximum number of incorrect tries before the // PIN is blocked

final static byte PIN_TRY_LIMIT =(byte)0x03; // maximum size PIN

final static byte MAX_PIN_SIZE =(byte)0x08; // signal that the PIN verification failed

final static short SW_VERIFICATION_FAILED = 0x6300; // signal the the PIN validation is required (adsbygoogle = window.adsbygoogle || []).push({});

// for a credit or a debit transaction

// signal invalid transaction amount

// amount > MAX_TRANSACTION_AMOUNT or amount < 0

final static short SW_INVALID_TRANSACTION_AMOUNT = 0x6A83; // signal that the balance exceed the maximum

final static short SW_EXCEED_MAXIMUM_BALANCE = 0x6A84; // signal the the balance becomes negative

final static short SW_NEGATIVE_BALANCE = 0x6A85; /* instance variables declaration */

OwnerPIN pin; short balance;

private Wallet (byte[] bArray,short bOffset,byte bLength){ // It is good programming practice to allocate

// all the memory that an applet needs during // its lifetime inside the constructor

pin = new OwnerPIN(PIN_TRY_LIMIT, MAX_PIN_SIZE); byte iLen = bArray[bOffset]; // aid length

bOffset = (short) (bOffset+iLen+1);

byte cLen = bArray[bOffset]; // info length bOffset = (short) (bOffset+cLen+1);

byte aLen = bArray[bOffset]; // applet data length // The installation parameters contain the PIN // initialization value

pin.update(bArray, (short)(bOffset+1), aLen); register();

} // end of the constructor

public static void install(byte[] bArray, short bOffset, byte bLength){

// create a Wallet applet instance new Wallet(bArray, bOffset, bLength); } // end of install method

public boolean select() {

// The applet declines to be selected // if the pin is blocked.

if ( pin.getTriesRemaining() == 0 ) return false;

return true;

}// end of select method public void deselect() { // reset the pin value pin.reset();

}

public void process(APDU apdu) {

// APDU object carries a byte array (buffer) to // transfer incoming and outgoing APDU header

// and data bytes between card and CAD

// At this point, only the first header bytes // [CLA, INS, P1, P2, P3] are available in // the APDU buffer.

// The interface javacard.framework.ISO7816 // declares constants to denote the offset of // these bytes in the APDU buffer

byte[] buffer = apdu.getBuffer(); // check SELECT APDU command buffer[ISO7816.OFFSET_CLA] =

(byte)(buffer[ISO7816.OFFSET_CLA] & (byte)0xFC); if ((buffer[ISO7816.OFFSET_CLA] == 0) && (adsbygoogle = window.adsbygoogle || []).push({});

(buffer[ISO7816.OFFSET_INS] == (byte)(0xA4)) ) return;

// verify the reset of commands have the // correct CLA byte, which specifies the // command structure

if (buffer[ISO7816.OFFSET_CLA] != Wallet_CLA) ISOException.throwIt

(ISO7816.SW_CLA_NOT_SUPPORTED);

switch (buffer[ISO7816.OFFSET_INS]) { case GET_BALANCE: getBalance(apdu); return;

case DEBIT: debit(apdu); return;

case CREDIT: credit(apdu); return;

case VERIFY: verify(apdu); return;

default: ISOException.throwIt

(ISO7816.SW_INS_NOT_SUPPORTED); }

} // end of process method private void credit(APDU apdu) { // access authentication

if ( ! pin.isValidated() ) ISOException.throwIt(

SW_PIN_VERIFICATION_REQUIRED); byte[] buffer = apdu.getBuffer();

// Lc byte denotes the number of bytes in the // data field of the command APDU

byte numBytes = buffer[ISO7816.OFFSET_LC]; // indicate that this APDU has incoming data // and receive data starting from the offset

// ISO7816.OFFSET_CDATA following the 5 header // bytes.

byte byteRead = (byte)(apdu.setIncomingAndReceive()); // it is an error if the number of data bytes

// read does not match the number in Lc byte if ( ( numBytes != 1 ) || (byteRead != 1) ) ISOException.throwIt(ISO7816.SW_WRONG_LENGTH); // get the credit amount

byte creditAmount = buffer[ISO7816.OFFSET_CDATA]; // check the credit amount

if ( ( creditAmount > MAX_TRANSACTION_AMOUNT) || ( creditAmount < 0 ) )

ISOException.throwIt

(SW_INVALID_TRANSACTION_AMOUNT); // check the new balance

if ( (short)( balance + creditAmount) > MAX_BALANCE ) ISOException.throwIt

(SW_EXCEED_MAXIMUM_BALANCE); // credit the amount

balance = (short)(balance + creditAmount); } // end of deposit method

private void debit(APDU apdu) { // access authentication

if ( ! pin.isValidated() ) ISOException.throwIt (SW_PIN_VERIFICATION_REQUIRED);

byte[] buffer = apdu.getBuffer();

byte numBytes = (byte)(buffer[ISO7816.OFFSET_LC]); byte byteRead = (byte)(apdu.setIncomingAndReceive()); if ( ( numBytes != 1 ) || (byteRead != 1) )

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

(ISO7816.SW_WRONG_LENGTH); // get debit amount

byte debitAmount = buffer[ISO7816.OFFSET_CDATA]; // check debit amount

if ( ( debitAmount > MAX_TRANSACTION_AMOUNT) || ( debitAmount < 0 ) )

ISOException.throwIt

(SW_INVALID_TRANSACTION_AMOUNT); // check the new balance

if ( (short)( balance - debitAmount ) < (short)0 ) ISOException.throwIt(SW_NEGATIVE_BALANCE); balance = (short) (balance - debitAmount);

private void getBalance(APDU apdu) { byte[] buffer = apdu.getBuffer();

// inform system that the applet has finished // processing the command and the system should // now prepare to construct a response APDU // which contains data field

short le = apdu.setOutgoing(); if ( le < 2 )

ISOException.throwIt

(ISO7816.SW_WRONG_LENGTH); //informs the CAD the actual number of bytes //returned

apdu.setOutgoingLength((byte)2);

// move the balance data into the APDU buffer // starting at the offset 0

buffer[0] = (byte)(balance >> 8); buffer[1] = (byte)(balance & 0xFF);

// send the 2-byte balance at the offset // 0 in the apdu buffer

apdu.sendBytes((short)0, (short)2); } // end of getBalance method

private void verify(APDU apdu) { byte[] buffer = apdu.getBuffer();

// retrieve the PIN data for validation.

byte byteRead = (byte)(apdu.setIncomingAndReceive()); // check pin

// the PIN data is read into the APDU buffer // at the offset ISO7816.OFFSET_CDATA

// the PIN data length = byteRead

if ( pin.check(buffer, ISO7816.OFFSET_CDATA, byteRead) == false )

ISOException.throwIt

(SW_VERIFICATION_FAILED); } // end of validate method

} // end of class Wallet

B. Thuật toỏn tớnh MAC

Trong quỏ trỡnh trao đổi dữ liệu giữa thẻ thụng minh và thiết bị đầu cuối, để đảm bảo an toàn bản tin, quỏ trỡnh này bị đúng gúi MAC bởi cỏc khúa được chọn trước.

public static byte[] generateCMac(byte[] apduCommand, byte[] dataField, byte[] SessionKmac, byte[] icv)

{

byte[] pad = new byte[] { 0x80, 0, 0, 0, 0, 0, 0, 0 }; int padRequired = 8 - (5 + dataField.Length) % 8; (adsbygoogle = window.adsbygoogle || []).push({});

byte[] data = new byte[5 + dataField.Length + padRequired]; //Build APDU Command

ByteArray.CopyTo(apduCommand, 0, ref data, 0, 4);

data[4] = (byte)data.Length;//(byte)((byte)dataField.Length + (byte)0x08);

ByteArray.CopyTo(dataField, 0, ref data, 5, dataField.Length);

ByteArray.CopyTo(pad, 0, ref data, 5 + dataField.Length, padRequired);

//Calculate C-MAC try

{

TripleDES trides = new TripleDESCryptoServiceProvider(); trides.Mode = CipherMode.CBC;

trides.KeySize = 0xc0;//0xC0=192bits;0x80=128bits trides.Key = SessionKmac;

trides.IV = icv;

ICryptoTransform ict = trides.CreateEncryptor(); byte[] tmpKey = ict.TransformFinalBlock(data, 0, data.Length);

ByteArray.CopyTo(tmpKey, data.Length - 8, ref cMac, 0, 8);

}

catch (Exception ex) {

MessageBox.Show("Problem occured during C-MAC generation!. " + ex.Message);

return null; }

return cMac;

Một phần của tài liệu Nghiên cứu giải pháp và xây dựng chương trình phát hành thẻ thông minh theo chuẩn EMV (Trang 74)