م روري بر الگوريتمهاي رمز متقارن(كليد پنهان)

Preview:

DESCRIPTION

م روري بر الگوريتمهاي رمز متقارن(كليد پنهان). علی فانیان a.fanian@cc.iut.ac.ir. فهرست مطالب. م عماري لايه اي امنيت اصول الگوريتمهاي رمزنگاري انواع الگوريتمهاي رمز متقارن(كليد پنهان) الگوريتمهاي رمزنگاري قالبي نحوه هاي بکارگيري رمزهاي قطعه اي. فهرست مطالب. م عماري لايه اي امنيت - PowerPoint PPT Presentation

Citation preview

الگوريتمهاي رمز روري برممتقارن)كليد پنهان(

علی فانیانa.fanian@cc.iut.ac.ir

فهرست مطالب

امنيت عماري اليه اي م•

اصول الگوريتمهاي رمزنگاري•

انواع الگوريتمهاي رمز متقارن)كليد •

پنهان(

الگوريتمهاي رمزنگاري قالبي•

نحوه هاي بکارگيري رمزهاي قطعه •

اي

فهرست مطالب

امنيتعماري اليه اي م•

اصول الگوريتمهاي رمزنگاري•

انواع الگوريتمهاي رمز متقارن)كليد •

پنهان(

الگوريتمهاي رمزنگاري قالبي•

نحوه هاي بکارگيري رمزهاي قطعه •

اي

كاربرد امنيتيكاربرد امنيتي

پروتكل امنيتي

پروتكل امنيتي

الگوريتم ها

الگوريتم ها

امنيتعماري اليه اي م

فهرست مطالب

امنيت عماري اليه اي م•

اصول الگوريتمهاي رمزنگاري•

انواع الگوريتمهاي رمز متقارن)كليد •

پنهان(

الگوريتمهاي رمزنگاري قالبي•

نحوه هاي بکارگيري رمزهاي قطعه •

اي

Terminology

plaintext, cleartext: an “unhidden message”

encrypt: transform a message to hide its meaning

ciphertext: encrypted message

cipher: cryptographic algorithm

decrypt: recover meaning from encrypted message

cryptography: art/science of keeping message secure

cryptanalysis: art/science of breaking ciphertext

cryptology: study of both cryptography and cryptanalysis

Encryption and Decryption

Decryption Method

plaintext, cleartext ciphertext

Encryption Method

ciphertext plaintext, cleartext

Common Mathematical Symbols

P plaintext (here is a binary value)

C ciphertext (also binary)

E encryption function

D decryption function

E(P) = C encrypting plaintext yields ciphertext

D(C) = P decrypting ciphertext yields plaintext

D(E(P)) = P decrypting encrypted plaintext yields plaintext

Restricted Algorithm

The security of a restricted algorithm requires keeping the algorithm secret!

SECRET

Simple Restricted Algorithm

Encryption algorithmMultiply the plaintext by 2

Decryption algorithmDivide the ciphertext by 2

plaintext = SECRET = 19 5 3 18 5 20Ciphertext = 38 10 6 35 10 40

Key-Based Algorithm

The security of key-based algorithms is based on the secrecy of the algorithm, the key(s), or both

Simple Key-Based Algorithm

Encryption algorithmMultiply the plaintext by 2 and add key

Decryption algorithmSubtract the key and divide the ciphertext by 2

plaintext = SECRET = 19 5 3 18 5 20

Key = 3

Ciphertext = 41 13 9 39 13 43

Secret (Symmetric) Key Algorithms

Decryption key = encryption key

Key agreed in advance between parties

Key kept secret

Like a locked roomNeed the key to lock up document

Need the key to unlock room and get document

Public (Asymmetric) Key Algorithms

Encryption and decryption keys are different

Encryption key is public (usually)

Decryption key is private

One key locks, the other unlocks

Exchanging Messages with Symmetric Cryptography

Bob

key

plaintext

Alice

plaintext

key

CS CS

Agree on cryptosystem

Agree on key

cipher text

Symmetric Key Algorithms

Crypto-Attacks

Adversary goal to break cryptosystem Assume adversary knows algorithm, but not key two general approaches to attacking a

conventional encryption scheme Cryptanalysis : rely on the nature of the

algorithm plus perhaps some knowledge of the general characteristics of the plaintext or even some sample plaintext–ciphertext pairs

Brute-force attack : The attacker tries every possible key on a piece of ciphertext until an intelligible translation into plaintext is obtained

Crypto-Attacks

3 types of attacks:• ciphertext only:

adversary has ciphertext; goal to find plaintext and key

• known plaintext: adversary has ciphertext, corresponding plaintext; goal to find key

• Chosen Text• Plaintext message chosen by cryptanalyst, together with its

corresponding ciphertext generated with the secret key

• Ciphertext chosen by cryptanalyst, together with its corresponding decrypted plaintext generated with the secret key

Crypto-Attacks

Two definitions are worthy of note. unconditionally secure

no matter how much ciphertext is available no matter how much time an opponent has it is impossible for opponent to decrypt the

ciphertext there is no encryption algorithm that is

unconditionally secure exception of a scheme known as the one-time pad

computationally secure The cost of breaking the cipher exceeds the

value of the encrypted information. The time required to break the cipher exceeds

the useful lifetime of the information.

Crypto-Attacks

فهرست مطالب

امنيت عماري اليه اي م•

اصول الگوريتمهاي رمزنگاري•

انواع الگوريتمهاي رمز متقارن)كليد •

پنهان(

الگوريتمهاي رمزنگاري قالبي•

نحوه هاي بکارگيري رمزهاي قطعه •

اي

بر الگوريتمهاي رمز متقارن:دو دسته اند

(Block Cipher)رمزهاي قالبي يا قطعه اي •

قطعه به قطعهپردازش پيغام ها بصورت –

256 يا 128، 64قطعات متعارف اندازه –

بيت

Stream)رمزهاي پي در پي يا دنباله اي •

Cipher)

پيوسته )بدون پردازش پيغام ها بصورت–

تقطيع(

انواع الگوريتمهاي رمز متقارن

رمز قطعه اي

K

متن واضح )تقسيم شده به قطعات(

قطعات خروجي

K K K K K K

Ci Pi+

مولد دنبالهشبه تصادفي مولد دنباله

شبه تصادفيK

رمز دنباله اي

)ب)

مولد دنبالهشبه تصادفي مولد دنباله

شبه تصادفي

Pi Ci

K

+

)الف

)

(One-Time Padتابع رمزنگاري کامل)

کليدي به nايده : براي رمزکردن يک داده به طول •

هزينه کنيم. nطول

يعني داشتن هر تعداد متن نمونه رمزشده کمکي •

به تحليلگر نمي کند.

امنيت اين روش به تصادفي بودن کليد بستگي •

دارد.

در صورت تصادفي بودن کليد امنيت الگوريتم –

غير قابل شكست است.

Pi Ci+

Ki

-Physical processes

-LSFR ( Linear Feedback Shift Register )

-BBS( Blum-Blum-Shub)

رمز دنباله اي

:چند الگوريتم نمونه

Linear Feedback Shift Register

Linear shift feedback register with 4 bit register

فهرست مطالب

امنيت عماري اليه اي م•

اصول الگوريتمهاي رمزنگاري•

انواع الگوريتمهاي رمز متقارن)كليد •

پنهان(

الگوريتمهاي رمزنگاري قالبي•

نحوه هاي بکارگيري رمزهاي قطعه •

اي

رمزهاي قطعه اي اصول

قطعات به قطعات متن واضح نگاشت •

رمزشده بايد برگشت پذير )يك به متن

.باشد يك(

قطعات ورودي را در چند الگوريتم •

مرحله ساده و متوالي پردازش ميکند.

ميگوييم. دوربه اين مراحل

• Yل اعم امبتني بر تركيبهر دور عموما

و جايگزينيهمچون اييساده

.استوار استجايگشت

Substitutionجانشيني •جایگیزینی یک سمبل با سمبل دیگر• ممکن است هم طول نباشند•

Permutationجابگشت •

ترتيب قرار گرفتن حروف در متن اصلي جابجا •مي شود

دو بلوک پايه براي عمليات رمز گذاري

استانداردهاي رمزهاي قطعه : اي آمريکا

رمزهاي قطعه اي استاندارد•DES استاندارد رمزگذاري داده –AESاستاندارد رمزگذاري پيشرفته –

تحت نظارت• National Institute of Science and Technology (NIST)

DES استاندارد رمزگذاري داده

مرور• توليد شد IBM توسط 1974در سال –

NSA (Nationalپس از انجام تغييراتي توسط •Security Agency) ، 1976در سالNIST آن را

پذيرفت.و نينشياساس الگوريتم تركيبي از عمليات جا–

مي باشد.جايگشتي مشخصات:–

بيت56 طول كليد• بيت64هاي ورودي و خروجي : قالبطول • دور16 تعداد دورها: •

الگوريتمهاي رمزگذاري و رمزگشايي عمومي –هستند, ولي مباني رياضي و اصول طراحي

آنها فاش نشد.در گذشته بسيار پر استفاده بود و هنوز هم از –

رده خارج نشده است.

DES استاندارد رمزگذاري داده

Initial and final permutation steps in DES

DES uses 16 rounds.

A round in DES (encryption site)

The heart of DES is the DES function. The DES function applies a 48-bit key to the rightmost 32 bits to produce a 32-bit output.

DES Function

DES function

Expansion P-box

Since RI−1 is a 32-bit input and KI is a 48-bit key, we first

need to expand RI−1 to 48 bits.

Expansion permutation

S-Boxes

The S-boxes do the real mixing (confusion). DES uses 8

S-boxes, each with a 6-bit input and a 4-bit output.

S-boxes

S-box rule

DES cipher and reverse cipher for the first approach

DESبايد از رده خارج شود

اين الگوريتم توسط 1999در ژانويه •

حمله جستجوي جامع فضاي کليد در

! ساعت شکسته شد23

کامپيوتر بر روي اينترنت 1000 بيش از –

هر يک بخش کوچکي از کار جستجو را

انجام دادند.

به الگوريتمهاي امن تر با طول کليد •

باالتر نياز داريم.

•DES.طراحي شفاف و روشن ندارد

2DES and 3DES

مسئله : • در مقابل حمله آزمون DESآسيب پذيري –

جستجوي كامل

راه حل :•استفاده از الگوريتم هاي رمزنگاري ديگر–

از طريق اضافه DESپيچيده كردن الگوريتم –كردن مراحل رمزنگاري و افزايش طول كليد

2DESA pair of semi-weak keys in encryption and decryption

Meet-in-the-Middle AttackHowever, using a known-plaintext attack called meet-in-the-middle attack proves that double DES improves this vulnerability slightly (to 257 tests), but not tremendously (to 2112).

6.45

Continued

Tables for meet-in-the-middle attack

3DES

3DESاستفاده از الگوريتم •

از دو مرحله رمزنگاري و يك مرحله –رمزگشايي با سه كليد مجزا استفاده مي

شود

بيت گسترش مي يابد168فضاي كليد به –

با 3DESدر صورت استفاده از يك كليد يكسان،–DESمطابقت مي كند

و Blowfishنسبت به الگوريتمهاي ديگر مانند –RC5سرعت كمتري دارد

تا كنون حمله اي عليه آن گزارش نشده است–

Triple DES with two keys

استاندارد رمزگذاري پيشرفته AES

•NIST مسابقه اي دو مرحله اي 1997 در سال براي طراحي استاندارد جديد برگزار کرد.

– Yتمام طراحي ها بايد بر اساس اصول کامًالروشن انجام شوند.

( به عنوان Rijndael رايندال)2000در سال •برنده اعًالم شد

AESاستاندارد رمزگذاري پيشرفته –

AESفيناليست هاي مسابقه

• MARS

• RC6

• Rijndael

• Serpent

• Twofish

مقاله زير اطًالعات بيشتر درباره مقايسه •فيناليست ها ارائه مي دهد:

A Performance Comparison of the Five AES Finalists B. Schneier and D. Whiting

!منتخب

فهرست مطالب

امنيت عماري اليه اي م•

اصول الگوريتمهاي رمزنگاري•

انواع الگوريتمهاي رمز متقارن)كليد •

پنهان(

الگوريتمهاي رمزنگاري قالبي•

نحوه هاي بکارگيري رمزهاي قطعه •

اي

نحوه هاي بکارگيري رمزهاي قطعه اي

• ECB: Electronic Code Book

• CBC: Cipher Block Chaining

• CFB: Cipher Feed Back

• OFB: Output Feed Back

• CTR: CounTeR mode

ECBنحوه بكارگيري

رمز نگاري:•EE

P1

C1

K EE

P2

C2

K EE

PN

CN

K

DD

C1

P1

K DD

C2

P2

K DD

CN

PN

K

رمز گشايي:•

اشکال اساسي: هر متن واضح به ازاء کليد •ثابت هميشه به يک متن رمز شده نگاشته

ميشود. دشمن ميتواند دريابد که پيامهاي يکسان ارسال –

شده اند.

CBCنحوه بكارگيري

EE

P1

C1

K

+

EE

P2

C2

K

+

EE

P3

C3

K

+

EE

PN

CN-1

K

+IV CN-1

DD

C1

P1

K

+

DD

C2

P2

K

+

DD

C3

P3

K

+

DD

CN

PN

K

+CN-1

رمز نگاري:•

رمز گشايي:•

IV

اين مد از يك مقدار دهي اوليه •بهره مي گيرد( IV)تصادفي

در هر بار رمزگذاري به IVمقدار •صورت تصادفي تغيير مي كند

نيز رمز شده ارسال IVبهتر است •گردد

هر متن آشكار به ازاء كليد ثابت هر •بار به يك متن رمز شده متفاوت نگاشته

مي شود 

CBCمد کاري

ملزومات امنيتي: •–IV غير قابل پيش بيني و غير قابل Yبايد کامًال

دستكاري باشدرمزنگاري:•

.نيستعمليات رمزنگاري قابل موازي سازي – و متن واضح بايد در دسترس باشند.IVمقدار –

رمزگشايي:•عمليات رمزگشايي قابل موازي سازي است.– و متن رمزشده بايد در دسترس باشند.IVمقدار –

طول پيام:•در برخي موارد ممکن است وادار به افزايش طول –

پيام بشويم.طول پيام بايد مضربي از طول قطعه باشد.•

پياده سازي:•رمز گشايي و رمز نگاري، هر دو بايد پياده سازي –

شوند.

CBCنحوه بكارگيري

CFBنحوه بكارگيري

رمز نگاري• رمزگشايي•

EE

Pi Ci

K

+

shift register (n)

(n)

select s bitsselect s bits

(n)

(s)

(s) (s)

(s)

initialized with IV

EE

Ci Pi

K

+

shift register (n)

(n)

select s bitsselect s bits

(n)

(s)

(s) (s)

(s)

initialized with IV

OFBنحوه بكارگيري

رمز نگاري• رمزگشايي•

EE

Pi Ci

K

+

shift register (n)

(n)

select s bitsselect s bits

(n)

(s)

(s) (s)

(s)

initialized with IV

EE

Ci Pi

K

+

shift register (n)

(n)

select s bitsselect s bits

(n)

(s)

(s) (s)

(s)

initialized with IV

OFB و CFBموارد استفاده •

رمز جرياني–

کاربردهاي بًالدرنگ–

: انتشار خطاي انتقالCFBعيب •

–OFBاين عيب را برطرف مي کند

OFB و CFBمقايسه

CTRنحوه بكارگيري

رمز نگاري• رمزگشايي•

EE

Pi Ci

K

+

(n)

(n)

(n)

counter + i

(n)

EE

Ci Pi

K

+

(n)

(n)

(n)

counter + i

(n)

مقايسه کاربرد انواع مدهاي کاري

لغت نامه

Meet-in-the-Middle attack

در مًالقات حملهميانه

Round دور

Symmetric Encryption Scheme

متقارن رمزنگاري

Stream Cipherپي رمزهاي

اي درپي( )دنباله

Block Cipher رمزهاي

اي قالبي( (قطعه

Symmetric Cipher متقارن رمزهاي

Key Schedule کليد بندي زمان

plaintext واضح متن

Confidentiality محرمانگي

parallelization سازي موازي

MAC: Message authentication code

احراز پيام اصالکد ت

Authentication اصالت احراز

Brute Force كامل جستجوي

AESاستاندارد

پيشرفته رمزگذاري

DESاستاندارد

داده رمزگذاري

Padding پيام طول افزايش

Provable Security اثبات قابل امنيت

Differential cryptanalysis

تفاضلي تحليل

linear cryptanalysis خطي تحليل

Substitution ينينشجا

Permutation جايگشت

NSA: National Security Agency

Timing Attack زماني حمله

Recommended