UNIVERSITY OF BIELSKO- BIALA AKADEMIA TECHNICZNO-HUMANISTYCZNA Faculty of Mechanical Engineering...

Post on 21-Jan-2016

218 views 0 download

Transcript of UNIVERSITY OF BIELSKO- BIALA AKADEMIA TECHNICZNO-HUMANISTYCZNA Faculty of Mechanical Engineering...

UNIVERSITY OF BIELSKO-UNIVERSITY OF BIELSKO-BIALABIALA

www.ath.bielsko.plwww.ath.bielsko.pl

AKADEMIA TECHNICZNO-HUMANISTYCZNA

Faculty of Mechanical Engineering

and Computer Science

Safety in Information Safety in Information TechnologyTechnology

((Prof. dr hab. inż. Mikołaj Karpiński)Prof. dr hab. inż. Mikołaj Karpiński)

www.ath.bielsko.plwww.ath.bielsko.pl

Editor: Georg Schön, 10.11.2011

Asymmetric Cryptography –

RSA (Rivest, Shamir, Adleman)

Subject:

SafetSafetyyininITIT

10.11.201110.11.2011 33

Why asymmetric Why asymmetric cryptography?cryptography?

Problems with symmetric cryptography:Problems with symmetric cryptography:(Managment and distribution of keys)(Managment and distribution of keys)– Sender and recipient need to exchange secret Sender and recipient need to exchange secret

key.key.– n participants require n participants require nn((n −n −1)1)//2 keys 2 keys

(6* 10^8 user in 2002 means approx. 1,8*10^17 keys)(6* 10^8 user in 2002 means approx. 1,8*10^17 keys)

– Central distributor indicates high effort and is insecure Central distributor indicates high effort and is insecure with resprect to trustworthyness (knows everything)with resprect to trustworthyness (knows everything)

Georg SchönGeorg Schön(University of Erlangen - (University of Erlangen -

Nürnberg)Nürnberg)

Public-key procedure!! ( only decription key or private key needs to be secure) >> to find the private key out of the public key is impossible (state of the art – but quantum computers?).

SafetSafetyyininITIT

10.11.201110.11.2011 44

Asymmetric Asymmetric communicationcommunication

Georg SchönGeorg Schön(University of Erlangen - (University of Erlangen -

Nürnberg)Nürnberg)

Alice Bob

!Public keys are accessible for everyone!

EMessage transfer

Decripts with his private key

UU

E

Encrypts with Bob´s public key

SafetSafetyyininITIT

10.11.201110.11.2011 55

Public key indexPublic key index

Georg SchönGeorg Schön(University of Erlangen - (University of Erlangen -

Nürnberg)Nürnberg)

Alice Bob

Name Public keyBob 13121311235912753192375134123Paul 84228349645098236102631135768Alice 54628291982624638121025032510

No secure keys for the exchange necessary! But: How to make sure the public key is not replaced by a third person?>> (Public key indexes use digital signatures!)

SafetSafetyyininITIT

10.11.201110.11.2011 66

RSA cipherRSA cipher

Invented by Ron Invented by Ron RRivest, Adi ivest, Adi SShamir and Len hamir and Len AAdlemandleman– Ist security makes use of the Ist security makes use of the

difficulty to decompound large difficulty to decompound large numbers in prime factors!numbers in prime factors!

Georg SchönGeorg Schön(University of Erlangen - (University of Erlangen -

Nürnberg)Nürnberg)

A prime number (or a prime) is a A prime number (or a prime) is a natural number greater than 1 that natural number greater than 1 that has no positive divisors other than 1 has no positive divisors other than 1 and itself.and itself.((2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37…)

SafetSafetyyininITIT

10.11.201110.11.2011 77

Prime multiplicationPrime multiplication

Georg SchönGeorg Schön(University of Erlangen - (University of Erlangen -

Nürnberg)Nürnberg)

1230186684530117755130494958384962720772853569595334792197322452151726400507263657518745202199786469389956474942774063845925192557326303453731548268507917026122142913461670429214311602221240479274737794080665351419597459856902143413

33478071698956898786044169848212690817704794983713768568912431388982883793878002287614711652531743087737814467999489 36746043666799590428244633799627952632279158164343087642676032283815739666511279233373417143396810270092798736308917 ∗ = ∗ =

Decimal length: 232Bit length: 768

Current PCs can quickly factor numbers with about “80 digits”. Therefore, practical RSA implementations must use moduli with at least “300 digits”

to achieve sufficient security!

SafetSafetyyininITIT

10.11.201110.11.2011 88

Mathematic Mathematic backgroundbackground

1. The modulo operator1. The modulo operator

2. Euler´s totient function2. Euler´s totient function 3. Euler-Fermat theorem3. Euler-Fermat theorem

Georg SchönGeorg Schön(University of Erlangen - (University of Erlangen -

Nürnberg)Nürnberg)

5mod318DivisorRest

SafetSafetyyininITIT

10.11.201110.11.2011 99

Euler’s totient function φφ of an integer returns how many positive integers a are coprime and smaller than N.

Euler´s totient Euler´s totient functionfunction

Georg SchönGeorg Schön(University of Erlangen - (University of Erlangen -

Nürnberg)Nürnberg)

Phi of N is the quantity of positive integers a where: Phi of N is the quantity of positive integers a where: 𝜑ሺ𝑁ሻ= #ሼ𝑎 𝜖 ℕ ȁ� 𝑔𝑐𝑑ሺ𝑎,𝑁ሻ= 1 𝑎𝑛𝑑 1 ≤ 𝑎 < 𝑁} 𝜑ሺ10ሻ= 𝜑ሺ5ሻ∗𝜑ሺ2ሻ= 4∗1 = 4

𝜑ሺ5ሻ= #{1,2,3,4} = 4

𝜑ሺ10ሻ= #{1,3,7,9} = 4 𝜑ሺ2ሻ= #{1} = 1

SafetSafetyyininITIT

10.11.201110.11.2011 1010

Euler-Fermat theoremEuler-Fermat theorem

Is a cyclic function (results repeat Is a cyclic function (results repeat themselves)themselves)

Example: N = 10Example: N = 10

a = 3a = 3 >>>>>>>>>>

a = 7a = 7 >>>>>>>>>>

No further explanation.No further explanation.Georg SchönGeorg Schön

(University of Erlangen - (University of Erlangen - Nürnberg)Nürnberg)

SafetSafetyyininITIT

10.11.201110.11.2011 1111

Key generationKey generation

Georg SchönGeorg Schön(University of Erlangen - (University of Erlangen -

Nürnberg)Nürnberg)

1. Choose two primes and with

2. Calculate their product:

3. Calculate the value of Euler’s totient function of

>>>>> 3 and 7>>>>> 21 = 3*7

>>>>> 12 = (3-1)*(7-1)

Determine D and E: D*E 1 mod 12(eg. Compound number 1, 13, 25, 37, 49, 61, 73, 85, ...)

85 = 5 * 17 (D=5, E=17) (N,E – private key; N,D – public key) For defining D, E also see:

extended Euclidean algorithm!

SafetSafetyyininITIT

10.11.201110.11.2011 1212

Encryption/DecryptionEncryption/Decryption

The message that is to be send, shall be The message that is to be send, shall be 99 The user with key The user with key EE (as encrypt) reckons: (as encrypt) reckons:

99EE=9=955=59049 18 mod 21=59049 18 mod 21

Sender transmits encrypted message (18) to the Sender transmits encrypted message (18) to the receiver, who uses his private key receiver, who uses his private key DD to decrypt to decrypt the message and reckons:the message and reckons:

1818DD=18=181717=2185911559738696531968 9 mod =2185911559738696531968 9 mod 2121

(origin message)(origin message)Georg SchönGeorg Schön

(University of Erlangen - (University of Erlangen - Nürnberg)Nürnberg)

Safety in Information Safety in Information TechnologyTechnology

((Prof. dr hab. inż. Mikołaj Karpiński)Prof. dr hab. inż. Mikołaj Karpiński)

www.ath.bielsko.plwww.ath.bielsko.pl