RSA - Cryptography Asymmetric key cryptography จะมี key อันนึงที่ประกาศให้ชาวบ้านรู้ได้ไม่เป็นความลับเรียกว่า public key แล้วก็มี key ที่เข้าคู่กับ public key เราเก็บไว้เองเรียกว่า private key การใช้งานก็คือถ้าเราต้องการส่งข้อมูลลับไปให้ใครบางคน ก็เข้ารหัสด้วย public key ของคนนัน้ เม่ือส่งไปถึงเค้าก็จะแกะข้อมูลที่เข้ารหัสได้โดยใช้ private key ซึง่เป็นคู่ของ public key ที่เข้ารหัสมา ดังนัน้ คนอ่ืนถึงจะเอาข้อมูลไปได้แต่ไม่มี private key ที่เป็นคู่ของมันก็จะแกะไม่ได้
22
Embed
RSA - Cryptographyctc.kbu.ac.th/manatsarin/wp-content/uploads/2007/10/chapter-11-rsa.pdf · RSA - Cryptography Asymmetric key ... and m = 13, the solution c is the remainder of dividing
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
RSA - Cryptography
Asymmetric key cryptography จะม key อนนงทประกาศใหชาวบานรไดไมเปนความลบเรยกวา public key แลวกม key ทเขาคกบ public key เราเกบไวเองเรยกวา private key การใชงานกคอถาเราตองการสงขอมลลบไปใหใครบางคน กเขารหสดวย public key ของคนนน เมอสงไปถงเคากจะแกะขอมลทเขารหสไดโดยใช private key ซงเปนคของ public key ทเขารหสมา ดงนนคนอนถงจะเอาขอมลไปไดแตไมม private key ทเปนคของมนกจะแกะไมได
RSA - Cryptography
Public key cryptography จะมกญแจสองดอก คอ private key ซงจะเกบเปนความลบมเจาของคนเดยวเทานนทร และอกอนคอ public key ซงไมจำาเปนตองเกบเปนความลบ ทงสองตวจะใชงานตางกนคอ ถาใชกญแจอนนงเขารหส จะตองใชกญแจอกตวนงทเขาคกนในการถอดรหส
สมมตวาม public key A กบ private key B เปนกญแจทเขาคกน ถาเอา A เขารหส จะมแต B เทานนทถอดรหสนนออก และในทางกลบกนถาใช B เปนตวเขารหสกจะมแต A เทานนทจะถอดรหสได การทมกญแจสองแบบทำาให public key cryptography ไดเปรยบ secret key cryptography(Symmetric Cryptography) ตรงทผรบกบผสงใชกญแจคนละตวกน ไมจำาเปนตองรความลบของกนและกน กสามารถสงขอมลหากนไดอยางปลอดภย
แนวคดเรอง public key คนแรกทคดเรองนคอ วธฟลด ดฟฟ (Whitfield Diffie) และ มารตน เฮลแมน (Martin Hellman) ซงเสนอวธการแบบ public key นใน National Computer Conference ป 1976 และตพมพใน IEEE Transaction on Information Theory
The calculation a = b^e mod n is known as modular exponentiation
Doing a "modular exponentiation" means calculating the remainder when dividing by a positive integer m (called the modulus) a positive integer b (called the base) raised to the e-th power (e is called the exponent). In other words, problems take the form where given base b, exponent e, and modulus m, one wishes to calculate c such that:
c b^e mod(m)≡
For example, given b = 5, e = 3, and m = 13, the solution c is the remainder of dividing 5^3 by 13, namely the rest of the division 125 / 13, which works out to be 8.
c = 5^3 mod(13)= 125 mod(13)= 8
If b, e, and m are non-negative and b < m, then a unique solution c exists and has the property 0 c < m.≤
Modular exponentiation
RSA - Cryptography
1. Generate two large random primes, p and q, of approximately equal size such that their product n = pq is of the required bit length, e.g. 1024 bits.
2. Compute n = pq and ( ) phi = (p-1)(q-1)φ
3. Choose an integer e, 1 < e < phi, such that gcd(e, phi) = 1
4. Compute the secret exponent d, 1 < d < phi, such thated 1 (mod phi) ≡ หรอd e^-1 (mod phi)≡
5. The public key is (n, e) and the private key is (n, d)
The values of p, q, and phi should also be kept secret.
n is known as the modulus.
e is known as the public exponent or encryption exponent.
d is known as the secret exponent or decryption exponent.
อยางเชน ใน secret key cryptography จะตองมการแลก secret key กนเพอใหผรบสามารถถอดรหสได หลายๆ โปรแกรมกใช Diffie-Hellman ในการแลก secret key เพราะจาก algorithm ของ Diffie-Hellman คา k และ k' มคาเทากนและ secret key cryptography ใชเลขสมได ดงนนคา k/k' จะเปนเทาไหรกใชเปน key ไดเสมอ สวนการทำา Encryption โดยวธของ public key กจะทำางานตามนครบ สมมตให A เปนผสงและ B เปนผรบ .. A จะเอา public key ของ B มาเขารหสแลวจงสงไปให B ..ขอมลทสงไปจะมกเพยง B เทานนทจะถอดรหสนนออกเพราะม private key ทเขาคกบ public key ทเปนตวเขารหสสงมา
RSA - Cryptography
Public key cryptography สามารถนำามาประยกตใชเปน digital signature ไดดวย .. ลายเซนดจตอลนเอาไวใชในกรณทเราตองการตรวจสอบตวตนทแทจรง (Identity verification) สมมต A กบ B
A จะเขารหสดวย private key ของตวเอง ขนตอนนเรยกกนวา digital signing ขอมลทผาน digital signing แลวกจะสงไปให B
B สามารถตรวจสอบวาขอมลมาจาก A ตวจรงไดโดยการใช public key ของ A เปนตวถอดรหส ถาสามารถถอดไดกมนใจไดวาขอมลนนมาจาก A จรงๆ เพราะมแต public key ของ A เทานนทถอดรหสขอมลท sign โดย private key ของ A
1. Prime number generator การหาเลขจำานวนเฉพาะทมคามากๆ ตองใชวธการทยงยาก และเสยเวลามาก มากจนหลายแอพพลเคชน ไมหาจำานวนเฉพาะโดยตรงแตใชการสมตวเลขแลวทดสอบวา เปนเลขจำานวนเฉพาะหรอไมแทน
ถอดดวย c 1019 mod 3337 สมมตให m เปนตวอกษรรหส ASCII เอาซก 5 คำานกคำานวณกนมอหงกแลวครบ
RSA - Cryptography
3. Secret key cryptography จะใช operation ทซบซอนนอยกวาเยอะ อยางพวก xor, shift จงทำางานไดเรวกวา นอกจากนกญแจกสามารถใช random number ได หรอบาง algorithm อาจจะตองใช secure random number แตกยงไมตองคำานวณเยอะและมเงอนไขมากเหมอน public key cryptography