Mikrodenetleyici Tabanlı RSA ile Şifrelenmiş RF Haberleşmeli Kartlı Giriş Sistemi

Yüksek lisans kriptografi dersi için hazırladığım projeyi yayınlıyorum. Ders İngilizce olduğu için raporu da İngilizce yazmıştım. Proje ile ilgili tüm sorularınızı yorum kısmından gönderebilirsiniz. İlerleyen zamanlarda Türkçe’ye çevirebilirim.

Projeye Türkçe bir özet yapmak gerekirse; RSA şifreleme, RF haberleşme, Arduino, RFID teknolojileri / yöntemlerini kullanarak basit bir kartlı geçiş sistemi diyebiliriz.

MCH553 – Computer Systems and Network Security
MCU Based RSA Encrypted Card Entrance System via RFID Cards and RF
Communication Project Report

Mustafa Alper BALIM
Bursa Technical University

Background

RSA is a useful cryptology method for using projects that use 8 and 16 bit MCU’s. In this project; there are two MCU based control unit. First unit reads the RFID card, and second unit allows or rejects entries by controlling the door.

Communication will be made by RF communication modules as encrypted via RSA. First unit will send RFID card ID by encrypting it. Second unit will decrypt received data and will decide to allow or reject entrance. Then second unit will encrypt the answer of entrance request to first unit. First unit will decrypt the answer and will allow/reject the user.

Hardware

The system consist of two MCU’s , an MIFARE RFID Card Reader and two RF communication modules. Each RF modules has two part that recieve and transmit data. Two Arduino Nano based Atmega328 is used as MCU’s and proggrammed via Proccesinglike Arduino language.

System Block Scheme

MCU’s and RF Modules communicates with each other via software serail communication. RFID reader communicates via SPI(Serial Peripheral Interface).

Software

Central MCU Flow Chart

Terminal MCU Flow Chart

Encyrption and Decryption Algorithms & Colde Blocks

Encyrption or Decryption codes starts with define “p” and “q” prime numbers and “w” that determining which “e” and “d” will be used for encryption and decryption.

Defination of Cryptographic Parameters Block:

1. Choose two distinct prime numbers p and q.
2. Compute n = pq
3. Compute t(n) = t(p)t(q) = (p − 1)(q − 1)
4. Choose an integer e such that 1 < e < t(n) and GCD(e, t(n)) = 1
5. Determine d as ed = 1 (mod t(n))

Find “e” and “d” Block.

“e” must be 1<e<t and GCD(e,t)=1

“d*e” must be equal “1” in mod(t)

Encyrption Block:

Encyrption block computes the ciphertext “c” for plaintext “p” using the public key “e” for every character.

? = ?^? (??? ?)

“encyrpt(char)” function returns two character because ciphertext “c” that computed is too large for standart ANSII “char” variable and values that will be sent by RF module must be “char” variable type. First 8 bit of “c” is kept in cipherText[ctr] and last 8 bit is kept in cipherText[ctr+1]. “cipherText[]” array is doubled. If “p” and “q” is choosen too large, “c” will be larger than 2 “character” (bytes) and, cipherText has to be divided into 3 or more. Because of we have limited memory and limited computing capacity, “p” and “q” has to be chosen smaller then 100.

Decyrption Block:

Decyrption block computes the plaintext “p” for ciphertext “c”using the private key “d” for every character.

? = ?^? (??? ?)

“decyrpt(char)” function gets two character that computed by ”encyrpt()” function and returns one character that belongs to plaintext. Before the computing char array will be reassembled to ”long” variable type by combining two characters cipherText[ctr] and cipherText[ctr+1]. After computing, computed “M” is smaller then “c” (one byte). But it is still stored as two (or more) bytes. ). “M & 0xFF” operatormasks first 8 bit of “M”. And thats equals “plainText[i]”, “i”th character of plaintext.

Every step of application is printed to Arduino IDE Serial Monitor for observing with serial communication by USB ports.

Central MCU Source Code

Terminal MCU Source Code

 

Bir Cevap Yazın