• Tidak ada hasil yang ditemukan

Week 14 - Advanced Encryption Standard (AES) 1

N/A
N/A
nicesuu

Academic year: 2023

Membagikan "Week 14 - Advanced Encryption Standard (AES) 1"

Copied!
8
0
0

Teks penuh

(1)

Week 14_Advanced Encryption Standard (AES) 1

14.1 AES - Advanced Encryption Standard Algorithm In Cryptography | AES Explained

https://youtu.be/Z_7aOkS8tOA?si=f8GlZ9c4t341tzI5 Outline:

 What is AES?

 Features of AES?

 How does AES work?

 Applications of AES

 Difference's b/w AES & DES

1. What is AES?

The AES algorithm (also known as the Rijndael algorithm) is a symmetric block cipher algorithm that takes a block size of 128 bits and converts them into ciphertext using keys of 128, 192, and 256 bits.

2. Features of AES

Let us have a look at the features that make AES encryption algorithm unique.

 It uses Substitution and Permutations, also called SP Networks.

It consists of multiple rounds to produce ciphertext.

It has a series of linked operations including

Replacing inputs with specific outputs Substitution Involve bit shuffling Permutations

 A single key is expanded to be used in multiple rounds.

Only start out with a single key which can be either a 128-bit, 192-bit or a 256-bit key.

Eventually this one key is expanded to be used in multiple rounds throughout the encryption and the decryption cycle.

 AES performs on byte data, instead of bit data.

AES treats 128 bits of a clear text block as 16 bytes

 No. of rounds is dependent on key length.

128-bit Key Length 10 rounds 192-bit Key Length 12 rounds 256-bit Key Length 14 rounds

A round key is required for each of these rounds but since only one key is input into the algorithm, the single key needs to be expanded to get the key for each round including the round zero.

3. How does AES work?

Manner of Storage

Before we move ahead, we need to understand how data is being stored during the process of AES encryption.

Everything is stored in a 4 4 matrix format.

Known as state array.

We'll be using these state arrays to transmit data from one step to another and from one round to the next round.

Each round takes state array as input and gives similar output.

(2)

16-byte matrix, with each cell representing one byte.

4 bytes 1 word, so each state array has 4 words.

Key Expansion

The key is expanded to n+1 rounds, with n being no. of rounds.

The first round is the key zero round.

4 words in each key.

Each key is used for a single round.

Process

In the very beginning the plaintext is captured and passed through an XOR function with the round key as a supplement.

This key can be considered the first key from the n+1 expanded set.

The state array resulting from the above step is passed on to a byte substitution process.

Beyond that there's a provision to shift rows in the state arrays.

Later on the state array is mixed with a constant matrix to shuffle its column in the mix column segment.

After which we add the round key for that particular round.

The last four steps mentioned are part of every single round that the encryption algorithm goes through.

In the last round however we skip the mix columns portion.

Adding the Round key

Plaintext is stored in a state array and XOR'd with K0. K0 is the first key in expanded key set.

Performed only once per block.

Will be performed once again at the end of each round.

Byte Subsitution (Sub-Bytes)

Clever lookup table to map one byte to another.

Works as a substitution table.

Each byte is converted to hexadecimal, with 2 equal parts.

(3)

First part is the row; second part is column.

Shift Rows

Shifting row elements among each other Increases complexity of the algorithm

First row is to be skipped, second row moves 1 place, third row moves 2 places and last row moves 3 places

Mix Columns

Multiply each column with a constant matrix Resultant matrix forms the new column Not to be done in the last round

Add Round Key

The expanded key is used with the result matrix If it's last round, the result is Ciphertext

If not the last round, result is input for next round

Example

Plaintext Two One Nine Two

Plaintext in Hex Format

54 77 6F 20 4F 6E 65 20 43 69 6E 25 20 54 77 6F Encryption Key Thats my Kung Fu

Encryption Key in Hex Format

54 68 61 74 73 20 6D 79 20 4B 75 6E 67 20 46 75

(4)

Keys generated for every round

Add Round Key - Round 0

4. Applications of AES

Wireless security against hackers

Encrypted browsing sessions for better protection against hackers General file encryption

Processor security to prevent hijacking

5. Differences Between AES & DES

DES

Key Length - 56 bits Block Size - 64 bits Fixed no of rounds - 16 Comparatively slower AES

Key Length - 128/192/256 bits Block Size - 128 bits

Fixed no of rounds - dependent on key length Comparatively faster

14.2 Kripto 20: Advanced Encryption Standard (AES)

https://youtu.be/4q3bA0W7UHg?si=jJRchJK__ZhTA1YN

Latar Belakang

DES dianggap sudah tidak aman karena kunci dapat ditemukan secara brute-force.

Perlu diusulkan standard algoritma baru sebagai pengganti DES.

Persyaratan kompetisi AES

Persyaratan AES

 Termasuk ke dalam kelompok algoritma kriptografi simetri berbasis cipher blok.

 Seluruh rancangan algoritma harus public (tidak dirahasiakan, tidak ada yang disembunyikan)

 Panjang kunci fleksibel: 128, 192, dan 256 bit.

 Ukuran blok yang dienkripsi adalah 128 bit.

 Algoritma dapat dimplementasikan baik sebagai software maupun hardware.

(5)

Spesifikasi Algoritma Rijndael

Rijndael mendukung panjang kunci 128 bit sampai 256 bit dengan step 32 bit (yaitu 128 bit, 160, 192, ..., 256 bit).

Panjang kunci dan ukuran blok dapat dipilih secara independen.

Setiap blok dienkripsi dalam sejumlah putaran tertentu, sebagaimana halnya pada DES.

Karena AES menetapkan panjang kunci adalah 128, 192, dan 256, maka dikenal AES 128, AES 192, dan AES 256.

Secara de-fakto, hanya ada dua varian AES, yaitu AES 128 dan AES 256, karena akan sangat jarang pengguna menggunakan kunci yang panjangnya 192 bit.

Algoritma Rijndael

Yang dijelaskan di sini Rijndael 128-bit

Tidak seperti DES yang berorientasi bit, Rijndael beroperasi dalam orientasi byte.

Setiap putaran mengunakan kunci internal yang berbeda (disebut round key).

Enciphering melibatkan operasi substitusi dan permutasi.

Garis besar Algoritma Rijndael yang beroperasi pada blok 128-bit dengan kunci 128-bit adalah sebagai berikut (di luar proses pembangkitan round key):

 AddRoundKey: melakukan XOR antara state awal (plainteks) dengan cipher key.

Tahap ini disebut juga initial round.

 Putaran sebanyak Nr 1 kali Di AES 128 Nr 10 . Proses yang dilakukan pada setiap putaran adalah:

a. SubBytes: substitusi byte dengan menggunakan tabel substitusi S-box).

b. ShiftRows: pergeseran baris-baris array state secara wrapping.

c. MixColumns: mengacak data di masing-masing kolom array state.

d. AddRoundKey: mclakukan XOR antara state sckarang round key.

 Final round: proses untuk putaran terakhir:

a. SubBytes b. ShiftRows c. AddRoundKey

(6)

Selama kalkulasi plainteks menjadi cipherteks, status data sekarang disimpan di dalam matriks dua dimensi, state.

state bertipe byte dan berukuran Nrows x Ncols

Untuk blok data 128-bit, ukuran state adalah 4 4, seperti gambar di samping.

Transformasi SubBytes()

SubBytes() melakukan operasi substitusi dengan memetakan setiap byte dari array state dengan menggunakan S-box.

Subtitusi dilakukan untuk setiap elemen dalam matriks state.

contoh SubBytes()

Transformasi ShiftRows()

Transformasi ShiftRows() melakukan operasi permutasi dengan pergeseran secara wrapping (siklik) pada 3 baris terakhir array state.

(7)

Jumlah pergeseran bergantung pada nilai baris (r). Baris r 1 digeser sejauh 1 byte, baris r 2 sejauh 2 byte, dan baris r 3 sejauh 3 byte. Baris r 0 tidak digeser.

Digeser ke kiri.

Transformasi MixColumn()

Transformasi MixColumns() mengalikan matriks state dengan sebuah matriks tertentu sbb:

⟶ konstanta dari matrix MixColumn yaitu 01, 02, 03

Transformasi AddRoundKey()

Transformasi ini melakukan operasi XOR antara round key dan state, dan hasilnya disimpan di state.

contoh AddRoundKey()

3F XOR 4F 70 B2 XOR 5A E8

Pembentukan Kunci Putaran

Setiap putaran di dalam algoritma Rijndael menggunakan kunci putaran atau round key. Kunci putaran dibangkitkan dari kunci eksternal dari pengguna yang dinamakan cipher key dan disimbolkan dengan peubah key. Pembangkitan semua kunci putaran dilakukan oleh fungsi KeyExpansion().

Pembangkitan kunci putaran di dalam Algoritma Rijndael tergolong rumit dan agak sukar diterangkan. Tinjau sebuah larik key yang panjangnya 16 byte 16 elemen) dan Nr 10 putaran. Sepuluh kunci putaran akan disimpan di dalam larik rk. Elemen awal key langsung menjadi rk[0]. Elemen-elemen kunci lainya akan disimpan di dalam rk[1], rk[2], ..., rk[10].

ExpansionKey()

Algoritma:

 Salin elemen-elemen key ke dalam larik w[0], w[1], w[2], w[3]. Larik w[0] berisi empat elemen pertama key, w[1] berisi empat elemen berikutnya, dan seterusnya.

 Mulai dari i 4 sampai 43, lakukan:

a) Simpan w[i-1] ke dalam peubah temp b) Jika i kelipatan 4, lakukan fungsi g berikut:

Geser wi-1 satu byte ke kiri secara sirkuler

Lakukan substitusi dengan S-box terhadap hasil pergeseran tersebut

XOR-kan hasilnya dengan round constant Rcon) ke i/4 (atau Rcon|i/4 . Nilai Rcon berbeda-beda untuk setiap j = i/4, yaitu Rconi] = (RCI , 0, 0, 0 , STA11 RC 1 01, RC 2 02, RC|3 04, RC 4 08, RC|5 10, RC 6 20, RC|7 40, RC 8 80, RC|9 1B, RC 10 36 Simpan hasil fungsi g ke dalam peubah temp

c) XOR-kan w[i-4] dengan temp contoh

(8)

Sebagai contoh, misalkan key dalam hekadesimal adalah key = 54, 77, 6F, 20, 4F, 6E, 65, 20, 4E, 69, 6E, 65, 20, 54, 77, 6F Dari key langsung diperoleh rk[0] sebagai berikut:

Proses di bawah ini hanya menunjukkan pembangkitan rk[1]:

 w[0] = 54, 77, 6F, 20 ; w[1] = 4F, 6E, 65, 20 ; w[2] = 4E, 69, 6E, 65 ; w[3] = 20, 54, 77, 6F

 Mulai dari i 4 a) temp = w[3]

b) i 4 adalah kelipatan 4, maka jalankan fungsi g terhadap w[3]: Geser w[3] satu byte ke kiri secara sirkuler: w[3] = 54, 77, 6E, 20 Substitusi hasil pergeseran tersebut dengan S-box: 20, F5, 9F, B7

XOR-kan hasil di atas dengan Rcon[1] = 01, 00, 00, 00 , menghasilkan 21, F5, 9F, B7 Jadi, g(w[3]) = 21, F5, 9F, B7

c) w[4] = w[0] ⊕ g(w[3]) = w[0] ⊕ g(w[3]) = 75, 82, FO, 97 Untuk i 5, 6, 7

w[5] = w(4] ⊕ w[1] = 3A, EC, 96, B7 , w[6] = w[5] ⊕ w[2] = 74, 85, F8, D2 , w[7] = w[6] ⊕ w[3] = 54, D1, 8F, BD

Dari proses di atas diperoleh rk[1] sebagai berikut:

InvShiftRows()

InvShiftRows sama seperti ShiftRows namun melakukan pergeseran dalam arah berlawanan (ke kanan) untuk tiap-tiap baris pada tiga baris terakhir di dalam state

Referensi

Dokumen terkait

2012.Implementasi algoritma rijndael untuk enkripsi dan dekripsi pada citra digital.. Secure image data by

AES Advance Encrytion Standard AES atau bisa juga disebut Rijndael merupakan algoritma kunci simetris blok cipher yang menggunakan kunci kriptografi 128, 192 dan 256 bit untuk

Dalam transformasi ini, digunakanlah upakunci untuk masing-masing putaran yang berasal dari kunci utama dengan menggunakan jadwal kunci Rijndael yang ukuran

Pada gambar 3.4 dibawah ini adalah use case dari sistem aplikasi sharing dokumen berbasis android yang mengimplementasikan algoritma AES ( Advanced Encryption Standard )

Berdasarkan latar belakang tersebut adalah untuk membuat suatu program aplikasi kriptografi dengan algoritma Advanced Encryption Standard (AES-128 bit) dan algoritma

DRBG merupakan teknik pembangkitan Random Number yang bisa digunakan untuk proses pembangkitan random bit yang digunakan pada perhitungan kriptografi (Barker, Kelsey, 2012) Pada

 Kunci internal 56-bit dibangkitkan dari kunci eksternal  Setiap blok mengalami permutasi awal IP, 16 putaran enciphering, dan inversi permutasi awal IP-1... PEMBANGKITAN KUNCI

Pada AddRoundKey yang berikut, maka 128 bit yang sudah mengalami perubahan pada ketiga proses tersebut kembali akan di-XOR-kan dengan kunci hasil Ekspand Key kedua dan seterusnya...