Classification Of Information
One of the things I struggle with when starting out in mobile application development was the
fact i'd get into code writing from the get go. i'd make up the features in my
head and code them as I went along. all to often, I would later spend time
revising my code ad going back to write a plan midstream. this had
devastating effects on my deadlines and deliverables. it also had a detrimental effect on
the security of my applications.
I have since learned that writing up a
brief outline of the project that i am about to embark on will lp me think of
things ahead of time. while his seems like an obvious thing, there are many
developers that i have spoken with who fail to follow this simple step. one
other thing that i have also begun doing religiously is finding time to look at
the information or data that my application will be handling. for instance, i
use a table the one shown in table 2-1 to classify the data that my application
handles. the table is very basic; however, by putting it down on paper, i am
able to visualize the types of data my application will handle-moreover, i'm
able to formulate a plan to secure that information.
Data Type
|
Personal
|
Sensitive
|
Create
|
Store
|
Send
|
Recive
|
Name
|
Yes
|
No
|
X
|
X
|
X
|
|
E-mail Address
|
Yes
|
Yes
|
X
|
X
|
X
|
|
Phone No,
|
Yes
|
Yes
|
X
|
X
|
||
Addresss
|
Yes
|
Yes
|
X
|
X
|
If you look at the data classification
table 2-1 closely, you will realize that some of the
headings are very subjective. different people will have different opinions on
what constitutes sensitive or personal information. nevertheless, it is usually
best to try and zero in on a common frame of reference as to what constitutes
sensitive and personal information. in this section, you will try to do that by
taking a look at the table header first, and then going over each of the
columns :
data type : you
will be handling this data within your application. it is self-explanatory.
Personal : this
column indicates wheter the data type is calssified as personal information.
Sensitive : This column indicates whether the data type is
calssified as sensitive information.
Create : Does your application allow this user to creates
this data type?
Store : Does your application store this data type either on
the device or on a server?
Sent : Is this data type sent across the network to another
party or server?
Receiver : Is this
data type received over the network from another party?
What Is Personal Information ?
Personal information can be classified as data that is known
to you and a limited number of people within your social circle. Personal
information is usually something that is private to you, but that you worth be
willing to share with close friends and family members. Examples of personal
information can be your phone number, address, and e-mail address. The effects
of having this information compromised and leaked will usually not cause
significant physical or emotional harm to yourself or your family members.
Instead, it may give rise to situations as that will greatly inconvenience you.
What Is Sensitive Information?
Sensitive information is worth much more than personal
information. Sensitive information is usually information that you will not
share with anyone under most circumstances. Data of this type includes your
passwords, internet banking credentials ( such as PIN codes), mobile phone
number, social security number, or address. If sensitive information is
compromised, than the effects may cause you either physical or emotional harm.
This information should be protected all the time, regardless of whether it is
in transit or in storage.
Caution how can the loss of sensitive information cause you
physical or emotional harm consider losing your online banking credentials. An
attacker can cause you immense financial (physical and emotional) harm by
stealing all your money. A stalker that gets hold of your phone number or
address can pose a grave threat to you or your family’s physical well being.
Analysis Of Code
If we go back to the indirect attack that we discussed
earlier in this chapter, it is evident that data kept in clear view on and sd
card is a significant rise and should be avoided at all costs. Data theft or
exposure has been one of the leading causes of financial and reputational loss
for corporations. But just because you are writing in application for a single
user of a Smartphone does not mean you should threat data theft lightly. In the
case of proxim, this weakness of clear.
Let’s go through the code, section by section. The first bit
of code initialized secretkeyspec class and creates a new instance of the
cheaper calss in preparation of generating and AES secret key :
SecretKeySpec sKeySpec= new SecretKeySpec(key,”AES”);
Cipher cipher;
Byte[] chipertext=null;
The preceding code also initializes a byte array to store
the shipertext. The next bit of code
prepares the Cipher class to use the AES algoritm:
Cipher=Cipher.getInstance(“AES”);
Cipher.init(Cipher.ENCRYPT_MODE,sKeySpec);
The cipher.init() function initializes the cipher object, so
it can perform encryption using the
generated secret key. The next line of code encrypts the plain text data and stores the encrypted contents in the
ciphertext byte array:
Ciphertext=cipher.doFinal(data);
In order for the preceding routine to work, it should always
have an encryption key. It is important that we use the same key for the
decryption routine, as well. Otherwise,
it will fail. It is generally better to write your own key generator that will generate a random number –based key. This will make it harder
for an attacker to guess than a normal password. For this exercise, I used the
key- generation algoritm shown in Listing 2-6.
Listing 2-6. A Key-Generation Algoritm
Publicsatticbyte[] generateKey(byte[] randomNumberSeed){
SecretKey sKey = null;
Try{
KeyGenerator keyGen =KeyGenerator.getInstance(“AES”);
SecureRandom random = SecureRandom.getInstance(“SHA1PRNG”);
Random.setSeed(randomNumberSeed);
keyGen.init(256,random);
sKey=keyGen.generateKey();
} catch (NoSuchAlgorithmException e) {
Log.e(TAG, “No Such algorithm exception”) ;
}
return sKey.getEncode() ;
Log.e(TAG, “No Such algorithm exception”) ;
}
return sKey.getEncode() ;
Now, lets make analayze the code.
This pair of lines initiaizez the KeyGenerator class so it can generate
AES-specific keys, and then initializes the device’s random-number generator so
it can be generate random numbers :
KeyGenerator keyGen
= KeyGenerator.getInstance (“AES”) ;
SecureRandom random = SecureRandom.getInstance (“SHA1PRNG”) ;
SecureRandom random = SecureRandom.getInstance (“SHA1PRNG”) ;
These random number are encode
usinng SHA1. SHA1 or secure Hash Algorithm 1, is a cryptographic hashig
function. The algorithm will operate on a piece of data that has an arbitrary
lenght and will produce a short string that is of fixed size. If any piece of
the data being hashed is changed, then the resulting hash will vary. This is an
indication that a piece of data has been tampered with.
Text data
storage exists. Anyone who has access to the device’s SD Card will able to copy
personal information, such as names addresses , phone number and email
addresses.
We can trace the flaw in the original code to the
point were we save the data. The data Itself is not obscured or encrypted in anyway . if we were
to encrypt the data, then the personal information would still be safe . let’s
take a look at how we can implement encryption in our original proxim code.
Chapter 5 will cover public infrastructure and encryption in depth : so for the
purposes of this exercise, we will cover a very basic example of advanced
ancryption standard (AES) encryption.
Public key encryption or asymmetric encryption is a method of encrypting or
obfuscating dat by using two different types . each user has two keys, a public
and a private one. His private key can only decrypt data that is encrypted by the public key. The key is called public because
it is really given away to other users. It is this key that other user will use
to encrypt data.
Where to implement encryption
We will encrypt our data just before we save it to
the SD Card . in this way, we never write the data to SD Card in a format that
can be read by anyone. An attacker that collects your data encryption data has
to first use a password to decrypt the data before having access to it.
We will use AES to encrypt our data using a password
or key. One Key is required to both encrypt and decrypt the data. This is also
known is symmetric key encryption. Unlike public key, encryption, this key is
the sole one used to both encrypt data. This key will need to be stored
securely because, if it is lost or compromised, an attacker can use it two
decrypt the data. Listing 2-5 shows the encryption routine .
Listing 2-5.
An Encryption Routine
Privatestaticbyte[] encrypt (byte[] key, byte[]
data){
SecretKeySpec sKeySpec= new SecretKeySpec(key,”AES”);
Ciper
chipher;
Byte[]
ciphertext = null;
Try{
Cipher
= Cipher.getInstance(“AES”);
Cipher
.int(Chiper.ENCRYPT_MODE,sKeySpec);
Ciphertext = cipher.doFinal(data);
}catch (NoSuchAlgorithmException e){
Log.e(TAG,”
NoSuchAlgorithmException”);
}catch (NoSuchPaddingException e){
Log.e(TAG,”
NoSuchPaddingException”);
}catch (NoSuchBlockSizeException e){
Log.e(TAG,”
(NoSuchBlockSizeException”);
}catch (BadPaddingException e){
Log.e(TAG,”BadPaddingException”);
}catch (InvalidKeyException e){
Log.e(TAG,”
InvalidKeyException”);
}
Return chiphertext;
}
Klasifikasi Informasi
salah satu hal yang saya juangkan saat ketika memulai dalam pengembangan aplikasi mobile adalah fakta saya akan mencoba menulis kode dari the get go. saya akan membuat fitur di dalam kepala saya dan kode mereka saat saya pergi sekitarnya.semuanya terlalu sering, saya kemudian akan menghabiskan waktu merevisi iklan kode saya akan kembali menulis rencana midstream. ini memiliki pengaruh yang sangat buruk pada tenggat waktu dan kiriman saya. itu juga memiliki efek yang merugikan pada keamanan aplikasi saya.
saya telah belajar bahwa menulis sebuah gambaran singkat dari proyek yang saya akan memulai akan lp saya memikirkan hal-hal dari waktu ke depan. Sementara itu tampaknya seperti hal yang jelas, ada banyak pengembang yang gagal berbicara dengan saya dalam mengikuti langkah sederhana ini. satu hal lain yang saya juga telah memulai menemukan waktu untuk melihat informasi atau data bahwa aplikasi saya akan tangani. misalnya, saya menggunakan tabel yang ditunjukkan dalam tabel 2-1 untuk mengklasifikasikan data bahwa aplikasi yang saya tangani. tabel sangat dasar; Namun, dengan meletakkan di atas kertas, saya dapat memvisualisasikan jenis data aplikasi saya akan menangani-apalagi, saya bisa merumuskan rencana untuk mengamankan informasi tersebut.
jika Anda melihat tabel klasifikasi data 2-1 lebih dekat, Anda akan menyadari bahwa beberapa judul yang sangat subjektif. orang yang berbeda akan memiliki pendapat yang berbeda tentang apa yang merupakan informasi sensitif atau pribadi. Namun demikian, biasanya terbaik untuk mencoba dan nol dalam pada kerangka acuan untuk apa yang merupakan informasi sensitif dan pribadi. di bagian ini, Anda akan mencoba untuk melakukan itu dengan melihat pada header tabel pertama, dan kemudian akan lebih dari masing-masing kolom:
Tipe data : Anda akan menangani data ini dalam aplikasi Anda. Itu cukup jelas.
Personal : Kolom ini menunjukkan klasifikasi jenis data sebagai informasi pribadi.
Rahasia : Kolom ini menunjukkan apakah tipe data tergolong
informasi rahasia.
Membuat: Apakah aplikasimu mengizinkan pengguna untuk tipe
data ini?
Penyimpanan : Apakah aplikasimu ini tipe data yang salah
satunya aktif di penyimpanan peranhkat atau sedikit di aktif di server?
Pengirim : Apakah tipe data ini mengirim tepat di jaringan pihak
lain atau server?
Penerima : Apakah tipe data ini menerima lebih jaringan dari
pihak lain?
Apakah informasi pribadi?
Informasi pribadi dapat di golongkan sebagai data yang kamu
ketahui dan di batasi nomor orang di lingkungan sosialmu. Informasi pribadi
biasanya adalah sesuatu yang pribadi untukmu, tetapi kamu bersedia untuk
membagi dengan teman-teman dekat dan anggota-anggota keluarga. Contoh-contoh
dari informasi pribadi biasa seperti nomor teleponmu, alamat dan alamat email. Efek-efek
setelah informasi ini di kompromikan dan bocor biasanya tidak akan menyebabkan
kerusakan fisik atau emosi yang berarti untuk dirimu dan anggota-anggota
keluargamu. Sebaliknya hal itu akan menimbulkan situasi yang sangat tidak nyaman
untukmu.
Apakah informasi rahasia?
Informasi rahasia bernilai lebih daripada informasi pribadi.
Informasi rahasia biasanya kmu tidak akan membagi informasi dengan siapapun
dalam berbagai situasi apapun. Data dari tipe ini termasuk kode rahasia, kartu
kredit (seperti kode PIN), nomor telepon bergerak, nomor KTP, atau alamat. Jika
informasi rahasia di kompromikan kemudian dapat menyebabkan kerugian bagi anda
baik fisik maupun emosi. Informasi ini akan melindungi kapanpun tanpa
menghiraukan atau apakah ini perjalanan atau penyimpanan.
Mari pergi
dengan kode. Bagian demi bagian. Bit pertama dari kode menginisialisasi
kelas spesifikasi kunci rahasia dam membuat contoh baru dari kelas Cipher dalam
persiapan menghasilkan sebuah kunci rahasia AES.
SecretKeySpec
sKeySpec = new SecretKeySpec(key,”AES”) ;
Cipher cipher;
byte[ ] ciphertext = null;
Cipher cipher;
byte[ ] ciphertext = null;
Kode sebelumnya
juga menginisialisasinarray byte untuk menyimpan ciphertext. Bit selanjutnya
dari kode menyiapkan kelas cipher untuk menggunakan algoritma AES
cipher =
Cipher.getInstance(“AES”) ;
Cipher.init(Cipher.ENCRYPT MODE, skeySpec) ;
Cipher.init(Cipher.ENCRYPT MODE, skeySpec) ;
Fungsi
cipher.init menginisialisasi objek cipher, sehingga dapat melakukan enkripsi
menggunakan kunci rahasia yang dihasilkan` baris berikutnya dari kode
mengenkripsi data teks biasa dan menyimpan isi yang telah dienkripsi dalam text
cipher array byte.
Ciphertext
= cipher.doFinal(data) ;
Dalam rutinitas
sebelumnya untuk bekerja, itu harus selalu memiliki kunci enkripsi. Itu
penting bahwa kita menggunakan kunci untuk rutinitas dekripsi, dengan baik .
Jika tidak, itu akan gagal. Ini lebih baik untuk menulis kunci generator anda
sendiri yang akan menghasilkan nomor acak- berdasarkan kunci. Ini akan membuat
lebih suit bagi seorang penyerang untuk menebak dari password yang normal.
Untuk latihan ini, saya menggunakan kunci, generasi algoritma ditampilkan dalam
daftar 2-6.
Publicstaticnyte[ ] generateKey(byte[ ] randomNumberSeed) {
SekretKey sKey = null;
try {
KeyGenerator keyGen = KeyGenerator.getInstance(”AES”) ;
SecureRandom random = SecureRandom.getInstance(“SHA1PRNG”) ;
random.setSeed(randomNumberSeed) ;
keyGen.init(256,random) ;
sKey = keyGen.generateKey( ) ;
} catch (NoSuchAlgorithmException e) {
Log.e(TAG, “No Such algorithm exception”) ;
}
return sKey.getEncode() ;
SekretKey sKey = null;
try {
KeyGenerator keyGen = KeyGenerator.getInstance(”AES”) ;
SecureRandom random = SecureRandom.getInstance(“SHA1PRNG”) ;
random.setSeed(randomNumberSeed) ;
keyGen.init(256,random) ;
sKey = keyGen.generateKey( ) ;
} catch (NoSuchAlgorithmException e) {
Log.e(TAG, “No Such algorithm exception”) ;
}
return sKey.getEncode() ;
Sekarang,
mari menganalisis kode. Pasangan dari baris ini menginisialisasi kelas
KeyGenerator sehingga dapat menghasilkan AES – tombol khusus, dan kemudian menginisialisasi perangkat acak – nomor
generator sehingga itu dapat menghasilkan angka acak:
KeyGenerator
keyGen = KeyGenerator.getInstance
(“AES”) ;
SecureRandom random = SecureRandom.getInstance (“SHA1PRNG”) ;
SecureRandom random = SecureRandom.getInstance (“SHA1PRNG”) ;
Nomor acak ini menyandikan menggunakan SHA1. SHA1,
mengamankan algoritma hash 1, ini adalah fungsi hashing criptografi. Algoritma
akan beroperasi pada bagian data yang memiliki panjang dan akan menghasilkan benang pendek yang yang
merupakan ukuran tetap. Jika setiap bagian dari data berubah, maka
hash yang dihasilkan akan berbeda-beda. Ini merupaka indikasi bahwa sebagian
data telah dirusak
Penyimpanan data teks ada. Siapapun yang memiliki akses ke SD Card
perangkat akan mampu menyalin informasi pribadi, seperti nama alamat, nomor
telepon dan alamat email. Kita bisa melacak cacat dalam kode asli ke titik menyimpan data. Data
Sendiri tidak dikaburkan atau dienkripsi dengan cara apapun. jika kita mengenkripsi data, maka informasi pribadi
masih akan aman. mari kita lihat bagaimana kita dapat menerapkan enkripsi dalam
kode PROXIM asli kami. Bab 5 akan mencakup infrastruktur publik dan enkripsi
secara mendalam: jadi untuk keperluan latihan ini, kita akan membahas contoh
yang sangat dasar standar enkripsi tersebut maju (AES) enkripsi. Enkripsi kunci
publik atau enkripsi asimetris adalah metode enkripsi atau obfuscating data
dengan menggunakan dua jenis yang berbeda. setiap pengguna memiliki dua kunci,
publik dan satu pribadi. Kunci pribadinya hanya dapat mendekripsi data yang dienkripsi
dengan kunci publik. Kuncinya disebut publik karena itu benar-benar diberikan
kepada pengguna lain. Ini adalah kunci ini bahwa pengguna lainnya akan
digunakan untuk mengenkripsi data.
Dimana Untuk Menerapkan Enkripsi
Kami akan mengenkripsi data kami sebelum kami simpan ke SD Card. dengan cara ini, kita tidak pernah menulis data ke SD Card dalam format yang dapat dibaca oleh siapa pun. Seorang penyerang yang mengumpulkan data yang Anda enkripsi data, pertama harus menggunakan sandi untuk mendekripsi data sebelum memiliki akses ke sana.
Kami akan menggunakan AES untuk mengenkripsi data kami menggunakan password atau kunci. Salah satu kunci diperlukan untuk kedua enkripsi dan mendekripsi data. Hal ini juga dikenal enkripsi kunci simetris. Tidak seperti kunci publik, enkripsi, kunci ini adalah satu-satunya yang digunakan untuk mengenkripsi kedua data. Kunci ini harus disimpan dengan aman karena, jika hilang atau dikompromikan, penyerang bisa menggunakannya dua kali mendekripsi data. Listing 2-5 menunjukkan rutin enkripsi.
Kami akan mengenkripsi data kami sebelum kami simpan ke SD Card. dengan cara ini, kita tidak pernah menulis data ke SD Card dalam format yang dapat dibaca oleh siapa pun. Seorang penyerang yang mengumpulkan data yang Anda enkripsi data, pertama harus menggunakan sandi untuk mendekripsi data sebelum memiliki akses ke sana.
Kami akan menggunakan AES untuk mengenkripsi data kami menggunakan password atau kunci. Salah satu kunci diperlukan untuk kedua enkripsi dan mendekripsi data. Hal ini juga dikenal enkripsi kunci simetris. Tidak seperti kunci publik, enkripsi, kunci ini adalah satu-satunya yang digunakan untuk mengenkripsi kedua data. Kunci ini harus disimpan dengan aman karena, jika hilang atau dikompromikan, penyerang bisa menggunakannya dua kali mendekripsi data. Listing 2-5 menunjukkan rutin enkripsi.
Listing 2-5. Sebuah
Rutin Enkripsi
Privatestaticbyte [] mengenkripsi (byte [] kunci, byte [] data) {
SecretKeySpec sKeySpec = baru SecretKeySpec (kunci, "AES");
Ciper chipher;
Byte [] ciphertext = null;
try {
Cipher = Cipher.getInstance ("AES");
Int Cipher (Chiper.ENCRYPT_MODE, sKeySpec);
Ciphertext = cipher.doFinal (data);
Privatestaticbyte [] mengenkripsi (byte [] kunci, byte [] data) {
SecretKeySpec sKeySpec = baru SecretKeySpec (kunci, "AES");
Ciper chipher;
Byte [] ciphertext = null;
try {
Cipher = Cipher.getInstance ("AES");
Int Cipher (Chiper.ENCRYPT_MODE, sKeySpec);
Ciphertext = cipher.doFinal (data);
} catch (NoSuchAlgorithmException e) {
Log.e (TAG, "NoSuchAlgorithmException");
} catch (NoSuchPaddingException e) {
Log.e (TAG, "NoSuchPaddingException");
} catch (NoSuchBlockSizeException e) {
Log.e (TAG, "(NoSuchBlockSizeException");
} catch (BadPaddingException e) {
Log.e (TAG, "BadPaddingException");
} catch (InvalidKeyException e) {
Log.e (TAG, "InvalidKeyException");
}
Kembali chiphertext;
}
Vocabularies :
1. Devastating : Sangat Efektif
2. Detrimental : Merugikan
3. Explanatory : Jelas
4. Circumstances : Keadaan
5. Compromised : Terganggu
6. Harm : Bahaya
7. Immense : Besar
8. Indirect : Tidak Langsung
9. Arbitrary : Sewenang-wenang
10. Otherwise : Jika tidak
11. Sole : Tunggal