Cate: A System for Analysis and Test of Java Card Applications - - PowerPoint PPT Presentation

cate a system for analysis and test of java card
SMART_READER_LITE
LIVE PREVIEW

Cate: A System for Analysis and Test of Java Card Applications - - PowerPoint PPT Presentation

Cate: A System for Analysis and Test of Java Card Applications Peter Pfahler, Universitt Paderborn, Institut fr Informatik Jrgen Gnther, ORGA Kartensysteme GmbH, Paderborn First International Workshop on Software Quality SOQUA 2004,


slide-1
SLIDE 1

1

Peter Pfahler, Universität Paderborn, Institut für Informatik Jürgen Günther, ORGA Kartensysteme GmbH, Paderborn First International Workshop on Software Quality SOQUA 2004, Erfurt, September 30

Cate: A System for Analysis and Test of Java Card Applications

slide-2
SLIDE 2

2

The Smart Card Market

Pfahler/Günther Cate

Health Banking Telecommuni- cations Identification

  • Cards for GSM and

UMTS (3G)

  • Bank and

credit cards

  • Health insurance

cards

  • Signature cards
  • ID- and

signature cards

Security and Authentication No Updates, Patches, Service Packs Software Quality Java Card

slide-3
SLIDE 3

3

Cate: A System for Analysis and Test of Java Card Applications

Basic Idea:

By using Java as the programming language for card software, the usage of program analysis tools becomes feasible.

Overview:

Smart card basics: Master/Slave Communication, Java Card Static Analysis: Command-Response behavior Dynamic Analysis: Test coverage The Cate System: Practical experience

Pfahler/Günther Cate

slide-4
SLIDE 4

4

Pfahler/Günther Cate

Java Cards include a Java Virtual Machine (JVM) to run Java applications.

APDU Manager Java Applet 1 File System Services / Card Manager Crypto Server

Hardware Drivers

Memory Manager

Java API Interpreter Card Admini- strator Loader System API Native

  • App. 1

Native

  • App. 2

Java Applet 2 Java Applet n Library

Java Card

slide-5
SLIDE 5

5

The smart card communication model: Master/Slave

Pfahler/Günther Cate

Host Card accepting device Smart Card Command APDU Response APDU CLA INS P1 P2 LC DAT LE DAT SW1 SW2

slide-6
SLIDE 6

6

Static Analysis of Command/Response Behavior

Pfahler/Günther Cate

1 void process(APDU apdu) { byte [] buf = apdu.getBuffer(); if (buf[CLA] == 0x80) { 2 switch (buf[INS]) { 3 case 0x20: ... 4 case 0x22: ... 5 case 0x24: ... 6 case 0x26: ... 7 default: ... } } else { 8 CardException.throwIt(0x6D00); } 9 } Typical Structure of a Java Card Applet

slide-7
SLIDE 7

7

Static Analysis of Command/Response Behavior

Pfahler/Günther Cate

1 void process(APDU apdu) { byte [] buf = apdu.getBuffer(); if (buf[CLA] == 0x80) { 2 switch (buf[INS]) { 3 case 0x20: ... 4 case 0x22: ... 5 case 0x24: ... 6 case 0x26: ... 7 default: ... } } else { 8 CardException.throwIt(0x6D00); } 9 } Typical Structure of a Java Card Applet Code Clichés APDU fetch APDU access Control flow branching Return code generation

slide-8
SLIDE 8

8

Static Analysis of Command/Response Behavior

Pfahler/Günther Cate

1 2 8 3 4 9 5 6 7

CLA = 0x80 CLA ≠ 0x80 INS=0x20 INS=0x22 INS=0x24 INS=0x26 default Response 0x6D00

Control Flow Analysis Data Flow Analysis based on Clichés Results: Document listing the command/response combinations Annotated Control Flow Graph

slide-9
SLIDE 9

9

Static Analysis of Command/Response Behavior

Pfahler/Günther Cate

Results of Static Analysis presented by Cate Command/Response Combinations Annotated Control Flow Graph

slide-10
SLIDE 10

10

Dynamic Test Coverage Analysis

Pfahler/Günther Cate

Test engineers need: information about untested program locations a measurement of test quality (e.g. C0: basic block execution ratio) Code coverage information can be gained by instrumentation of the card applet

  • r profiling during card applet simulation

Code Coverage C0 = 3/6 = 50 % B1 yes B2 no B3 yes B4 no B5 no B6 yes Basic Block Executed

In practice coverage information turned out to be more valuable than the static analysis results.

slide-11
SLIDE 11

11

Dynamic Test Coverage Analysis

Pfahler/Günther Cate

Results of dynamic analysis presented by Cate

slide-12
SLIDE 12

12

Combining the results of static and dynamic analyzes

Pfahler/Günther Cate

Support for the construction of new test cases

slide-13
SLIDE 13

13

Cate System Overview

Pfahler/Günther Cate

Static Analysis

  • Project managment
  • Source browser
  • Control flow analysis
  • CFG display
  • Command/response

Dynamic Analysis

  • Test browser
  • Simulator control
  • Test execution
  • Test evaluation
  • Coverage analysis
slide-14
SLIDE 14

14

Applying the Cate System

Pfahler/Günther Cate

Instrument Application Construct new Test Cases Static Analysis Dynamic Analysis Compare results to specification Developer Choose Test Cases

Coverage too low Error detected Error detected OK Code coverage questions

slide-15
SLIDE 15

15

Applying the Cate System

Pfahler/Günther Cate

Instrument Application Construct new Test Cases Static Analysis Dynamic Analysis Compare results to specification Developer Choose Test Cases

Coverage too low Error detected Error detected OK Code coverage questions

slide-16
SLIDE 16

16

Applying the Cate System

Pfahler/Günther Cate

Instrument Application Construct new Test Cases Static Analysis Dynamic Analysis Compare results to specification Developer Choose Test Cases

Coverage too low Error detected Error detected OK Code coverage questions

slide-17
SLIDE 17

17

Summary

Pfahler/Günther Cate

Smart card basics: Master/Slave, Java Card Static Analysis: Command-Response behavior Dynamic Analysis: Test coverage The Cate System: Practical experience

Cate: A System for Analysis and Test of Java Card Applications