GSM Data Protection: Cyber Security For
GSM Data Protection: Cyber Security For
M.Engr. Thesis
Presented
By
To
DECEMBER 2010
POSTGRADUATE M.Engr. Project Thesis
ANAMBRA STATE
NIGERIA
ii
CYBER SECURITY FOR
BY
iii
CERTIFICATION
I hereby certify that the work reported in this thesis is my own and that works
------------------------------------------------
Signature of the Author:
iv
APPROVAL
This Master Thesis is hereby approved having met the requirements for the award of
-------------------------------------
Signature of Project Supervisor PROF. H.C INYIAMA
Date: …………………………
----------------------------------------
Signature of Project Supervisor ENGR. DR. V.I IDIGO
Date:……………………………
------------------------------------------
Signature of Head of Department ENGR. DR. V.I IDIGO
Date:…………………………….
-------------------------------------------
Signature Dean of Faculty of Engineering PROF. ONYEYILI
Date:………………………………
---------------------------------------------
Signature Dean School of Postgraduate PROF. LUKE ANIKE
Studies
Date:…………………………………..
-----------------------------------------------
Signature of External Examiner
Date: ……………………………………
v
ACKNOWLEDGEMENT
For making this Masters programme a dream come true and for their invaluable
contributions to this Master thesis, I owe so much to my supervisor Prof. H.C Inyiama
and co-supervisor Engr. Dr. V.I Idigo. May God replenish all your energy.
I equally thank my colleagues in the M.Engr Class for making this programme
exciting and a lot of fun. I wish you the best in your future endeavours.
Finally, I would like to thank my wife, Nkechi and my little angel DivineMiracle for
being there for me during this arduous journey to completing this Master programme.
vi
DEDICATION
I dedicate this Masters Thesis project to first of all my GOD, The Almighty Father, in
parents, Mr. & Mrs. J.O Okakpu for bringing me into this world and for all their
vii
ABSTRACT
With the increasing use of extensive IT and Telecommunication systems for sensitive
or safety-critical applications, the matter of IT and Telecommunication security is
becoming more important. For the computer system, and its related applications,
including data, to be trustworthy, it must be secured. This project covers all aspects of
Computer System security. This project equally understudied the security of data as it
affects mobile systems vis-à-vis Global System for Mobile Telecommunications
(GSM). The existing security algorithms in the GSM network were understudied and
critical flaws found in them that cannot guarantee the security and confidentiality of
user’s data during communication session. This poses a great threat in sensitive and
safety-critical environments such as financial institutions, Military, Educational, or
even in espionage establishments such as State Secret Services (SSS) and security
establishments. This Masters project finally proffered solution to these flaws found in
GSM security system by adopting a software-based approach. A computer-based
program was written in JAVA programming language to provide end-to-end data
(SMS only) encryption in two-way communication using compatible MIDP mobile
phones or other portable communication devices.
viii
TABLE OF CONTENTS
PAGE
Cover Page i
Title Page iii
Certification iv
Approval v
Acknowledgement vi
Dedication vii
Abstract viii
Table of Contents ix
List of Figures xii
List of Tables xiii
ix
2.3 GSM Security Architecture 37
2.3.1 GSM Security Model 39
2.3.2 A3, The MS Authentication Algorithm 41
2.3.3 A8, The Voice-Privacy Key Generation Algorithm 42
2.3.4 A5/1, The Strong Over-the-Air Voice-Privacy Algorithm 44
2.4 GSM attack scenarios 47
2.4.1 Brute-Force Attack against A5 47
2.4.2 Divide-and-Conquer Attack against A5 48
2.4.3 Accessing the Signalling Network 49
2.4.4 Retrieving the Key from the SIM 51
2.4.5 Retrieving the Key from the SIM over the Air 53
2.4.6 Retrieving the Key from the AuC 54
2.4.7 Cracking the A8 Algorithm 54
2.4.8 Altering of Data Messages 55
2.6 Cryptography 60
2.6.1 Java Cryptography 60
2.6.2 Digital Signature 61
2.6.3 Symmetric Algorithm 61
2.6.4 Asymmetric Algorithm compared with Symmetric 62
2.9 Conclusion 66
3.0 Methodology 69
3.0.0 Possible Causes of error during transmission of SMS from one
End to another 71
3.0.1 SMS Message Data Format 72
3.0.2 Why Use JAVA? 73
x
3.1 JAVA Technologies used 74
3.1.1 J2ME 74
3.1.2 MIDP 74
3.1.3 JSR 76
3.1.4 MIDlet 76
3.1.5 CDLC 77
3.1.6 Bouncy Castle API 78
3.1.7 Obfuscation of Bouncy Castle JAR files using Proguard 79
3.1.8 Integrated Development Environment (IDE) for the Project 81
3.1.9 Application Deployment as JAR and JAD files 81
4.1 Introduction 87
4.2 System Specification 87
4.3 The SecureSMS MIDlet JAVA program flowcharts 90
4.3.1 The Program Source codes 101
4.3.2 The Program Input and Output Interface 101
4.3.3 The Project Block diagram 106
xi
6.4 Problems encountered and solutions 120
6.5 Recommendations 121
6.6 Suggestions for further improvements 121
6.7 Conclusion 122
References 123
Appendix A: Program Source codes 128
Appendix B: Acronyms used in the project 140
Appendix C: Average processing speed of cipher and digest algorithms 143
xii
LIST OF FIGURES
FIGURES PAGE
xiii
4.8 Sending Message Sequence 101
4.9 Receiving Message Sequence 102
4.10 Incorrect Password 103
4.11 secureSMS MIDlet program source code in
NETBEANS 6.8 IDE 104
4.12 secureSMS MIDlet program project successfully built in
NETBEANS 6.8 IDE 105
4.13 The SMS Security Project Block diagram 106
5.3 The JAVA Emulator prompting the user to enter the phone number,
the secret/confidential message and add a security digest 112
5.4 secureSMS MIDlet program being executed by the Default Sun Wireless
JAVA Emulator. 112
5.5 The JAVA Emulator asking the recipient to enter the password/private key to
decode and read the encrypted message 113
5.6 The password entered to decode and read the secret message 113
5.7 secureSMS MIDlet program being executed by the Default JAVA™ Platform
Micro Edition SDK 3.0 Emulator Operation Report after successfully sending
a confidential message to recipient phone number 123456789 114
xiv
LIST OF TABLES
TABLES PAGE
xv
CHAPTER ONE
INTRODUCTION
The term security lacks meaning until one has defined what is to be secured and for
phones for third-generation mobile systems (3G) have several security stakeholders for
which the mobile platform must provide security services. Moreover, the potential threats
The first class of security stakeholders, users, expects that mobile phones will offer secure
and reliable communication – that is, they assume their phones can be trusted to handle
sensitive tasks, such as e-commerce transactions. The main threats to this class of
stakeholders are malicious software, such as viruses and Trojans, or weak or misbehaving
security mechanisms. The second class of stakeholders, mobile network operators, relies
related software.
mechanisms.
Operators thus require that the integrity of software can be guaranteed when the mobile
phone is in operation. They also want to be certain that users cannot break SIM lock
mechanisms.
A third class of security stakeholders, content providers, wants to be paid for the content
(music, pictures, videos and software) that users download. It also wants to know that
1
users cannot (mis)use their phones to illegally copy or distribute content. This is where
digital rights management (DRM) functions come into play. However, DRM mechanisms
alone cannot provide all necessary security. To provide a DRM solution that meets
content provider requirements, the mobile phone platform must contain security functions
- integrity,
- authentication and
- authorization.
- Non-repudiation
Confidentiality is ensuring that the data is hidden from those that are not supposed to see
it.
called, plaintext, into cipher text, which hides the content of plaintext. This operation is
The controlling parameter is often called a key. The transformation is called encryption.
With a key it is easy to perform the inverse transform or decryption. Without the key,
Integrity is about ensuring that data has not been replaced or modified without
and a key. Additional information must also be added to the plaintext to verify its
integrity.
2
Authentication is the procedure by which a unit (the claimant) convinces another unit
(the verifier) of its (correct) identity. Authentication is different from authorization, which
Non-repudiation is ensuring that someone who sent a message does not deny that he is the
There are two major classes of cryptographic mechanisms: symmetric and asymmetric. In
symmetric mechanisms, the same key is used for encryption and decryption. Examples of
are also called message authentication codes (MAC). The most popular MAC is the
HMAC algorithm. Because the key in symmetric mechanisms can be used to decrypt
content, it must be kept secret from all but legitimate users of the encryption scheme.
Asymmetric mechanisms use separate pairs of keys for encryption transform and
decryption transform. The public key can be made publicly available, but the private key
must never be revealed. Asymmetric mechanisms are typically used for distributing keys
(for example, a symmetric key) or for digital signing purposes. A public key can be used
to encrypt a symmetric key, which in turn, can only be decrypted by the legitimate
3
receiver using the corresponding private key. A private key may also be used to digitally
sign data. The signature can be verified by anyone who knows the corresponding public
algorithm.
A lot of research works have been done already in this regard; and it has been proved that
most if not all the existing algorithms being employed by GSM companies as security
measures have been broken. Equally the smart-card in GSM phones , SIM card can be
cloned and as such more research need to be done to protect sensitive and critical data
This Masters thesis focuses on ways through which sensitive user’s data can be further
protected (especially short message services (SMS)) against threat by malicious and
criminally-minded users. Equally, all other areas of Information and System security are
- To understudy all the existing GSM cryptographic algorithms and expose their
4
develop a MIDlet program in JAVA that can be used to further secure and
protect user’s sensitive and critical data (SMS only) using Bouncy Castle
- To test run the security JAVA MIDlet software program in compatible Mobile
links. Unlike a fixed phone, which offers some level of physical security (i.e. physical
access is needed to the phone line for listening in), with a radio link, anyone with a
Mobile phones are equally used in several sensitive and mission critical environment e.g.
financial, military, educational e.t.c. where integrity and privacy of data need not be
compromised.
Therefore it is highly important that reasonable technological security measures are taken
to ensure the privacy of user's phone calls and text messages (and data), as well to prevent
unauthorized use of the service being run by the mobile phone applications.
- the data security in Global System Mobile Communication (GSM); all the existing
highlighted.
5
- Software will be used to solidify where weaknesses exist in the GSM data using a
MIDlet JAVA program developed in Bouncy Castle Java cryptographic API. Therefore,
security features of GSM data where integrity of user’s data are critical and need not be
compromised. This Master’s project will focus on developing a software application that
2. Both the sender and recipient have to install the security software: secureSMS
mobile phones to be able to send and receive the secure SMS data.
4. The application does not have a Record Management Store facility yet, so the
mobile phones cannot store the sent and received SMS data for future
reference.
5. The security application can only work in an environment where Global System
(UMTS) network is available and cannot work yet on CDMA (Code Division for
6
1.5 Block Diagram overview of the Project Stages
The block diagrams of the Research and Project stages are depicted below:
STAGE 1
STAGE 2
Software development
STAGE 3
Fig 1.1. The Block diagram of the Research and Project Stages
7
1.6 Project Report Organisation
The chapter also captures the Aims and Objectives of the research project, the
Justification for embarking on the research project on Information and GSM data security
Chapter 2, Literature Review: Various relevant literature and facts that pertain to the
subject study: GSM technologies and GSM data security are highlighted. Also
highlighted are the Java data security technologies that are employed in the project to
Chapter 3, Methodology & System Analysis: To provide further security for data in
This chapter highlights more of ins and outs of the JAVA technologies used in this
project.
Chapter 4, System Design and Development: This chapter handles the full program
design for the development of the security program to protect user’s GSM SMS data
8
using JAVA programming language and NETBEANS 6.8 Integrated Development
Environment.
deployment and implementation of the two programs written in Chapter 4 above to use to
strengthen the existing GSM algorithms and to provide simulation exercise for the
existing GSM security algorithms. The JAVA MIDlet secure SMS program is deployed
using Cable to PC as well as Over the Air (OTA) communication running on compatible
MIDP 2.0 Nokia phones such as Nokia 2700 Classic to implement the solution.
implementations is shown. Problems encountered in the project and the way out of them
are equally highlighted. Furthermore, recommendation for future work on the project is
given and finally this chapter gives a concluding remark on the project.
References cover all the cited works of other people used in this Master thesis.
Appendix B: Covers used GSM and other acronyms and their full meaning.
9
CHAPTER TWO
REVIEW OF RELATED LITERATURE
This chapter presents a general background to the thesis and covers the theoretical basis
2.0.1 Introduction
The biggest challenge facing the whole world now in the area of application and use of
countries spend billions of dollars to procure and maintain computer and IT resources for
establishments like financial, research institutions, industrial firms, etc. deploy huge
amount of fund in the procurement and installation of computer and IT resources and yet
if care is not taken to address the critical concern of myriads of security threats that now
exist everywhere and every time, all these huge capital expenditure will amount to
exercise in futility.
economies to confront and address the monster threatening the successful application of
computer and its resources towards the realisation of computerisation goal of every
economy.
10
Computer Security is usually measured in terms of a set of basic aspects [1]:
- confidentiality,
- integrity,
- authentication and
- authorization
- Non-repudiation
Confidentiality is ensuring that the data is hidden from those that are not supposed to see
it.
Confidentiality of data is achieved by cryptographically transforming original data, often
called, plaintext, into cipher text, which hides the content of plaintext. This operation is
The controlling parameter is often called a key. The transformation is called encryption.
With a key it is easy to perform the inverse transform or decryption. Without the key,
Integrity is about ensuring that data has not been replaced or modified without
and a key. Additional information must also be added to the plaintext to verify its
integrity.
Authentication is the procedure by which a unit (the claimant) convinces another unit
(the verifier) of its (correct) identity. Authentication is different from authorization, which
Non-repudiation is ensuring that someone who sent a message does not deny that he is the
11
There are two major classes of cryptographic mechanisms: symmetric and asymmetric. In
symmetric mechanisms, the same key is used for encryption and decryption. Examples of
are also called Message Authentication Codes (MAC). The most popular MAC is the
HMAC algorithm. Because the key in symmetric mechanisms can be used to decrypt
content, it must be kept secret from all but legitimate users of the encryption scheme.
Asymmetric mechanisms use separate pairs of keys for encryption transform and
decryption transform. The public key can be made publicly available, but the private key
must never be revealed. Asymmetric mechanisms are typically used for distributing keys
(for example, a symmetric key) or for digital signing purposes. A public key can be used
to encrypt a symmetric key, which in turn, can only be decrypted by the legitimate
receiver using the corresponding private key. A private key may also be used to digitally
sign data. The signature can be verified by anyone who knows the corresponding public
algorithm [1].
12
2.0.2 Computer and IT Security Domain [2].
Safety
Safety deals with protection against unintentional physical, social, spiritual, financial,
(graceful degradation)
Security
Protection against intentional attacks, in particular concerning
- Confidentiality
- Integrity
- Availability
- Non-Observability
- Accountability / Non-Repudiation
- Liability
- Anonymity / Pseudonymity
13
Privacy
According to Kothapalli [3], many security threats now exist. A threat can be noticed or
authorisation. An intruders’ goal could be access to either copy or use the key, to change
the key or to block the legitimate owner's use of the key by e.g. erasing it. The threats are
for example that a computer can be infected by importing infected files. If the infected
file is executed, then the malicious code may give different problems.
When a computer system is connected to the Internet unauthorized users may try to
Attacks disrupt the security goals. They affect the confidentiality, integrity and
availability. How are the security goals disrupted? A successful attack on a system on the
Internet can pose a major threat because it can influence the system performance and
services used by millions of user as postulated by Ali Abbas [4]. Suppose the hacker
generates a malicious code on the Internet, the malicious program looks for loopholes in
computers, and it will gain the operating system privileges. Once infected with malicious
14
Attacks target the computers or networks, such as power systems and financial systems.
1. Direct attacks against an information system “through the wires” alone [i.e.
Hacking]
2. The attack can be from the inside as a result of compromising a trusted party
The preparation for an attack may sometimes proceed slowly or in several phases to
and forth from Secure storage of encryption keys compromised computers while awaiting
The final activation phase may direct all compromised computers to inundate a targeted
computer with bogus messages or insert phony data into critical computer systems,
causing then to malfunction at a crucial point or affect other computers. Some recent
computer attacks have focused on only a single new computer vulnerability and have
been seen to spread worldwide through the Internet with astonishing speed.
This section has been subdivided into different parts giving an explanation about attacks
from hackers, attacks on computers, attacks by malicious code, attacks on smart cards and
15
Attacks from hackers
Kothapalli [3] stated in his findings that there is a risk that an unauthorized user will
intrude into the system to access, change or block availability of the encryption keys. For
example if the hacker blocks the availability of the encryption keys, then the owner can't
decrypt his own message. A hacker can try to find security bugs in the operating system,
and try to maximize the access [5]. To access passwords or encryption keys, it is not
Hackers use a variety of tools to attack a system. Each of the tools has distinct
capabilities.
We describe the most popular tools from each of the following categories [6].
- Port scanners
- Vulnerability scanners
- Rootkits
- Sniffers
Port Scanners
Port scanners are probably the most commonly used scanning tools on the Internet. These
tools scan large IP spaces and report on the systems they encounter, the ports available
and other information, such as OS types. A popular port scanner is Network Mapper
16
Vulnerability Scanners
Vulnerability scanners search for a specific vulnerability or scan a system for all potential
vulnerabilities. Vulnerability tools are freely available. The hackers use the tool to scan
systems and evaluate vulnerabilities to intrude into the system. One available
Rootkits
According to findings from Kothapali [3], the computer and network users may today
face a hacker gaining root-level access to a system. This, in essence, gives the intruder
administrative control over the machine and thus an opportunity to cause serious
problems. This means, if the hackers use rootkits, they can install them on a victim's
computer to gain administrative access, and they can hide their presence on a system,
making them difficult to detect. Some of the tasks performed by rootkits are
difficult.
Use the system as a launch point for attacks against other networked systems.
Sniffers
Also according to Kothapali [3], in his findings, Network sniffing or just “sniffing” is
using a computer to read all network traffic. To perform sniffing, a network interface
must be put into promiscuous mode so that it forwards, to the application layer, all the
network traffic, not just network traffic destined for it. The Solaris OE includes a tool
17
called “snoop” that can capture and display all network traffic seen by a network interface
on the system. While being relatively primitive, this tool can quite effectively gather
clear-text user IDs and passwords passing over a network. Many popular protocols in use
today such as Telnet, FTP, IMAP, and POP-3 do not encrypt their user authentication and
network sniffer on the system to gain additional user ID and password information, to
gather information about how the network is constructed and to learn what it is used for
Computer security involves all types of security threats that affect the computer system
bandwidth and computer services and their corresponding security counter measures to
protect the computer systems and its resources eradicate the threats by preventing or
There are many ways of defining what Computer and IT security or Cyber security is all
“[Computer and IT] security deals with the prevention and detection of unauthorised actions by
users of a computer system.”[5]
18
2.1 Types of Attacks
Kothapali [3], in his research findings stated that major hacker attack types include:
- Wire trapping/Eavesdropping
- Intrusion
➢ Back door
➢ Brute force
➢ Dictionary attack
cause harm or subvert the intended function of the computer [9]. Malicious code is
Viruses are pieces of malicious code that attach to host programs and copy themselves
program, worms carry out programmed attacks to start a process on other computers.
A Trojan horse is a program with an unwanted side effect. The program could give the
impression of doing something useful, but it could also actually do something useful. It is
called a Trojan horse because the program also contains a side-effect that the user does
19
Examples of malicious code damage
Spreading other malware, such as viruses. In such a case the Trojan horse is also
spam.
Making screenshots.
numbers.
Phish for bank or other account details, which can be used for criminals activities.
Most important of all: malicious code may search for stored encryption keys.
Wiretapping/eavesdropping [3]
This is an attack that intercepts and accesses data and other information contained in a
to an electrical conductor. It now refers to reading information from any medium used for
a link or even directly from a node, gateway or switch. For example if we access the key
from a hard disk, there is a possibility that they can wiretap the key while transferring
20
Eavesdropping is the intercepting of conversations by unintended recipients. One who
others) is called and eavesdropper. The origin of the term comes from situation in which
people would literally hide out in the eavesdrop to listen in on private conversations. For
example if we access the key from a hard disk, there is a possibility that an attacker can
listen to the commands and maybe then can apply those commands to get the key.
Intrusion [3]
This means that a hacker tries to break the security of, and gain access to, someone else's
system without being invited. If the hacker breaks the security, then the hacker can copy
the encryption keys or modify the keys. For example if the hacker modified the
encryption key, then the owner will loose the valuable information, because the owner
mechanisms. A programmer may sometimes install a back door so that the program can
be accessed for troubleshooting or other purposes. However attackers often use back
Dictionary attack
computer and tries to find out a decryption key or pass phrases by searching large number
21
Dictionary attack is a technique for defeating cipher or authentication mechanism.
Dictionary attacks work because many computer users and businesses insist on using
Dictionary attacks are rarely successful against systems that employ multiple-word
phrases, and unsuccessful against systems that employ random combinations of uppercase
and lowercase letters mixed up with numerals. A form of dictionary attack is often used
dictionary, followed by at the symbol (@), followed by the name of a particular domain.
Lists of given names (such as frank, George, Judith, or Donna) can produce amazing
results. So can individual letters of the alphabet followed by surnames (such as csmith,
jwilson, or pthomas). E-mail users can minimize their vulnerability to this type of spam
by choosing usernames according to the same rules that apply to passwords and
decryption keys -- long, meaningless sequences of letters interspersed with numerals [13].
Brute-force attack
A Brute force attack consists of trying every possible code, combination, or password
until the right one is found [14]. A brute force attack is a method to obtain the user
unavailable to its intended users. Typically the targets are high-profile web servers, and
the attack attempts to make hosted web pages unavailable on the Internet. A Denial of
22
Attacks on smart cards
Smart cards provide security benefits. This can be incorporated in cryptographic protocols
that can protect the data from unauthorized users. However, the protection strength is
Unfortunately there are some tampering techniques to break the smart cards. Those
1. Microprobing
2. Software attacks
3. Eavesdropping
4. Fault generation
5. Cloning
Microprobing can be used to access the chip surface directly. We can observe,
manipulate, and interfere with the integrated circuit. Software attacks use the normal
communication interface of the processor and exploit security vulnerabilities found in the
Eavesdropping techniques monitor, with high time resolution, the analog characteristics
of all supply and interface connections and any other electromagnetic radiation produced
by the processor during normal operation. Fault generation techniques use abnormal
additional access. Cloning entails exact duplicate production of IME number of the smart
23
Invasive attacks [3]
All microprobing techniques are invasive attacks. This involves a tampering of the device
which is clear for anyone. In fact most of the techniques listed here require an utter
The physical attacks are performed to read the contents of memory or modify it through
probes. In a physical attack the probes act a major role to read the contents of data buses,
wires can be cut and alternative circuits can be added. Such attacks are conceivable, but
they require chemicals and acids to remove protective plastic layers around the smart card
processors.
Chemical solvents, etching and staining materials: These materials are able to decapsulate
and accurately de-layer smart card chips. The surface of the chip reveals the various
After this process the chip is accessible for optical or electrical analysis. In modern days
multiple layer chips are using this as an essential step in reverse engineering. The staining
is an advanced etching technique that uses differences in etching speed to reveal subtle
This is an invasive attack. The major component for this tool is a special optical
microscope and the attacker installs a probe. The probe consists of a metal shaft that holds
a long tungsten-hair. These allow the attacker to contact on-chip bus lines without
24
damaging them. This probe is connected via an amplifier to a digital signal processor card
that records or overrides processor signals and also provides the power, clock, reset, and
“Non-invasive attacks are particularly dangerous in some applications for two reasons.
Firstly, the owner of the compromised card might not notice that the secret keys have
been stolen; therefore it is unlikely that the validity of the compromised keys will be
revoked before they are abused. Secondly, non-invasive attacks often scale well, as the
necessary equipment (e.g., a small DSP board with special software) can usually be
These “attacks are based on measuring the time it takes for a unit to perform operations.
This information can lead to information about the secret keys”. To measure the time
required to perform private key operations, an attacker finds the fixed exponents, the
factors of the RSA keys, and break other cryptosystems. If a unit is vulnerable, the attack
is computationally simple and often requires only known cipher text. Cryptosystems are
often simple and require only cipher text. Cryptosystems often take slightly different time
to process different inputs. The performance characteristics typically depend on both the
encryption key and the input data (e.g. plaintext or cipher text). “Attacks exist which can
exploit timing measurements from vulnerable systems to find the entire secret key” [18].
25
Software attacks [3]
A number of attacks can be performed via software. For example, a Trojan horse
user’s workstation.
Glitch attack
Most of the information below is from [19]. This is also a non-invasive attack “In a glitch
attack, the attacker deliberately generates a malfunction that causes one or more flip-flops
to adopt the wrong state. The aim is usually to replace a single critical machine
instruction with an almost arbitrary other one. Glitches can also aim to corrupt data values
as they are transferred between registers and memory”. Of the many fault-induction
attack techniques on smart cards that have been discussed in the recent literature, it has
been observed that glitch attacks are the ones most useful in practical attacks.
Attacks on PDAs
The threats for PDAs, that users need to be concerned with typically fall into one of these
three categories:
1. Identity Theft
3. Vulnerabilities of PDAs
One of the biggest security risks to PDAs is that these devices are handled in such a way
that they are easily forgotten and someone can easily steal them. For that reason securing
the data on the device in standalone mode is probably the best type of precaution users
26
can take. The second risk is because of viruses. Because of these problems encryption
solutions exist for PDAs to maintain security for both the data and links used to
secure either the link to the desktop hot-sync system or for wireless surfing, you basically
need to wrap up your PDA traffic in a VPN. To protect the PDA from wireless
Identity Theft
This can be divided into two different tasks namely, password theft and theft of the PDA
itself. Both of them have the same similarities as the password theft or the theft of the
PDA would reveal the total personal data being stored in the device.
For example, if a user stores his personal details like the bank PIN numbers for his
accounts, then you can estimate what would be the consequences for this.
To protect from such a type of errors, it is always necessary to change your passwords
For any software application there are always viruses associated with them. A virus is a
self-replicating program that spreads by inserting copies of itself into other executable
code or documents. The first virus that was found affecting the PDA’s was the Brador
virus, which attacks through an email or a download very easily. This virus helps to
access the PDA remotely. The most interesting thing for this virus is that it attacks the
Windows CE and then it simply copies itself to the svchost.exe file in the Windows auto
run folder and seizes control over the system after a restart.
27
The only solution for this is to install antivirus software. If the virus attacks, then the
Vulnerabilities of PDA’s
PDAs are most vulnerable to attacks during transport or through services and protocols
used.
attacks.
Active sync and 802.11 wireless vulnerabilities are commonly seen in Windows based
PDAs. Active sync is a protocol that is used over a serial port of the PDA and this can
also be attacked. This synchronization can take place over a serial link or over a network.
Synchronization over a serial link: This is the most direct active sync connection that can
be established by connecting to the serial port of a PC. After this the PC will be prompted
PIN is correct, then the device will be connected and file transfers can take place from
PDA to PC or vice-versa. But if the PIN is incorrect then there will be two more chances
for the user to connect before the connection is broken. However it was observed that
there is no need to reconnect the device. A soft connection reset is enough to establish a
new connection. The key to this vulnerability is the trust relationship between the PDA
and the PC. Since the PDA acts as an authentication server, it should not trust the client
28
2.2 GSM Technology [23]
As early in the 1980s many countries in Europe witnessed a rapid expansion of analogue
cellular telephone system, however, each country developed its own system, and
telegraph operators in Europe, established a working group to develop a new public land
mobile system to span the continent. Because their working language was French, the
GSM (Global System for Mobile communication) is a digital mobile telephone system
that is widely used in Europe. About 85.5 million subscribers use GSM in Nigeria alone
[24]. GSM uses a variation of Time Division Multiple Access (TDMA) and is the most
widely used of the three digital wireless telephone technologies (TDMA, GSM, and
CDMA). GSM digitizes and compresses data, then sends it down a channel with two
other streams of user data, each in its own time slot. GSM operates in the 900MHz,
GSM is the de facto wireless telephone standard in Europe and about over 35 million
subscribers to GSM services are now in Africa [23]. GSM has over one billion users
worldwide and is available in 190 countries. Since many GSM network operators have
roaming agreements with foreign operators, users can often continue to use their mobile
29
GSM together with other technologies is part of an evolution of wireless mobile
Packet Radio System (GPRS), Enhanced Data GSM Environment (EDGE), and Universal
Scalable
30
Fig 2.2. Architecture of the GSM network [25]
The Mobile Station (MS) is the user equipment in GSM. The MS is what the user can see
of the GSM system. The station consists of two entities, the Mobile Equipment (the phone
itself), and the Subscriber Identity Module (SIM), in form of a smart card contained
The Base Transceiver Station (BTS) is the entity corresponding to one site
communicating with the Mobile Stations. Usually, the BTS will have an antenna with
several TRXs (radio transceivers) that each communicate on one radio frequency. The
link-level signalling on the radio-channels is interpreted in the BTS, whereas most of the
higher-level signalling is forwarded to the BSC and MSC. Speech and data-transmissions
31
from the MS is recoded in the BTS from the special encoding used on the radio interface
to the standard 64 kbit/s encoding used in telecommunication networks. Like the radio-
interface, the interface between the BTS and the BSC is highly standardized, allowing
Each Base Station Controller (BSC) controls several hundred BTSs. The BSC takes care
of a number of different procedures regarding call setup, location update and handover for
each MS.
handle mobile subscribers. The basic function of the MSC is to switch speech and data
connections between BSCs, other MSCs, other GSM-networks and external non-mobile-
networks. The MSC also handles a number of functions associated with mobile
subscribers, among others registration, location updating and handover. There will
normally exist only a few BSCs per MSC, due to the large number of BTSs connected to
the BSC. The MSC and BSCs are connected via the highly standardized A-interface
protocols, network providers usually choose BSCs, MSCs and Location Registers from
one manufacturer.
32
2.2.6 The Equipment Identity Register [26]
The Equipment Identity Register (EIR) is an optional register. Its purpose is to register
IMEIs of mobile stations in use. By implementing the EIR the network provider can
blacklist stolen or malfunctioning MS, so that their use is not allowed by the network.
Note that this has not been done in Nigeria by GSM service provider companies so there
- RSS = MS + BSS
Handles handovers
- RSS = MS + BSS
33
2.2.8 GSM –Frequencies [23]
GSM-900:
935-960 MHz
1710-1785 MHz
1805-1880 MHz
34
Time Division Multiple Access
GSM-1800:
35
GSM link [23]
36
Fig 2.4: TDMA in GSM 900
GSM security issues such as theft of service, privacy, and legal interception continue to
raise significant interest in the GSM community. The purpose of this study is to raise
GSM is the most widely used cellular mobile phone system in the world with over 100
million GSM subscribers. GSM was one of the first digital mobile phone systems to
follow the analogue era. Widely known problems with GSM's analogue counter parts
were the possibility of phone fraud through cloning phones and thus calling in someone
else's expense, and the possibility of someone intercepting the phone call over the air and
eavesdropping on the discussion. The GSM system was supposed to correct these
37
problems by implementing strong authentication between the MS and the MSC, as well as
implementing strong data encryption for the over-the-air transmission channel between
The GSM specifications were designed by the GSM Consortium in secrecy and were
GSM network operators. The specifications were never exposed to the public, thus
preventing the open science community around the world from studying the enclosed
authentication and enciphering algorithms as well as the whole GSM security model. The
GSM Consortium relied on Security by Obscurity, i.e. the algorithms would be harder to
crack if they were not publicly available. According to the open scientific community,
one of the basic requirements for secure cryptographic algorithms is that the security of
the crypto system lies solely on the key. This is known as Kerckhoffs' assumption. The
algorithm in question should be publicly available, so that the algorithm is exposed to the
scrutiny of the public. According to the general opinion no single entity can employ
algorithm. Thus, the algorithms designed and implemented in secrecy will probably be
somehow cryptographically weak and contain design faults. Eventually, the GSM
algorithms leaked out and have been studied extensively ever since by the open scientific
community. Interesting facts have been discovered since then, during the cryptanalysis of
38
2.3.1 GSM Security Model [27]
The GSM security model is based on a shared secret between the subscriber's home
network's HLR and the subscriber's SIM. The shared secret, called Ki, is a 128-bit key
used to generate a 32-bit signed response, called SRES, to a Random Challenge, called
RAND, made by the MSC, and a 64-bit session key, called Kc, used for the encryption of
the over-the-air channel. When a MS first signs on to a network, the HLR provides the
MSC with five triples containing a RAND, a SRES to that particular RAND based on the
Ki and a Kc based again on the same Ki. Each of the triples is used for one authentication
of the specific MS. When all triples have been used the HLR provides a new set of five
When the MS first comes to the area of a particular MSC, the MSC sends the Challenge
of the first triple to the MS. The MS calculates a SRES with the A3 algorithm using the
given Challenge and the Ki residing in the SIM. The MS then sends the SRES to the
MSC, which can confirm that the SRES really corresponds to the Challenge sent by
comparing the SRES from the MS and the SRES in the triple from the HLR. Thus, the
39
The MS then generates a Session Key, Kc, with the A8 algorithm using, again, the
Challenge from the MSC and the Ki from the SIM. The BTS, which is used to
communicate with the MS, receives the same Kc from the MSC, which has received it in
the triple from the HLR. Now the over-the-air communication channel between the BTS
Each frame in the over-the-air traffic is encrypted with a different keystream. This
keystream is generated with the A5 algorithm. The A5 algorithm is initialized with the Kc
and the number of the frame to be encrypted, thus generating a different keystream for
every frame. This means that one call can be decrypted when the attacker knows the Kc
and the frame numbers. The frame numbers are generated implicitly, which means that
anybody can find out the frame number at hand. The same Kc is used as long as the MSC
does not authenticate the MS again, in which case a new Kc is generated. In practice, the
same Kc may be in use for days. The MS authentication is an optional procedure in the
beginning of a call, but it is usually not performed. Thus, the Kc is not changed during
40
Only the over-the-air traffic is encrypted in a GSM network. Once the frames have been
received by the BTS, it decrypts them and sends them in plaintext to the operator’s
The A3 is the authentication algorithm in the GSM security model. Its function is to
generate the SRES response to the MSC's random challenge, RAND, which the MSC has
received from the HLR. The A3 algorithm gets the RAND from the MSC and the secret
key Ki from the SIM as input and generates a 32-bit output, which is the SRES response.
Both the RAND and the Ki secret are 128 bits long (Figure 2.8).
41
Figure 2.8: Signed response (SRES) calculation
Nearly every GSM operator in the world uses an algorithm called COMP128 for both A3
and A8 algorithms. COMP128 is the reference algorithm for the tasks pointed out by the
GSM Consortium. Other algorithms have been named as well, but almost every operator
The COMP128 takes the RAND and the Ki as input, but it generates 128 bits of output,
instead of the 32-bit SRES. The first 32 bits of the 128 bits form the SRES response [30].
The A8 algorithm is the key generation algorithm in the GSM security model. The A8
generates the session key, Kc, from the random challenge, RAND, received from the
MSC and from the secret key Ki. The A8 algorithm takes the two 128-bit inputs and
generates a 64-bit output from them. This output is the 64-bit session key Kc [30]. See
Figure 2.9. The BTS received the same Kc from the MSC. HLR was able to generate the
Kc, because the HLR knows both the RAND (the HLR generated it) and the secret key
Ki, which it holds for all the GSM subscribers of this network operator. One session key,
Kc, is used until the MSC decides to authenticate the MS again. This might take days.
42
Figure 2.9: Session key (Kc) calculation
As stated in 2.3.2, COMP128 is used for both the A3 and A8 algorithms in most GSM
networks. The COMP128 generates both the SRES response and the session key, Kc, on
one run. The last 54 bits of the COMP128 output form the session key, Kc, until the MS
is authenticated again. Note that the key length at this point is 54 bits instead of 64 bits,
which is the length of the key given as input to the A5 algorithm. Ten zero-bits are
appended to the key generated by the COMP128 algorithm. Thus, we have a key of 64
bits with the last ten bits zeroed out. This effectively reduces the keyspace from 64 bits to
54 bits. This is done in all A8 implementations, including those that do not use COMP128
implementations [30].
Both the A3 and A8 algorithms are stored in the SIM in order to prevent people from
tampering with them. This means that the operator can decide which algorithms to use
43
independently from hardware manufacturers and other network operators. The
authentication works in other countries as well, because the local network asks the HLR
of the subscriber's home network for the five triples. Thus, the local network does not
The A5 algorithm is the stream cipher used to encrypt over-the-air transmissions. The
stream cipher is initialized all over again for every frame sent. The stream cipher is
initialized with the session key, Kc, and the number of the frame being de/encrypted. The
same Kc is used throughout the call, but the 22-bit frame number changes during the call,
thus generating a unique keystream for every frame [31]. See Figure 2.11.
The A5 algorithm used in European countries consists of three LSFRs of different lengths
[32]. See Figure 2.11. The combined length of the three LSFRs is 64 bits. The outputs of
the three registers are XORed together and the XOR represents one keystream bit. The
LSFRs are 19, 22 and 23 bits long with sparse feedback polynomials. All three registers
are clocked, based on the middle bit of the register. A register is clocked if its middle bit
44
agrees with the majority value of the three middle bits. For example, if the middle bits of
the three registers are 1, 1 and 0, the first two register are clocked or if the middle bits are
0, 1 and 0, then the first and third register are clocked. Thus, at least two registers are
The three LSFRs are initialized with the session key, Kc, and the frame number. The 64-
bit Kc is first loaded into the register bit by bit. The LSB of the key is XORred into each
of the LSFRs. The registers are then all clocked (the majority clocking rule is disabled).
All 64 bits of the key are loaded into the registers the same way. The 22-bit frame number
45
is also loaded into the register in the same way except that the majority clocking rule
applies from now on. After the registers have been initialized with the Kc and the current
frame number, they are clocked one hundred times and the generated keystream bits are
discarded. This is done in order to mix the frame number and keying material together.
Now 228 bits of keystream output are generated. The first 114 bits are used to encrypt the
frame from MS to BTS and the next 114 bits are used to encrypt the frame from BTS to
MS. After this, the A5 algorithm is initialized again with the same Kc and the number of
Since the first GSM systems, other A5 algorithms have been designed and implemented.
The main motivation has been that the original A5 encryption algorithm is too strong to
export to the Middle East. Thus, the first 'original' A5 algorithm was renamed A5/1. Other
algorithms include A5/0, which means no encryption at all, and A5/2, a weaker over-the-
air privacy algorithm. Generally, the A5 algorithms after A5/1 have been named A5/x.
Most of the A5/x algorithms are considerably weaker than the A5/1, which has the time
complexity of 2^54 at most as, shown above. The estimated time complexity of A5/2 is as
low as 2^16. This encryption is used in the USA. The other A5 implementations have not
leaked. Thus, there are no real facts about them, just guesses and assumptions [29, 33,
34].
46
2.4 GSM attack scenarios [27]
The interesting question about the GSM security model is whether a call can be
eavesdropped, now that at least one of the algorithms it depends on has been proven
faulty.
Scientists around the world seem to be unanimous that the over-the-air interception and
real time decoding of a call is still impossible regardless of the reduced key space [29].
But there seem to be other ways of attacking the system that are feasible and seem to be
very real threats. There are also many attacks that are realistic, yet do not abuse any of the
A real-time brute-force attack against the GSM security system is not feasible, as stated
above. The time complexity of the attack is 2^54 (2^64 if the ten bits were not zeroed
out). This requires too much time in order to be feasible in eavesdropping on GSM calls
in real time. It might be possible to record the frames between the MS and the BTS and
If we have a Pentium III class chip with approximately 20 million transistors and the
implementation of one set of LSFRs (A5/1) would require about 2000 transistors, we
would have a set of 10,000 parallel A5/1 implementations on one chip. If the chip was
clocked to 600 MHz and each A5 implementation would generate one output bit for each
clock cycle and we would need to generate 100+114+114 output bits, we could try
approximately 2M keys per second per A5/1 implementation. A keyspace of 2^54 keys
47
would thus require about 900,000 seconds, 250 hours, with one chip. The attack can be
optimized by giving up on a specific key after the first invalid keystream bit. This would
cut the required time down by one third. The attack can also be distributed between
A divide-and-conquer attack manages to reduce the complexity from 2^54 of the brute-
force attack to 2^45, which is a relatively dramatic change (2^9 = 512 times faster
tries to determine the initial states of the LSFRs from a known keystream sequence. The
attacker needs to know 64 successive keystream bits that can be retrieved if the attacker
knows some cipher text and the corresponding plain text [35]. This depends largely on the
format of the GSM frames sent back and forth. The GSM frames contain a lot of constant
information, e.g. frame headers. The required 64 bits might not always be known, but 32
to 48 bits are usually known, sometimes even more. Keep in mind that the attacker needs
In short the divide-and-conquer attack is implemented by guessing the content of the two
shorter LSFRs and then computing the third LSFR from the known keystream. This
would be a 2^40 attack, if the clockings of the first two registers were not dependent on
the third register. Because the middle bit of the third register is used for clocking, we have
to guess about half of the bits in the third register between the clock bit and the LSB as
well. This fact increases the time complexity from 2^40 to 2^45 [29].
48
However, Golic [35], has proposed another divide-and-conquer attack based on the same
assumptions with the average complexity of 2^40.16. Golic showed that only 2^62.32
internal states could be reached from the 2^64 initial states. Based on this assumption, he
describes how to obtain linear equations by guessing n bits in the LSFRs. By solving
these linear equations, one could recover the initial states of the three LSFRs. The
complexity of solving the linear equations is 2^41.16. On average, one would resolve the
Golic [35] also proposed a Time-Memory Trade-Off Attack based on the Birthday
Paradox in the same paper. The objective of the attack is to recover the internal states of
the three LSFRs at a known time for a known keystream sequence corresponding to a
As the two examples above clearly state, the A5 algorithm is not secure
cryptographically, as there is another more feasible attack than the brute-force attack and
it is not secure in practice either, because the brute-force attack in itself is not very hard to
implement with current hardware. Yet, the algorithm is secure enough to prevent over-
the-air call interception and real-time encryption cracking. Unfortunately, the air waves
between the MS and the BTS are not the only vulnerable point in the GSM system.
49
As stated earlier, the transmissions are encrypted only between the MS and the BTS.
After the BTS, the traffic is transmitted in plain text within the operator’s network [28,
36].
This opens up new possibilities. If the attacker can access the operator's signalling
network, he will be able to listen to everything that is transmitted, including the actual
phone call as well as the RAND, SRES and Kc. The SS7 signalling network used in the
operator's GSM network is completely insecure if the attacker gains direct access to it
[36].
In another scenario, the attacker could attack the HLR of a particular network. If the
attacker can access the HLR, he will be able to retrieve the Kis for all the subscribers of
that particular network. Luckily the HLR is usually a bit more secure than the rest of the
network, thus making it a slightly less probable point of entry, yet not completely
improbable either keeping in mind the potential gain involved [36]. Accessing the
signalling network is not very difficult. Although the BTSs are usually connected to the
BSC through a cable, some of them are connected to the BSC through a microwave or
even a satellite link. This link would be relatively easy to access with the right kind of
equipment. Most of the commercially available equipment for GSM eavesdropping seem
to use this particular vulnerability. Unfortunately it is not possible verify this, because the
equipment and specifications are available only to law enforcement personnel and such.
question about whether the attacker wants to crack the A5 encryption protecting the
session of a specific MS or the encryption between the BTS and the BSC and gaining
50
access to the backbone network. The possibility of accessing the cable leaving the BTS
should not be ruled out either. This might be a very real threat and an attack could go
undetected for a long time, if implemented carefully. The ability to tap on to the data
transmitted between the BTS and BSC would enable the attacker to either monitor the call
by eavesdropping on the channel throughout the call or he could retrieve the session key,
Kc, by monitoring the channel, intercept the call over the air and decrypt it on the fly.
Now that he knows the Kc, the real-time encryption is not a problem.
man or such, enter a suitable building and install a wire tap. He might also bribe an
engineer to do it for him or to give him all the Kis for all the subscribers of that particular
The security of the whole GSM security model is based on the secret Ki. If this key is
compromised the whole account is compromised. Once the attacker is able to retrieve the
Ki, he can not only listen to the subscribers calls, but also place calls billed to the original
subscriber's account, because he can now impersonate the legitimate subscriber. The
GSM network has trip wires for this: If two phones with the same ID are powered at the
same time, the GSM network notices this, makes a location query for the phones, notices
that the 'same' phone is in two different locations at the same time, and closes the account,
thus preventing the attacker and the legitimate subscriber from placing calls [29]. But this
51
is not relevant if the attacker is only interested in listening to the calls of the subscriber, as
is assumed in this study. In this case, the attacker can stay passive and just listen to the
The Smartcard Developer Association and the ISAAC security research group discovered
a flaw in the COMP128 algorithm that effectively enabled them to retrieve the secret key,
Ki, from a SIM [29]. The attack was performed on a SIM they had physical access to, but
The attack is based on a chosen-challenge attack that works, because the COMP128
algorithm is broken in such a way that it reveals information about the Ki when the
appropriate RANDs are given as arguments to the A8 algorithm. The SIM was accessed
through a smartcard reader connected to a PC. The PC made about 150.000 challenges to
the SIM and the SIM generated the SRES and the session key, Kc, based on the challenge
and the secret key. The secret key could be deduced from the SRES responses through
differential cryptanalysis. The smartcard reader used in implementing the attack could
make 6.25 queries per second to the SIM card. So the attack required about eight hours to
conduct. The results had to be analyzed as well, but this was apparently very quick,
compared to the actual attack. Thus, the attacker needs to have physical access to the
target SIM for at least eight hours. This is still very reasonable.
Again this vulnerability is also applicable in a social engineering scenario. One can
assume that a corrupt GSM dealer would clone SIM cards in this way and then sell the
cloned cards to third parties who wish to remain anonymous and do not want to buy
legitimate SIMs. One could also try to sell a cloned SIM to a certain person in order to be
able to eavesdrop on his calls later. A corrupt employee might also provide the attacker
52
with the SIM card of the victim, so that the attacker can clone the SIM and later
eavesdrop on the owner's calls. These are all very realistic scenarios in which the
vulnerability found in the COMP128 algorithm compromises the whole security model of
the GSM system, thus leaving the subscribers in the open with no security at all.
2.4.5 Retrieving the Key from the SIM over the Air [27].
The SDA and ISAAC researchers are confident that the same SIM-cloning attack could
be launched over the air as well. Unfortunately, they can probably not confirm their
suspicions, because the necessary equipment is illegal in the United States. The over-the-
air attack is based on the fact that the MS is required to respond to every challenge made
by the GSM network [29, 36]. If the signal of the legitimate BTS is over powered by a
rogue BTS of the attacker, the attacker can bomb the target MS with challenges and re-
construct the secret key from these responses. Again the MS has to be available to the
attacker over the air for the whole time it takes to conduct the attack. It is not known how
long the attack would take when conducted over the air. Estimates vary from eight to
The attack might be conducted in a subway, where the signal of the legitimate BTS is not
available, but the phone is still turned on. The subscriber would be unaware of such an
attack though the fact that the battery of the phone has run out slightly quicker than usual
might make him suspicious. The attack can also be performed in parts: instead of
performing an eight-hour attack, the attacker could tease the phone for twenty minutes
53
every day on the victim's way to work. Once the SIM is cloned, the SIM-clone is usable
until the subscriber gets a new SIM, which in practice does not happen very often.
In another scenario, the subscriber is on a business trip in another country. The attacker
has somehow bullied the local GSM operator to perform this attack on the subscriber’s
phone. The attacker would again be able to reconstruct the Ki based on the MS's SRES
answers and the attack would probably go unnoticed, because the challenges originate
from a legitimate network. Keep in mind that the local network does not know anything
about the Ki, because the triples originate from the HLR of the subscribers home network.
Thus, the local network has to deduce the Ki from the A3 responses.
The same attack used in retrieving the Ki from a SIM card can be used to retrieve the Ki
from the AuC. The AuC has to answer to requests made by the GSM network and return
procedure used in the MS to access the SIM card. The difference is that the AuC is a lot
faster in processing requests than a SIM card is, because it needs to process a lot more
requests compared to one SIM card. The security of the AuC plays a big role in whether
this attack is possible or not and that is out of the scope of this research c.
Another possibility is that someone will be able to crack the A8 key generation algorithm
and retrieve the secret key, Ki, based on the random challenge, RAND, the session key,
Kc, and the SRES response (assuming the same algorithm is used for both A3 and A8 as
is the case with COMP128) with a minimal amount of work. For example, the attacker
54
may find a RAND that produces the Ki as a result (an over simplified example). All three
variables are obtained relatively easily. The RAND and SRES are sent over the air in
plain text and the session key Kc can be relatively easily deduced from the encrypted
frames and the known plain text given enough time. A vulnerability like this in the key
generation algorithm would of course devastate the whole GSM security model and give
the GSM Consortium something to think about when designing their next security
algorithms.
Once a call has been hijacked, the attacker decides on the content. The attacker can listen
to the content of the message being sent by the victim, and send his own version. The
attacker can stop the message, or send his own message. This compromises the integrity
of GSM traffic.
Smart cards in the wireless marketplace provide: improved network security through user
identification, a facility for storing user data, and a mechanism for recording various
service data events. These capabilities enable improved service customization and
services.
Smart cards are tamper resistant and utilize ISO-standardized Application Protocol Data
Units (APDU) to communicate with host devices via PIN codes and cryptographic keys.
55
2.5.1 Types of Smart Cards [37]
Contact Cards require insertion into a smart card reader with a direct connection to a
dynamic read/write capabilities. Most Smart Cards in use for mobile applications
IC Memory Cards: Can store data, but do not have a processor on the card.
Optical Memory Cards: Can only store data, but have a larger memory capacity
56
2.5.2 Smart Card Standards [37]
SIM
The introduction of smart cards for wireless communications occurred in the early 1990’s
when GSM networks deployed the Subscriber Identity Module (SIM) – a security module
subscribers.
RAM, and a serial I/O interface. SIM software usually consists of an operating system,
file system, and application programs. As with all smart cards, the SIM relies on the card
57
STK
The SIM evolved to incorporate the use of the SIM Toolkit (STK) - an important API for
securely loading applications to the SIM. STK allows the mobile operator to
create/provision services by loading them into the SIM without changing anything in the
GSM handset. One convenient way for loading applications to the SIM is over-the-air via
Short Message Service (SMS). Once loaded, applications on the SIM can be activated via
various event triggers registered by the application at the STK. Occurrences such as an
incoming/outgoing call or SMS message, call duration, and/or location of the mobile can
all act as triggers. Control software with the SIM monitors such events and reports
activities via SMS to a network based application server. This facilitates excellent
systems for smart card based value-added services such as mobile prepay and location
based services.
The Java card sits on top of the smart card OS, allowing application programmers’ access
for deployment of services independent of the hardware and OS of the smart card.
Executable code is platform independent, meaning that any card incorporating a Java
Card interpreter can run the same application. When coupled with the STK, the Java card
58
UIM [37]
Introduced by the CDMA Development Group and the 3GPP2, the Removable User
Identity Module (R-UIM) card represents a smart card for use with CDMA based mobile
phones.
WIM [37]
Introduced with WAP specification 1.2, the WAP Identification Module (WIM) provides
end-to-end security for WAP, improving on version 1.1 which only provided transport
S@T [37]
The SIM Alliance has proposed a SIM Alliance Toolkit (S@T) as an industry standard
for WAP based services for via any GSM phase 2+ phone that is not WAP enabled. The
SIM Alliances states that one of the key benefits of S@T is the availability of WAP based
services to non-WAP phones. Furthermore, all WAP browsers earlier than version 1.2 do
not support WIM, making S@T and an enabler of secure transactions thanks to the SIM.
59
2.5.3 Smart Card Applications for Mobile Networks [37]
Smart Cards may be used for a variety of applications such as financial services and
mobile prepay. Ability for them to store personal user-related information allows them to
be used for key data such as personal preferences, health history, and financial
information such as account balances. The ability to dynamically update the information
is a key attribute.
2.6 Cryptography
According to Knudsen [38], the writer of Java Cryptography, has described that
cryptography is the art of secret writing. Generally, cryptography is one of the branches
unreadable format. The reverse process is decryption. It is always used for authentication,
security and data protection such as secure transaction, email, and important file.
Symmetric and asymmetric algorithms are two famous algorithms in cryptography [39].
Java cryptography is the cryptography that is used in Java application for security
written by Sun, has hid those complexities of mathematic. User only uses the security
concept when writing the associate code and leaves the library to deal with the underlying
60
information has raised urgently. Internet causes anonymity. Malicious hackers can mimic
to be someone else to perform illegal business transaction and cause the fraud. Therefore,
awareness on preventing the unauthorized person from accessing and modifying the
Due to the above mentioned phenomenon, Java cryptography has come out with the
solution such as Signature and Cipher to overcome those security concerns. The digital
signature is like the real signature that can identify yourself as whom you declared you
are. It supports for non-repudiation, which does not allow impersonation to be occurred.
Thus, the integrity of data is preserved. The main contribution of cipher is the ability to
unreadable mess. The person who has the right access is able to decrypt the message and
In public key cryptography, two electronic-generated keys are chosen, which are public
key and private key. To perform digital signature on digital data or message, private key
is used. This private key is kept privately by the owner. It is hard to forge the digital
signed message.
before, the security of algorithm depends on the chosen algorithm and decided key length.
61
Generally, the algorithm uses a secret key to change the normal text into unreadable
cipher text (encryption) and then use back the same key and algorithm to get back to the
original text.
Symmetric encryption is simple, fast, and easy to apply on digital message. This is the
computer power. The mobile devices such as cell phone and Personal Digital Assistance
(PDA) phone take longer time (within 100 milliseconds) due to low processor power. The
publicly used symmetric algorithms are DES, Triple DES, AES, Blowfish, RC2 and RC5.
two electronic keys (public key and private key) are used in the operation of asymmetric
encryption and decryption. Symmetric encryption needs the agreement of both parties on
the shared key. The possibility of key disclosure is high. In asymmetric encryption, public
key can be distributed freely while the private key is known and kept only by the owner.
This concept has successfully eliminated the worry in sharing the same key with others
especially for group communication. It is difficult to ensure the shared key is not known
(JCE since JDK 1.4). The class is known as javax.crypto. This is used for encryption and
decryption purposes.
62
2.7.1 The Basic Security in MIDP [2]
The security classes that are inbuilt into J2ME (JAVA 2 platform for Micro Edition) for
MIDP (Mobile Information Device Platform) devices such as Mobile Phones, Personal
MIDP 2.0 compatible devices such as some Nokia mobile phones such as
- Mandates HTTPS
- Does not support JAVA Cryptography Extension but optionally supports its
- Digital signatures: useful for verifying data integrity, generated using a private key
63
2.7.3 Bouncy Castle [2]
hundreds of security ciphers and digests needed for encryption and decryption in a JAVA
MIDlet program.
Mobile messaging can be referred as the exchange of messages over mobile networks. In
secureSMS program, it means the text message communication via mobile phone over
GSM/UMTS network. SecureSMS user is allowed to send and receive SMS by using
handset whenever and wherever the GSM/UMTS cellular telephone networks are
available.
Lately, SMS has replaced the traditional way of human communication. The change is caused
by the changing lifestyle, flexibility of network and advance technology in mobile device.
SMS is one of the communication protocols that used to exchange information in text
message between mobile handsets. SMS is transformed into data packet when travel in
GSM/UMTS network and this technology operates approximately in real time mode.
The previous use of SMS is for one way communication such as news, stocks report, and
weather forecast. Today, SMS is practiced as the easiest, fastest and cheapest daily
64
communication tool. The usage of SMS expands greatly by the rapid growth of mobile
communication. Some of the software applications are programmed to send alert to mobile
device and receive control command from particular handset in SMS. For example, vehicle
tracking service uses the SMS to notify car stolen cases and uses the mobile SMS to remotely
Unfortunately, there is no guarantee on message delivery over all cellular networks. Those
mobile users have the risk of message delay or loss. The worst thing is the message may be
delivered to the wrong person. With the store-and-forward mechanism in Short Message
Service Center (SMSC), the message will be queued for later retransmission [40]. However,
this mechanism cannot solve the issue in exposing the message to adversary or unintended
person. SecureSMS offers a solution to deal with the above issue by encrypting the message
Those encrypted messages are in unreadable form. Therefore, the secret is preserved in case
The message size of SMS varies for different languages use. Generally, it is 160
characters for Alphabetic characters (A-Z). There are two standard for Alphabetic
(ASCII) code and 8-bit Extended Binary Coded Decimal Interchange Code (EBCDIC).
ASCII code is the most popular character codes used which consists of alphabetic
65
The Signaling System 7 (SS7) protocol set the packet size to 140 octets. For translation, it
is equivalent to 160 ASCII 7-bit characters, 140 EBCDIC 8-bit characters, and 70
Chinese 16-bit characters [40]. The Chinese character must be encoded by using the 16-
The maximum characters can be used in SMS is less than the declared amount. This is
because the user data header (UDH) takes out some of the portion of message. UDH is
needed for message segmentation. Sometimes, user needs to send a long message that
exceeds the total length of SMS. In this situation, the SMS splits into two data packets.
The UDH is responsible to store the information about these data packets.
When the multiple data packets reach the recipient phone, UDH able to reassemble them
2.9 Conclusion
The GSM security model is broken on many levels and is thus vulnerable to numerous
Assuming that the security algorithms were not broken, the GSM architecture would still
be vulnerable to attacks targeting the operator's backbone network or HLR and to various
social engineering scenarios in which the attacker bribes an employee of the operator, etc.
Further more, the secretly designed security algorithms incorporated into the GSM system
have been proven faulty. The A5 algorithm used for encrypting the over-the-air
attacks and the intentionally reduced key space is small enough to make a brute-force
attack feasible as well. The COMP128 algorithm used in most GSM networks as the
66
A3/A8 algorithm has been proved faulty so that the secret key Ki can be reverse
All this means that if somebody wants to intercept a GSM call, he can do so. It cannot be
assumed that the GSM security model provides any kind of security against a dedicated
attacker. The required resources depend on the attack chosen. Thus, one should not rely
solely on the GSM security model when transferring confidential data over the GSM
network.
In addition to the possibility of call interception, the faulty COMP128 algorithm makes
SIM cloning a threat as well, thus making it possible for an attacker to place calls at
someone else's expense. However, the reality is that although the GSM standard was
supposed to correct the problems of phone fraud and call interception found in the analog
mobile phone systems by using strong crypto for MS authentication and over-the-air
traffic encryption, these promises were not kept. The current GSM standard and
implementation enables both subscriber identity cloning and call interception. Although
the implementation of cloning or call interception is a little bit more difficult, due to the
digital technology that is used, compared to the analog counterparts, the threat is still very
real, especially in cases where the transmitted data is valuable. Basically, we are where
we used to be with the analog cell phones when it comes to security although the GSM
67
For GSM data to be seen to be secure and confidential, more work is needed to provide
68
CHAPTER THREE
METHODOLOGY AND SYSTEM ANALYSIS
3.0 Methodology
From the research and analysis carried out in Chapter 2 of the study on the existing GSM
security algorithms meant to provide security services for user’s data, it is very clear that
the possibility of an attacker breaking any of them is very easy. Most of the security
algorithms meant to protect user data (SMS, Voice, Service etc.) during communication
have been broken, so for one to use GSM communication that is required in a sensitive
and mission critical environment where confidentiality of data is paramount, there must
In the research work, software based approach will be used to further strengthen the
This project will attempt to reduce the security lapses noticed in the existing security
algorithms of GSM platforms by increasing the security of data (SMS only) during GSM
communication session. A software program, a JAVA MIDlet for Micro 2 platform Micro
Edition (J2ME) will be developed using Bouncy Castle JAVA Cryptographic Application
Programming Interface inside Java Wireless Toolkit for J2ME IDE to further provide
protection of sensitive Short Message Service (SMS) data during communication. Bouncy
Castle API contains quite a lot of GSM cryptographic algorithms that can be combined in
69
For this project, a secure channel is established between two MIDP devices (two
compatible Nokia phones or/and a PC running a JAVA Emulator inbuilt into the
To ensure that the SMS remains confidential, a password-based cipher is used to encrypt
For SMS to be secure during communication there must be confidentiality and integrity
of the message. Authentication is achieved by simply looking at the message itself, which
includes the sender’s phone number. Encrypting the message provides confidentiality,
Using a key K1, sender S encrypts message M1 and sends M. The recipient R receives
message and using the key decrypts it into M2. Provided they share the same password
(private key), so that K1=K2, and no errors happen during transmission, R will recover
the message so that M1=M2. The process of encryption and decryption of SMS data in
M
M1 M2
100100101
K1 K2
S R
70
3.0.0 Possible Causes of error during transmission of SMS from one end to
another
SMS Centre (SC) from a Mobile Station (MS) during transmission include:
3. Call barred - Message is rejected due to barring of the MS (see GSM 09.02,
description of the barring supplementary service, GSM 02.04 and 03.11, and
4. Facility not supported - The message is rejected due to no provision of the SMS
response (GSM 04.08), the IMSI record is marked detached (GSM 09.02), or the
not being able to support the SMS. The short message transfer attempt is rejected
either due to information contained in the class-mark, or the MSC not being able
71
9. Illegal subscriber - Message rejected because of failed authentication.
12. Memory capacity exceeded - Message rejected because the MS doesn't have
enough memory.
However, if the recovered (decrypted) SMS message, M, is tampered with, then the
message digest length of the recovered (decrypted) message will not be the same with the
original message digest used to send the message. In that situation an error message will
be generated by the program and the receiver, R, denied the access to see the message, M.
Please see the complete program flowchart in section 4.2 (Fig. 4.2) of this thesis for the
details in the calculation of the message digest length of the SMS message.
The SMS is simply a byte array containing a header, the ciphered text, and an optional
message’s digest. The header includes two bytes of metadata and two bytes containing the
size of the cipher text. The first two bytes can be used to indicate properties of the
message. In this SMS security program in this thesis, the last bit of the header is used to
72
Metadata Size PAYLOAD Digest
I decided to adopt JAVA technologies for developing the proposed secure SMS data
application because of several advantages JAVA has to offer for developing applications
for memory-limited mobile devices such as mobile phones, Personal Digital Assistants
approach
developers can easily take advantage to further secure mobile applications and
devices.
- JAVA has version that can be installed and deployed in memory limited
73
3.1 JAVA TECHNOLOGIES USED
3.1.1 J2ME
Java 2 Platform, Micro Edition (J2ME) provides a robust, flexible environment for
digital assistants (PDAs), TV set-top boxes, and printers. Java ME includes flexible user
interfaces, robust security, built-in network protocols, and support for networked and
are portable across many devices, yet leverage each device's native capabilities.
3.1.2 MIDP
The Mobile Information Device Profile (MIDP) is a key element of the Java 2 Platform,
Mobile Edition (J2ME). When combined with the Connected Limited Device
Configuration (CLDC), MIDP provides a standard Java runtime environment for today's
most popular mobile information devices, such as cell phones and mainstream personal
digital assistants (PDAs). The MIDP specification was defined through the Java
networked applications.
CLDC and MIDP provide the core application functionality required by mobile
applications, in the form of a standardized Java runtime environment and a rich set of
Java APIs. Developers using MIDP can write applications once, then deploy them quickly
to a wide variety of mobile information devices. MIDP has been widely adopted as the
74
and PDAs, and is supported by leading integrated development environments (IDEs).
Companies around the world have already taken advantage of MIDP to write a broad
MIDP Specifications
The latest MIDP 2.1 specification does not bring new features and UI but instead it
that must present in MIDP 2.1 capable phone. MIDP 2.1 also reinforced MIDP 2.0
MIDP 2.0 (JSR 118) is a revised version of the MIDP 1.0 specification. New features
include an enhanced user interface, multimedia and game functionality, more extensive
backward-compatible with MIDP 1.0, and continues to target mobile information devices
MIDP 1.0 (JSR 37) is the original specification, which provides core application
functionality required by mobile applications, including basic user interface and network
security.
75
3.1.3 JSR (Java Specification Requests)
The Java Community Process or JCP, established in 1998, is a formalized process that
allows interested parties to get involved in the definition of future versions and features of
The JCP involves the use of Java Specification Requests (JSRs) — the formal
documents that describe proposed specifications and technologies for adding to the Java
platform. Formal public reviews of JSRs take place before a JSR becomes final and the
JCP Executive Committee votes on it. A final JSR provides a reference implementation
that is a free implementation of the technology in source code form and a Technology
A JSR describes the JCP itself. As of 2009, JSR 215 describes the current version (2.7) of
the JCP.
3.1.4 MIDlet
A MIDlet is an application that uses the Mobile Information Device Profile (MIDP) of
the Connected Limited Device Configuration (CLDC) for the Java ME environment.
application management software. The MIDlet must contain a class that extends the
76
3.1.5 CLDC
framework for Java ME applications describing the basic set of libraries and virtual-
Device Configuration (CLDC) defines the base set of application programming interfaces
and a virtual machine for resource-constrained devices like mobile phones, pagers, and
mainstream personal digital assistants. When coupled with a profile such as the Mobile
Information Device Profile (MIDP), it provides a solid Java platform for developing
applications to run on devices with limited memory, processing power, and graphical
capabilities.
The CLDC was developed under the Java Community Process as JSR 30 (CLDC 1.0) and
CLDC Specifications
CLDC 1.1 (JSR 139): CLDC 1.1 is a revised version of the CLDC 1.0 specification, and
includes new features such as floating point and weak reference support, in additional to
other enhancements. CLDC 1.1 is backward compatible with CLDC 1.0, and continues to
target small and resource-constrained devices with the objective of maintaining a tight
footprint.
CLDC 1.0 (JSR 30): CLDC Version 1.0 (JSR 30) is the first release of the CLDC
specification, which provides a compact virtual machine and basic libraries for resource-
constrained devices.
77
J2EE J2SE profile profile MIDP
CDC CLDC
Several third-party packages are currently available to supply the lack of encryption
libraries in the MIDP specification [MIDP1.0] [MIDP2.0] [MIDP 2.1]. One of the best
known is Bouncy Castle [BC]. The Legion of Bouncy Castle is a Web community that
and, more significantly, a version targeted to the Java 2 Platform, Micro Edition
(J2ME™).
Bouncy Castle for J2ME has a lightweight API that includes a simple cryptographic
framework and a large number of algorithms such as block ciphers, public-key ciphers,
message digests, etc. It also contains generalized interfaces like BlockCipher, Digest, etc.,
making it easy to switch algorithms and find the right balance between strength and
speed.
78
The version used in this example is Release 1.18, which is approximately 530 KB in size.
The size of the library makes it indispensable to reduce the size of the MIDlet by means
of obfuscation. The obfuscator should remove all unused classes and methods. In
addition, Bouncy Castle uses a few Java classes not available in MIDP, such as
The size of the Bouncy Castle JAR file for J2ME is about 530 kilobytes. The size is due
to the large number of ciphers, digests, and utility classes implemented in Bouncy Castle.
Since one would normally use only one or two of those algorithms, obfuscation is a very
One commonly used obfuscator is Proguard, which is very effective in reducing the size
of the JAR file by removing unnecessary classes and methods. Proguard has been
incorporated into Sun’s Wireless Toolkit, but the default obfuscation parameters are not
The obfuscation of Bouncy Castle presents some special challenges. In particular, some
of the algorithms require Java classes that are not available in CLDC. Examples of this
problem, Bouncy Castle’s J2ME version ships with implementation of those classes for
J2ME. This creates some difficulties because MIDP implementation should reject classes
that are under the java and javax packages for security reasons.
79
Obfuscation with Proguard doesn’t necessarily solve this problem, since package names
java.security.a and the device will reject it anyway. Proguard offers a solution — the –
defaultpackage option. This option will move all the classes to a specific package or
remove the package name altogether. It should be noted that by using the –defaultpackage
option the MIDlet main class package name will change. The JAD and MANIFEST files
If it becomes necessary to unpack the already obfuscated JAR file (for instance, for
Otherwise, Proguard may rename the classes using letters in upper- and lowercases like a
and A, when it runs out of names. This may happen when obfuscating Bouncy Castle
because of the large number of classes involved. Mixed-case classes are legal but there
can be problems when unpacking the file in operating systems that don’t distinguish files
Below is a possible Proguard configuration file that will correctly obfuscate Bouncy
Castle:
-libraryjars midpapi.zip
-injars EncryptedSMS.jar
-outjar EncryptedSMS_o.jar
-defaultpackage
-dontusemixedcaseclassnames
In the secureSMS program developed in this project, Bouncy Castle obfuscation was set
to the highest mark, i.e. 100% and unused additional classes was removed during
80
3.1.8 Integrated Development Environment (IDE) for the Project
The development environment (IDE) for the J2ME MIDlet secure SMS program will be
environment. NetBeans IDE supports development of all Java application types (Java SE
including JavaFX, (Java ME, web, EJB and mobile applications) out of the box. Among
other features are an Ant-based project system, Maven support, refactorings, version
MIDlets are packaged together in suites inside a .jar (Java ARchive) file with a Manifest file
indicating which classes implement which MIDlet. As well as the Java classes, the .jar
file can contain other resources such as images or sound files. A .jad file contains the
location of the .jar as well as the list of MIDlets in the suite and other attributes.
The .jad (Java Application Descriptor) file describing a MIDlet suite is used to deploy
-
Over the air (OTA) deployment involves uploading the .jad and .jar files to a
Web server which is accessible by the device over HTTP. The user downloads
the .jad file and installs the MIDlets onto a MIDP device (compatible mobile
phone).
81
Bluetooth, Cable or IrDa (Infra-rays) and may involve device-specific
software.
The secure SMS solution to be developed in this Master Thesis will employ one or more
For the design of the two programs in JAVA for this project:
- For the secure MIDlet J2ME application that will handle the
communication and
- the simulation program that will be used to simulate existing GSM algorithms,
- Top-Down and
Top-Down design approach makes very easy the breaking of the program design into
smaller simpler chunks. Java uses Object-Oriented Programming (OOP) and hence use
classes for most of its implementation; Top-down design approach suites OOP paradigm
of JAVA programming language. The two programs in this project will be developed
82
The illustration in fig. 3.4 depicts clearly the secure SMS MIDlet application to be
MessageCodec
Uses Uses
SendScreen ReceiveScreen
Creates
Creates
ReportScreen
EncryptedSMS
MIDlet
ErrorScreen
From the figure above, the secure SMS MIDlet program is composed of the main
EncryptedSMS MIDlet class and two screens (SendScreen and ReceiveScreen classes.
MessageCodec class or module is a utility class containing methods that create the
BlockCipher and Digest objects and methods to pack and unpack messages. ReportScreen
is used to display the result of the encryption and decryption process and can also display
83
User Interface
The secure SMS MIDlet program has screens for sending and receiving encrypted
messages. On the sending side, the user interface provides a form containing several
fields used to compose the message. The handling of the Send command will verify that
all fields have been filled and that the password is at least eight characters long (eight
characters are necessary for DES; other algorithms may vary). The secure SMS MIDlet
program then encrypts and sends the message. After delivery it will display a report of the
On the receiving end, the user interface displays an announcement and a field to enter the
message’s password. As previously noted, this illustration assumes that users will
privately exchange passwords. The MIDlet also has a screen to report the received
message’s content.
84
Fig 3.6: Receiving Message Sequence
In case of error, for example, when entering the wrong password, a report will show the
85
3.2.2 Bottom-Up Structured Design Approach
Bottom-Up design is very good for starting up complex software project from its simplest
form up to the most sophisticated form (i.e. Supra System). The programs for this project
will make use of classes which is ideally suited to Top-down structured design approach,
therefore for the purpose of this project; Bottom-Up design approach will not be used.
The next chapter, Chapter Four will present the Design of the two programs (the secure
SMS MIDlet and GSM Simulation program, their flowcharts as well as program codes.
86
CHAPTER FOUR
SYSTEM DESIGN AND DEVELOPMENT
4.1 Introduction
6 classes and modules. Because of this Top-down design approach has been adopted for the
The project was designed and developed using JAVA programming language which is widely
adopted for Object oriented projects. Moreover, JAVA is the defacto programming language
NetBeans 6.8 Integrated Development Environment (IDE) was used to develop the project in
JAVA 2 Platform for Micro Edition (J2ME). The security program is tested using the inbuilt
JAVA™ SDK 3.0 Emulator and subsequently deployed to actual compatible mobile phones.
The secureSMS program is a security GSM data protection and confidentiality program in
Java programming language (Java 2 Platform for Micro Edition) that will protect user’s
2. SendScreen class
87
3. ReceiveScreen class
4. MessageCodec class
5. ReportScreen class
6. ErrorScreen class
EncryptedSMS MIDlet
This is the main class and controls the state changes between two screens. It also owns
the message connection and registers itself as a message listener waiting for incoming
messages. When sending a message, the SendScreen method will launch a new thread
that will take care of sending the message. The SMS port used for the connection is read
88
The program flowchart relating the Class relationship between the main class
EncryptedSMS MIDlet and other five classes is depicted below
ReportScreen ErrorScreen
MessageCodec
Fig 4.1: Program flowchart or Class Diagram relating the project classes or modules
89
START
Initialize
Message Connection Screens,
Message Address Port,
Logo Image
Fig 4.2: Program flowchart relating the methods in the entire program
90
1
NOT
OKAY Generate Error Message
Crosscheck if INPUT
FORM DATA are or Exception
OKAY?
OKAY
91
2
NOT
If Password is Correct Generate Error Message
Correct? or Exception
Correct
FALSE
If digest size/length of Generate Error Message
message sent and message or Exception
received are the same?
TRUE
DISPLAY OR OUTPUT
decrypted message to Recipient
End
92
The main class, the EncryptedSMS class contains the following components that make
arrived or not
message
incoming messages
93
SendScreen Class or Module
This class is responsible for the presentation of form to enable the user enter the required
parameters:
- Phone number
- Message body
- Password/private key
This class is invoked by the main class EncryptedSMS MIDlet to present the user (the
Sender), the interface to enter the required parameters and afterwards passes control back
The following flowchart in fig 4.3 depicts the Interaction between the main class and the
SendScreen class:
94
EncryptedSMS MIDlet class
(Main class)
Invokes the SendScreen Class
SendScreen Class
Calls the method to request User’s
Input Data: Phone no, message,
password, message digest
YES
NO Checks if phone no,
password, message,
add digest =okay
Fig 4.3: Program flowchart depicting relationship between the main class and SendScreen class
This class is responsible for the presentation of form to enable the user enter the required
parameters to decode and read the sent message. The required parameter is
95
- Password/private key used to encrypt and send the message
This class is invoked by the main class EncryptedSMS MIDlet to present the user
interface to enter the required parameter and afterwards passes control back to the Main
Class. The following flowchart depicts the Interaction between the main class and the
ReceiveScreen class.
Main class
ReceiveScreen Class
User enter
password/private key
YES
NO Checks if password
entered = the
password one used to
encrypt the message
Fig 4.4 : Program flowchart depicting relationship between the main class and ReceiveScreen
class
96
MessageCodec Class or Module
This class is responsible for the adding of Bouncy Castle cryptographic classes such as
ciphers, digests and it is also responsible for the encryption and decryption of messages
- Encrypt message
- Decrypt message
This class is invoked by the main class EncryptedSMS MIDlet to handles message
The following flowchart depicts the Interaction between the main class and the
MessageCodec class.
97
EncryptedSMS MIDlet class
Main class
MessageCodec Class
Add digest
Add cryptographic engines
Encrypt message
Decrypt message
Fig 4.5: Program flowchart depicting relationship between the main class and MessageCodec
class
This class is responsible for showing or display of the output status of the secureSMS
program success or failure. The class presents a report screen or interface to the user upon
the time taken to handle encryption and decryption processes by the cryptographic
engines or algorithms.
98
In summary, this class handles the following operations:
This class is invoked by the main class EncryptedSMS MIDlet to handles output report to
The following flowchart depicts the Interaction between the main class and the
ReportScreen class
Main class
ReportScreen Class
Fig 4.6 : Program flowchart depicting relationship between the main class and ReportScreen
class
99
ErrorScreen Class or Module
This class is responsible for the showing or display of error or exceptions encountered
during the execution of the program. For instance, incorrect parameters like phone
number, password etc. are alerted to the user using this class.
This class is invoked by the main class EncryptedSMS MIDlet to handles display of error
The following flowchart in fig 4.7 depicts the Interaction between the main class and the
ReportScreen class.
Main class
ErrorScreen Class
Fig 4.7: Program flowchart depicting relationship between the main class and ErrorScreen
class
100
4.3.1 The Program Source Codes
The program source codes for the six (6) classes or modules used in this project-
The secure SMS MIDlet program has screens for sending and receiving encrypted
messages. On the sending side, the user interface provides a form containing several
fields used to compose the message. The handling of the Send command will verify that
all fields have been filled and that the password is at least eight characters long (eight
characters are necessary for DES; other algorithms may vary). The secure SMS MIDlet
program then encrypts and sends the message. After delivery it will display a report of the
101
The Output Interface Screens (Receive Screen and Report Screen)
On the receiving end, the user interface displays an announcement and a field to enter the
message’s password. As previously noted, this illustration assumes that users will
privately exchange passwords. The MIDlet also has a screen to report the received
message’s content.
In case of error, for example, when entering the wrong password, a report will show the
102
Fig 4.10 : Incorrect Password
103
Fig. 4.11 : secureSMS MIDlet program source codes (classes) in NETBEANS 6.8 IDE
104
Fig. 4.12: SecureSMS MIDlet program project successfully built in NETBEANS 6.8 IDE
105
The Project Block Diagram
Plaintext, P Plaintext
Encryption Decryption
Method Method
Encryption method=Block cipher engine (e.g. Blowfish) and message digest (MD5 ())
106
CHAPTER FIVE: SYSTEM IMPLEMENTATION
This chapter covers the system implementation: the deployment and test-running of the
completed secureSMS JAVA MIDlet program developed in Chapter Four of this thesis.
The secureSMS JAVA MIDlet was developed (built, compiled, preverified, run and
tested) in NETBEANS 6.8 IDE. The program is equally deployed and tested in actual
MIDP 2.0 compatible devices using Nokia 2700 Classic, Nokia 2720a fold and Nokia
3110 Classic mobile phones. Equally any other compatible MIDP 2.0 mobile phone could
For the system i.e. the secure SMS JAVA MIDlet program meant to add additional
pre-verified and obfuscated JAVA file secureSMS.JAR and the accompanying .JAD files
created in Chapter Four will first of all be deployed in any of the following platforms
using Nokia PC Suite for the respective MIDP 2.1 compatible mobile phones:
- Bluetooth
- IrDA
- USB Cable
The secureSMS MIDlet program developed in this Research employed both Over the Air
(OTA) and USB Cable connecting a Nokia 2700 phone to a PC running the program
on NETBEANS 6.8 IDE . The MIDlet JAR and JAD files were then transferred to the
107
5.1.2 Over the Air (OTA)
This entails uploading the .JAR and .JAD files from a computer to a web server on the
Internet and then using WAP on the compatible mobile phones to access the URL of the
web server and then download and install the files to the mobile phone over the air
interface. For instance, the JAR and JAD files could be uploaded using a CPANEL File
over the air (OTA) and downloaded and installed onto the targeted mobile phones.
5.1.3 Bluetooth
The entails uploading the .JAR and .JAD files from a computer having a Bluetooth
wireless adapter to a compatible mobile phone with a Bluetooth device as well. In fact,
virtually all mobile phones now come bundled with inbuilt Bluetooth adapter. The
computer is paired with the mobile phone on Bluetooth network and transfer of files take
5.1.4 IrDA
IrDA entails using the Infra-rays shortwave wireless network on the computer to transfer
the .JAD and .JAR files to a compatible mobile phone having an IrDA network.
This method is one of the easiest; it entails using installed PC Suite (for instance Nokia
PC Suite software) in the computer to easily transfer the .JAD and .JAR files to a
compatible MIDP 2.0 mobile phone connected by an USB cable using Nokia PC Suite.
108
5.2 System Testing
The test plan is to use JAVA Emulator software to test-run the secure SMS JAVA MIDlet
program .JAR and .JAD files on a virtual machine first and then test the same on the real
JAVA machine (i.e. compatible MIDP 2.0 mobile devices/phones) and compare the
5.2.2 Testing on the JAVA PLATFORM Micro Edition SDK 3.0 EMULATOR
This built version of the secureSMS JAVA MIDlet program was tested using inbuilt
JAVA™ Platform Micro Edition SDK 3.0 Emulator integrated with the NETBEANS 6.8
IDE on the development computer. The JAVA emulator software allows testing to be
carried out on a virtual machine before final testing is carried out on the real machine i.e.
the compatible MIDP 2.0 devices such as Nokia compatible mobile phones. This is also
known as simulation.
The result of the testing carried out on the NETBEANS 6.8 IDE with the inbuilt JAVA™
109
Fig. 5.1 : secureSMS Project in NETBEANS 6.8 IDE Environment
110
Fig 5.2: secureSMS MIDlet program being executed by the Default Sun Wireless
JAVA™ Platform Micro Edition SDK 3.0 Emulator integrated in NETBEANS 6.8 IDE
111
Fig 5.3 Fig 5.4
Fig 5.3: The JAVA Emulator prompting the user to enter the phone number, the
secret/confidential message and add a security digest
Fig. 5.4: secureSMS MIDlet program being executed by the Default Sun Wireless JAVA
Emulator. Here user enters phone number 123456789, the confidential message and
added a digest to encrypt the confidential message
112
Fig. 5.5 Fig. 5.6
Fig. 5.5 : The JAVA Emulator asking the recipient to enter the password/private key to
decode and read the encrypted message
Fig. 5.6 : The password entered to decode and read the secret message.
113
Fig.5.7 : secureSMS MIDlet program being executed by the Default JAVA™ Platform
Micro Edition SDK 3.0 Emulator
Operation Report after successfully sending a confidential message to recipient phone
number 123456789
114
5.2.3 Final testing (Testing on the real compatible MIDP 2.0 phones)
The final testing are carried out on the real JAVA machines i.e. on compatible MIDP 2.0
mobile phones like Nokia 2700, Nokia 311 0C, Nokia 2720 engaged on an end-to-end
Figures 5.8 : Screenshots of SecureSMS being used to send a secure SMS to another phone
(i.e. Receiver phone , number +2347065239183) from sender’s phone number 08062926794.
115
Figure 5.9 : Screenshots of SecureSMS being used to receive and decode a secure SMS
message sent from another phone (Sender’s phone, number 08062926794) to Receiver (i.e.
phone number 07065239183)
116
5.3 Performance Evaluation
The secure SMS JAVA MIDlet program worked to expectations going from the results
obtained from the JAVA PLATFORM Micro Edition SDK 3.0 EMULATOR and the
real MIDP 2.0 compatible devices such as Nokia 2700 and Nokia 2720 MIDP 2.0 mobile
phones. The same result should be expected in any other device-dependent SDK JAVA
Emulators or compatible MIDP 2.0 mobile phones such as Nokia 6300 Navigator, Nokia
However, the speed of the execution of the encryption and decryption processes is
directly proportional to the cryptographic digest engines being used. Here, in this project,
Blowfish Algorithm cipher engine was faster than other common engines. See Appendix
engines and digest engines used in this project as contained in Bouncy Castle
cryptographic API.
117
CHAPTER SIX: DISCUSSIONS, SUMMARY & CONCLUSION
6.1 Discussions
SecureSMS JAVA MIDlet security program worked to expectations going from the
results obtained in section 5.2.2 of this thesis report. The program, according to
expectations worked in a Sun JAVA Standard Emulator as well as in the real MIDP 2.0
compatible mobile devices. The secureSMS security program made encryption of SMS
data engaged in an SMS end-to-end communication session possible at the Sender’s end
and equally permitted the SMS data to be decrypted and viewed by the Receiver at the
other end provided the Receiver entered the exact private key(secret password) used by
the Sender to encrypt and send the SMS data. It therefore means that without the
possession of the private key (secret password), anyone that intercepts the SMS data
cannot decrypt and read the content of the SMS message. So, the SMS data is protected
Thorough research work was carried out on the GSM Security model of GSM Operators
and it was very clear that most, if not all, of the GSM Security algorithms have been
cracked and compromised. Therefore, there is cogent need to develop other ways of
protecting user’s GSM data, especially in situations where confidentiality and privacy are
paramount.
This research project tried in that direction by developing a security solution in JAVA
118
Equally, the objectives set out at the beginning of this research work have been achieved
This research carried out in the Master thesis achieved the following set objectives:
COMP128
programming language to protect and secure user’s privacy and sensitive GSM
worldwide, Nigeria inclusive, are done in secrecy and most of them have
2. That a lot attacks have been carried out by attackers to determine the strengths
of these algorithms and it was discovered that these algorithms are weak and
therefore cannot protect user’s data especially in sensitive, safety and mission-
critical environments.
119
3. That there is need for additional work to be done to further secure user’s data
The secureSMS JAVA MIDlet program developed in the thesis in Chapters 3 and 4 have
been tested and solved this problem especially in the protection of user’s SMS data.
During the course of this Masters Research work, a lot of problems were encountered:
1. I had a lot of difficulty implementing a secure SMS data using one of JAVA
alternative JCE classes, Bouncy Castle API, which was used to encrypt and
2. I also encountered some problems during obfuscation of the JAR file after
modifying the proguard code and adjusting the proguard obfuscation level to
the highest.
Another problem encountered was to secure Voice data over the air. This is very
difficult to accomplish. In fact, in many JAVA forums on the internet, it was claimed
that it is not possible to encrypt and decrypt Voice over the air except one does that
for Voice data using VOIP (Voice Over Internet Protocol) but I still believe that it can
120
be done; afterall an Israeli company has done that already for military application and
they are selling the software on the website www.gold-lock.com for around $500. I
6.5 Recommendations
- I recommend that further research work be done to encrypt Voice data over the air
and not necessarily the clamoured VOIP approach, because most voice data
- I also recommend that the secureSMS MIDlet solution be improved upon and
deployed and used in very important sectors in Nigeria economy where the
Army, Nigerian Navy, Nigerian Air force, State Security Services (SSS), Nigeria
Defence Academy and other security outfits in the country. Equally, financial
sector like Banks, finance institutions, Educational Institutions are not left out.
The project can be improved upon to cater for the security needs of e-commerce
and confidentiality in their data communication should also use this secureSMS
Solution.
Further research work can be done to improve on the secure SMS MIDlet program.
- This security solution does not have a storage facility (Record Management
121
to develop this area so as to allow users of the software solution store SMS
- Effort can still be made to find ways to combine more than one cryptographic
6.7 Conclusion
The importance of the security of GSM data: SMS, Voice, Service etc. cannot be over-
emphasized in this IT age where GSM communication is used by over 85 million people
only in Nigeria alone. GSM has become the basic means of communication today;
and shape their life in many ways. The confidentiality and privacy of their dealings and
GSM data must be protected from the hands of criminal-minded individuals as this thesis
tried to achieve.
More work need to be done to protect the confidentiality and privacy of GSM data of
Therefore, all stake holders must put hands on deck to ensure that these objectives are
realised.
122
REFERENCES
[1] Christian Gehrmann and Per Stahl. “Mobile Platform Security,” in Erricsson
Review No.2, pg.1, 2006.
[4] Ali Abbas, Abdulmotaleb El Saddik and Ali MiriGESTS. “State of the Art
Security Taxonomy of Internet Security: Threats and Countermeasures.”
International Trans. Computer Science and Engr. Vol.19, 2005.
[5] Dieter Gollman. Computer Security. New York, NY, USA: John Willey and Sons,
August 1999.
[6] Alex Noordergraaf. “How Hackers Do It: Tricks, Tools, and Techniques.”
[Online].Available:http://pdf.textfiles.com/security/816-4816-10.pdf , 2002
[March 28, 2010].
[7] Eric Goetz, Garett Jones and Brent Kesler. “News Brief about Port Scanners.”
[Online].Available: http://csdl2.computer.org/comp/mags/sp/2005/01/j1009.pdf
[April 3, 2010].
[8] Wolfgang Rankl and Wolfgang Effing. Smart Card Handbook. New York, NY,
USA: John Willey and Sons, 2000.
[10] Eugene Lockett Sung Kyu Park, Guangcheng Jiang, Mike Riddle. “Security
Aspects of Smart Card.” Term Project CS574, Fall 2003, San Diego State
University, USA, Nov. 3, 2003.
[12] Margus Frendenthal, Sven Heiberg and Jan Willemson. “Personal Security
Environment on Palm PDA,” in Proc. 16th Annual Computer Security Application
Conference (ACSA’00), 2000.
123
[14] Udo W. Pooch, Gregory B. White, A. Eric and Fisch. Computer System and
Network Security. San Antonio, Texas, USA: Seenchgix, 1996.
[15] Imperva. “Brute Force Attack.” [Online]. Available:
http://www.imperva.com/resources/glossary/brute-force.html [March 28, 2010].
[16] Rankl W. and Effing W. Smart Card Handbook. New York: John Willey, 2000.
[17] Oliver Kömmerling and Markus Günther. “Design Principles for Tamper-
Resistant Smart card Processors,” in Proc. USENIX Workshop on Smart Card
Technology (Smartcard ’99), Chicago, Illinois, USA, May 10-11, 1999.
USENIX Association, pg. 9-20, ISBN 1-880446-34-0. [Online].Available:
www.cl.cam.ac.uk/~mgk25/sc99-tamper.pdf [March 31, 2010].
[18] Hagai Bar-El. “Known attacks against Smart Cards.” [Online]. Available:
http://www.discretix.com/PDF/Known Attacks against Smart Cards.pdf [March
11, 2010].
[20] David Melnick, Mark Dinman and Alexander. “PDA Security,” in incorporating
handhelds into the Enterprise, Professional 1 edition. New York: Murator
McGraw-Hill, July 25, 2003.
[21] Joel Strauch (2004). “PDA Virus Found in the Wild.” [Online]. Available:
http://www.pcworld.com/article/117278/article.html [March 22, 2010].
[25] Moe Rahnema. “Overview of the GSM System and Protocol Architecture.”
IEEE Magazine, 2002.
[26] John Scourias (2009). “Overview of the Global System for Mobile
Communication.” [Online]. Available:
www.shoshm.uwaterloo.ca/~jsconna/GSM/gsmreport.html. [May 11, 2010].
[27] Lauri Pesonen (1999). “GSM interception”. Department of Computer Science and
Engineering, Helsinki University of Technology. [Online]. Available:
124
www.diaunisa.it/professori/ads/corso-security/www/CORSO-P.html. [April
18, 2010].
[28] David Margrave (2010). “GSM Security and Encryption”. [Online]. Available:
http://www.hackcanada.com/blackcrawl/cell/gsm/gsm-secur/gsm-secur.html
[March 18, 2010].
[29] Cryptome.org (2009). “Crack A5”. [Online]. Available:
http://cryptome.org/jya/crack-a5.htm [August 18, 2010].
[30] M. Briceno, I. Goldberg and D. Wagner. An Implementation of the GSM A3A8
Algorithm, 1999. [Online]. Available: http://www.scard.org/gsm/a3a8.txt ,
www.gsm-security.net/papers/a3a8.shtml [March 29, 2010].
[31] Anderson Ross (1994). “A5 - The GSM Encryption Algorithm”. [Online].
Available: www.tscm.com/phone/gsmcipher.html [March 20, 2010].
[32] Bruce Schneier. “Applied Cryptography”, 2nd Ed., Wiley, New York, 1996,
pp. 758.
[38] Jonathan B. Knudsen. “Java Cryptography.” 1st Edition. O'Reilly Media, 1998,
pp 6.
[39] Lai Ngan Kuen. “Mobile Messaging using Public Key infrastructure.” Masters
Degree Project Report, Department of Computer Science, Faculty of Computer
Science and Information Technology, University Malaya, Malaysia, 2008.
125
[40] ETSI. (July, 1996). “Technical realization of the Short Message Service: Point-to-
Point.” GSM 03.40, version 5.3.0. [Online]. Available:
http://www.shaplov.ru/files/GSM/GSM_03.40_5.3.0.pdf [June 22, 2010].
[41] Carl Hamacher, Zvonko Vranesic and Safwat Zaky. “Appendix E: Characters
Codes,” in Computer Organization, 5th Edition, McGraw Hill Education, 2002.
126
THE APPENDIXES
127
APPENDIX A
EncryptedSMSMIDlet.java class
import java.io.*;
import javax.microedition.io.*;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
import javax.wireless.messaging.*;
// Main class which inits the connection and create the screens
// It owns the MessageConnection and Display
public class EncryptedSMSMIDlet
extends MIDlet
implements MessageListener, Runnable
{
private final Image logo;
private final SendScreen displayable;
private int port;
private MessageConnection conn;
private Message nextMessage;
public EncryptedSMSMIDlet()
{
// init basic parameters
logo = makeImage("/logo.png");
try
{
port = Integer.parseInt(getAppProperty("port"));
}
catch (Exception e)
{
// in case the property is missing or with a wrong format
port = 6535;
}
ErrorScreen.init(logo, Display.getDisplay(this));
displayable = new SendScreen(this);
}
public void startApp()
{
128
// Build the connection string
String connection = "sms://:" + port;
try
{
// Initiate the connection and add listener
conn = (MessageConnection) Connector.open(connection);
conn.setMessageListener(this);
}
catch (IOException e)
{
ErrorScreen.showError("Exception creating message connection to " + connection,
displayable);
}
Displayable current = Display.getDisplay(this).getCurrent();
if (current == null)
{
// shows splash screen
String text = getAppProperty("MIDlet-Name") + "\n" +
getAppProperty("MIDlet-Vendor");
Alert splashScreen = new Alert(null,
text,
logo,
AlertType.INFO);
splashScreen.setTimeout(3000);
Display.getDisplay(this).setCurrent(splashScreen, displayable);
}
else
{
Display.getDisplay(this).setCurrent(current);
}
}
public void pauseApp()
{
}
public void destroyApp(boolean unconditional)
{
try
{
// Close the connection on exit
if (conn != null)
{
conn.close();
}
}
catch (IOException e)
{
// Ignore since we are closing anyway
}
129
}
// Asynchronous callback for inbound message.
public void notifyIncomingMessage(MessageConnection conn)
{
if (conn == this.conn)
{
try
{
// Create a ReceiveScreen upon message removal
BinaryMessage incomingMessage = (BinaryMessage) conn.receive();
ReceiveScreen handler = new ReceiveScreen(this, incomingMessage);
Display.getDisplay(this).setCurrent(handler);
}
catch (IOException e)
{
ErrorScreen.showError("Exception receiving message " + e.getMessage(), displayable);
}
}
}
// Send message in a different thread
public void run()
{
if (nextMessage != null)
{
try
{
conn.send(nextMessage);
}
catch (IOException e)
{
ErrorScreen.showError("Exception sending message(s) " + e.getMessage(), displayable);
}
}
nextMessage = null;
}
// loads a given image by name
static Image makeImage(String filename)
{
Image image = null;
try
{
image = Image.createImage(filename);
}
catch (Exception e)
{
// use a null image instead
}
return image;
130
}
void showMessage(String message)
{
ErrorScreen.showError(message, displayable);
}
void SendScreen(String number, String plainText, String password, boolean addDigest)
{
if (conn != null)
{
// create a new message
BinaryMessage binarySMS = (BinaryMessage) conn.newMessage(
MessageConnection.BINARY_MESSAGE);
String address = new StringBuffer("sms://").append(number).append(":").
append(port).toString();
binarySMS.setAddress(address);
// do encryption
long difference = System.currentTimeMillis();
try
{
byte[] messageContent = MessageCodec.encodeMessage(plainText, password,
addDigest);
// measure how long does it take to encrypt
difference = System.currentTimeMillis() - difference;
if (messageContent != null)
{
binarySMS.setPayloadData(messageContent);
131
}
else
{
showMessage("No connection available");
}
}
// shows the main screen
void showMain()
{
Display.getDisplay(this).setCurrent(displayable);
}
void showReport(String result, byte[] content) {
Display.getDisplay(this).setCurrent(new ReportScreen(this, result, content,
content.length));
}
}
MessageCodec.java
132
}
// Do the encoding of the message including the headers, encrypted content and digest
133
{
byte key[] = password.getBytes();
// create utility streams
ByteArrayInputStream in = new ByteArrayInputStream(messageContent);
DataInputStream din = new DataInputStream(in);
// read the message content
int cipherTextLength = din.readShort();
int options = din.readShort();
byte[] cipherText = new byte[cipherTextLength];
in.read(cipherText, 0, cipherTextLength);
byte[] digest = null;
Digest digestEngine = createDigest();
// If the message contains a digest read it
if ((options & OPTION_DIGEST) == 1)
{
int digestSize = digestEngine.getDigestSize();
digest = new byte[digestSize];
in.read(digest, 0, digestSize);
}
// Create decryption engine
BufferedBlockCipher cipherEngine = new PaddedBufferedBlockCipher(createEngine());
// Initialize the cipher for decryption
cipherEngine.init(false, new KeyParameter(password.getBytes()));
byte[] plainText = new byte[cipherEngine.getOutputSize(cipherTextLength)];
// do encryption
int size = cipherEngine.processBytes(cipherText, 0, cipherTextLength, plainText, 0);
cipherEngine.doFinal(plainText, size);
// It is important to do trimming to remove possible padding
String resultText = new String(plainText).trim();
// verify the text digest
if ((options & OPTION_DIGEST) == 1)
{
// calculate the digest of the resulting text
plainText = resultText.getBytes();
digestEngine.update(plainText, 0, plainText.length);
byte[] calculatedDigest = new byte[digestEngine.getDigestSize()];
digestEngine.doFinal(calculatedDigest, 0);
// compare digests size
if (calculatedDigest.length != digest.length)
{
throw new Exception("Digest size mismatch");
}
// compare byte per byte
134
{
throw new Exception("Digest mismatch. Integrity of the message compromised");
}
}
}
return resultText;
}
}
SendScreen.java
import java.io.*;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
import javax.wireless.messaging.*;
class SendScreen
extends Form
implements CommandListener
{
private final Command sendCommand, exitCommand;
private final TextField number, text, password;
private final ChoiceGroup checksum;
private final EncryptedSMSMIDlet parent;
public SendScreen(EncryptedSMSMIDlet parent)
{
super("Send Confidential/Secure SMS");
this.parent = parent;
// init UI
sendCommand = new Command("Send", Command.OK, 1);
exitCommand = new Command("Exit", Command.EXIT, 1);
number = new TextField("Enter Phone number", "", 20, TextField.PHONENUMBER);
text = new TextField("Enter the message", "", 300, TextField.ANY);
password = new TextField("Enter password", "", 24, TextField.PASSWORD);
checksum = new ChoiceGroup("Add digest", ChoiceGroup.EXCLUSIVE, new
String[]{"Yes", "No"}, null);
// create the form
append(number);
append(text);
append(password);
append(checksum);
addCommand(sendCommand);
addCommand(exitCommand);
setCommandListener(this);
}
public void commandAction(Command cmd, Displayable displayable)
135
{
if (cmd == sendCommand)
{
// verify that all is in place
if (number.getString().length() == 0)
{
parent.showMessage("Enter the Phone No");
else if(text.getString().length() == 0)
{
parent.showMessage("Enter the message");
}
else
{
// send the message
parent.SendScreen(number.getString(), text.getString(), password.getString(),
checksum.getSelectedIndex() == 0);
}
}
if (cmd == exitCommand)
{
parent.notifyDestroyed();
}
}
}
ReceiveScreen.java
import java.io.*;
136
import javax.microedition.lcdui.*;
import javax.wireless.messaging.*;
class ReceiveScreen
extends Form
implements CommandListener
{
private final Command decodeCommand, backCommand;
private final EncryptedSMSMIDlet parent;
private final BinaryMessage message;
private final TextField password;
ReceiveScreen(EncryptedSMSMIDlet parent, BinaryMessage message)
{
super("Got Confidential/Secured SMS");
this.message = message;
this.parent = parent;
// init UI
decodeCommand = new Command("Decode", Command.OK, 0);
backCommand = new Command("Back", Command.BACK, 0);
password = new TextField("Enter message's password", "", 256,
TextField.PASSWORD);
append("Received message from " + message.getAddress());
append(password);
addCommand(decodeCommand);
addCommand(backCommand);
setCommandListener(this);
}
public void commandAction(Command cmd, Displayable displayable)
{
if (cmd == decodeCommand && password.getString().length()>0) {
decode(message);
removeCommand(decodeCommand);
}
if (cmd == backCommand) {
parent.showMain();
}
}
137
{
parent.showMessage(e.getMessage());
}
}
}
ReportScreen.java
import org.bouncycastle.util.encoders.Hex;
import javax.microedition.lcdui.*;
class ReportMessage
extends TextBox
implements CommandListener
{
private final Command backCommand, viewHexCommand;
private final byte[] content;
private final int size;
private final EncryptedSMSMIDlet parent;
ReportScreen(EncryptedSMSMIDlet parent, String text, byte[] content, int size)
{
super("Operation Report!", text, 256, TextField.ANY);
this.content = content;
this.size = size;
this.parent = parent;
backCommand = new Command("Back", Command.BACK, 0);
addCommand(backCommand);
setCommandListener(this);
}
public void commandAction(Command cmd, Displayable displayable)
{
if (getMaxSize() > finalText.length())
{
result = finalText.substring(0, finalText.length() - 3) + "...";
}
setString(result);
}
if (cmd == backCommand)
{
parent.showMain();
}
138
}
}
ErrorScreen.java
139
APPENDIX B
A5 The encryption algorithm used in the GSM system. There are various
implementations named A5/1, A5/2, ... The A5/1 is known as the strong over-
the-air voice-privacy algorithm. A5/x (A5/2 ...) are weaker implementations
targeted at foreign markets out side of Europe. There is also an A5/0
algorithm, which encloses no encryption at all.
A8 The key generation algorithm used in the GSM system. Currently COMP128
algorithm is used as the A3/A8 implementation in most GSM networks.
AuC Authentication Center. The AuC register is used for security purposes. It
provides the parameters needed for authentication and encryption functions
(RAND, SRES and Kc). The RAND is a random challenge generated
randomly. The other two parameters are generated from the RAND and the
subscriber's Ki using the A3 and A8 algorithms. These parameters help to verify
the user's identity (SRES) and provide the session key (Kc).
BSC Base Station Controller. The BSC acts as a common node between multiple BTSs
that together form one BSS and the backbone network.
BSS Base Station Subsystem. The BSS connects the Mobile Station and the NSS. It is
in charge of the transmission and reception. The BSS can be divided in two
parts: The Base Transceiver Station (BTS) or Base Station.
GPRS General Packet Radio Service. GPRS is used to implement high speed data
transmission between the MS and some other party. GPRS utilizes multiple
BTSs in the same BSS. The MS sends different packets to different BTSs which
are reconstructed at the SGSN.
This enables the MS to use a higher transmission speed than one transmission
channel can handle.
GSM Global System for Mobile communications, a mobile phone system based on
multiple radio cells (cellular mobile phone network).
140
HLR Home Location Register. The HLR is part of the AuC. The HLR provides the
MSC with triples specifying a random challenge and a SRES and a Kc based
on the Ki of a specific subscriber and the random challenge. The HLR is also
responsible for knowing the location of the MS at all times.
Kc The secret session key used to encrypt over-the-air traffic between the BTS
and the MS. The Kc is generated after every authentication initialized by the
MSC. The Kc is calculated from the Ki and from the random challenge sent by
the MSC with the A8 GSM Interception http://www.dia.unisa.it/professori/ads/corso-
security/www/CORSO-9... 3 of 14 12/11/2009 10:29 algorithm. The MS and the HLR
both calculate the Kc independently of each other. The Kc is never transmitted
over-the-air.
Ki Ki is the secret key shared between the SIM and the HLR of the subscriber's
home network.
LSFR Linear Shift Feedback Register. A register that generates an output bit based
on its previous state and a feedback polynomial.
MSC Mobile services Switching Center, the central component of the NSS. The MSC
performs the switching functions of the network. It also provides a connection to
other networks.
NSS Network and Switching Subsystem, its main role is to manage the
communications between the mobile users and other users, such as mobile users,
ISDN users, fixed telephony users, etc. It also includes data bases needed in
order to store information about the subscribers and to manage their
mobility.
SGSN Serving GPRS Support Node. A SGSN delivers packets to MSs within its service
area through multiple BTSs. A SGSN also communicates with a HLR in order to
authenticate MSs to enable encrypted communications. In GPRS then SGSN
authenticates the MS instead of the MSC.
141
SIM Subscriber Identity Module. The SIM identifies a subscriber. The subscriber
can use multiple GSM phones with one SIM. All calls are charged on the same
account and the subscriber's phone number stays the same. The SIM card
contains IMSI, Ki and the A3 and A8 algorithms. The SIM is supposed to be
tamper-proof, so that the Ki cannot be retrieved from it.
SRES Signed RESponse. This is the response the MS returns to a challenge made by
the MSC during the MS authentication thus authenticating itself to the MSC
(or SGSN in the case of GPRS).
Symmetric Cryptography
In symmetric cryptography, the same key is used for both encryption and
decryption.
142
APPENDIX C
Table C: 1
Average Processing speed of the cipher algorithms with Bouncy Castle API
The table only provides a relative speed comparison. The lower the number, the faster the
DES 787
3DES 1,997
Rinjadael 3,858
AES-Fast 601
AES-Middle 1,463
AES-Light 1,432
IDEA 881
RC2 1,107
RC5 542
(Source: Forum.Nokia.com)
143
Table C: 2
Average Processing speed of the Message digest algorithms with Bouncy Castle API
The table below presents the same measurements for creating a digest of the same plain
text:
MD5 422
SHA1 667
(Source: Forum.Nokia.com)
144