+ All Categories
Home > Documents > Chapter 4: Public Key · 2019. 2. 28. · Public Key Methods • Integer Factorization.Using prime...

Chapter 4: Public Key · 2019. 2. 28. · Public Key Methods • Integer Factorization.Using prime...

Date post: 04-Sep-2020
Category:
Upload: others
View: 0 times
Download: 0 times
Share this document with a friend
28
Chapter 4: Public Key Basics RSA (Factorizing Primes) Elliptic Curve (Elliptic Curves) ElGamal (Discrete Logs) Prof Bill Buchanan OBE http://asecuritysite.com/crypto04 http://asecuritysite.com/encryption
Transcript
Page 1: Chapter 4: Public Key · 2019. 2. 28. · Public Key Methods • Integer Factorization.Using prime numbers. Example: RSA. Digital Certs/SSL. • Discrete Logarithms.Y = Gx mod P.

Chapter4:PublicKey Basics RSA(FactorizingPrimes) EllipticCurve(EllipticCurves)ElGamal(DiscreteLogs) ProfBillBuchananOBE http://asecuritysite.com/crypto04http://asecuritysite.com/encryption

Page 2: Chapter 4: Public Key · 2019. 2. 28. · Public Key Methods • Integer Factorization.Using prime numbers. Example: RSA. Digital Certs/SSL. • Discrete Logarithms.Y = Gx mod P.

PublicKeyMethods

Page 3: Chapter 4: Public Key · 2019. 2. 28. · Public Key Methods • Integer Factorization.Using prime numbers. Example: RSA. Digital Certs/SSL. • Discrete Logarithms.Y = Gx mod P.

PublicKeyMethods

• IntegerFactorization.Usingprimenumbers.Example:RSA.DigitalCerts/SSL.

• DiscreteLogarithms.Y=GxmodP.Example:ElGamal.

• EllipticCurveRelationships.Example:EllipticCurve.SmartCards,IoT,Tor,Bitcoin.

Page 4: Chapter 4: Public Key · 2019. 2. 28. · Public Key Methods • Integer Factorization.Using prime numbers. Example: RSA. Digital Certs/SSL. • Discrete Logarithms.Y = Gx mod P.

PublicKeyMethods

• IntegerFactorization.Usingprimenumbers.Example:RSA.DigitalCerts/SSL.

• DiscreteLogarithms.Y=GxmodP.Example:ElGamal.

• EllipticCurveRelationships.Example:EllipticCurve.SmartCards,IoT,Tor,Bitcoin.

Page 5: Chapter 4: Public Key · 2019. 2. 28. · Public Key Methods • Integer Factorization.Using prime numbers. Example: RSA. Digital Certs/SSL. • Discrete Logarithms.Y = Gx mod P.

PublicKeyMethods

• IntegerFactorization.Usingprimenumbers.Example:RSA.DigitalCerts/SSL.

• DiscreteLogarithms.Y=GxmodP.Example:ElGamal.

• EllipticCurveRelationships.Example:EllipticCurve.SmartCards,IoT,Tor,Bitcoin.

Page 6: Chapter 4: Public Key · 2019. 2. 28. · Public Key Methods • Integer Factorization.Using prime numbers. Example: RSA. Digital Certs/SSL. • Discrete Logarithms.Y = Gx mod P.

Chapter4:PublicKey RSAProfBillBuchananOBE http://asecuritysite.com/crypto04http://asecuritysite.com/encryption

Page 7: Chapter 4: Public Key · 2019. 2. 28. · Public Key Methods • Integer Factorization.Using prime numbers. Example: RSA. Digital Certs/SSL. • Discrete Logarithms.Y = Gx mod P.
Page 8: Chapter 4: Public Key · 2019. 2. 28. · Public Key Methods • Integer Factorization.Using prime numbers. Example: RSA. Digital Certs/SSL. • Discrete Logarithms.Y = Gx mod P.
Page 9: Chapter 4: Public Key · 2019. 2. 28. · Public Key Methods • Integer Factorization.Using prime numbers. Example: RSA. Digital Certs/SSL. • Discrete Logarithms.Y = Gx mod P.

RSA

• Twoprimesp,q.• CalculateN(modulus)aspxqeg3

and11.n=33.• CalculatePHIas(p-1)x(q-1).PHI=20• Selectefornocommonfactorwith

PHI.e=3.• Encryptionkey[e,n]or[3,33].• (dxe)mod20=1• (dx3)mod20=1• d=7• Decryptionkey[d,n]or[7,33]

Page 10: Chapter 4: Public Key · 2019. 2. 28. · Public Key Methods • Integer Factorization.Using prime numbers. Example: RSA. Digital Certs/SSL. • Discrete Logarithms.Y = Gx mod P.

RSA• Encryptionkey[e,n]or[3,33].• Decryptionkey[d,n]or[7,33]• Cipher=MemodNegM=5.• Cipher=53mod33=26• Decipher=CdmodN• Decipher=(26)7mod33=5

Example

Calc

Page 11: Chapter 4: Public Key · 2019. 2. 28. · Public Key Methods • Integer Factorization.Using prime numbers. Example: RSA. Digital Certs/SSL. • Discrete Logarithms.Y = Gx mod P.

Chapter4:PublicKey EllipticCurveProfBillBuchananOBE http://asecuritysite.com/crypto04http://asecuritysite.com/encryption

Page 12: Chapter 4: Public Key · 2019. 2. 28. · Public Key Methods • Integer Factorization.Using prime numbers. Example: RSA. Digital Certs/SSL. • Discrete Logarithms.Y = Gx mod P.

EllipticCurve(EC)• Pickapointontheellipticcurve(G).• Generatearandomnumber(n)–thiswillbetheprivatekey.

• PublickeyisP=nxG(modp),wherepisaprimenumber(eg256-bitprimeforCurve25519).

• nisascalarvaluewhichmultipleswithGtogiveP(publickey)

• Bitcoinusessecp256k1andTorusesCurve25519[here].

Page 13: Chapter 4: Public Key · 2019. 2. 28. · Public Key Methods • Integer Factorization.Using prime numbers. Example: RSA. Digital Certs/SSL. • Discrete Logarithms.Y = Gx mod P.

BitcoinKeyGeneration

Page 14: Chapter 4: Public Key · 2019. 2. 28. · Public Key Methods • Integer Factorization.Using prime numbers. Example: RSA. Digital Certs/SSL. • Discrete Logarithms.Y = Gx mod P.

BitcoinTransaction

Page 15: Chapter 4: Public Key · 2019. 2. 28. · Public Key Methods • Integer Factorization.Using prime numbers. Example: RSA. Digital Certs/SSL. • Discrete Logarithms.Y = Gx mod P.

EllipticCurve(EC)C\>opensslecparam-namesecp256k1-genkey-outpriv.pem

C\>typeec-priv.pem-----BEGINECPARAMETERS-----BgUrgQQACg==-----ENDECPARAMETERS----------BEGINECPRIVATEKEY-----MHQCAQEEIEa56GG2PTUJyIt4FydaMNItYsjNj6ZIbd7jXvDY4ElfoAcGBSuBBAAKoUQDQgAEJQDn8/vd8oQpA/VE3ch0lM6VAprOTiV9VLp38rwfOog3qUYcTxxX/sxJl1M4HncqEopYIKkkovoFFi62Yph6nw==-----ENDECPRIVATEKEY-----

Example

Page 16: Chapter 4: Public Key · 2019. 2. 28. · Public Key Methods • Integer Factorization.Using prime numbers. Example: RSA. Digital Certs/SSL. • Discrete Logarithms.Y = Gx mod P.

EllipticCurve(EC)C\>opensslecparam-namesecp256k1-genkey-outpriv.pem

C\>typeec-priv.pem-----BEGINECPARAMETERS-----BgUrgQQACg==-----ENDECPARAMETERS----------BEGINECPRIVATEKEY-----MHQCAQEEIEa56GG2PTUJyIt4FydaMNItYsjNj6ZIbd7jXvDY4ElfoAcGBSuBBAAKoUQDQgAEJQDn8/vd8oQpA/VE3ch0lM6VAprOTiV9VLp38rwfOog3qUYcTxxX/sxJl1M4HncqEopYIKkkovoFFi62Yph6nw==-----ENDECPRIVATEKEY-----

Example

Page 17: Chapter 4: Public Key · 2019. 2. 28. · Public Key Methods • Integer Factorization.Using prime numbers. Example: RSA. Digital Certs/SSL. • Discrete Logarithms.Y = Gx mod P.

EllipticCurve(EC)C\>opensslecparam-namesecp256k1-genkey-outpriv.pem

C\>typeec-priv.pem-----BEGINECPARAMETERS-----BgUrgQQACg==-----ENDECPARAMETERS----------BEGINECPRIVATEKEY-----MHQCAQEEIEa56GG2PTUJyIt4FydaMNItYsjNj6ZIbd7jXvDY4ElfoAcGBSuBBAAKoUQDQgAEJQDn8/vd8oQpA/VE3ch0lM6VAprOTiV9VLp38rwfOog3qUYcTxxX/sxJl1M4HncqEopYIKkkovoFFi62Yph6nw==-----ENDECPRIVATEKEY-----

C\>opensslec-inpriv.pem-text-nooutreadECkeyPrivate-Key(256bit)priv46b9e861b63d3509c88b7817275a30d22d62c8cd8fa6486ddee35ef0d8e0495fpub042500e7f3fbddf2842903f544ddc87494ce95029ace4e257d54ba77f2bc1f3a8837a9461c4f1c57fecc499753381e772a128a5820a924a2fa05162eb662987a9fASN1OIDsecp256k1

Example

Page 18: Chapter 4: Public Key · 2019. 2. 28. · Public Key Methods • Integer Factorization.Using prime numbers. Example: RSA. Digital Certs/SSL. • Discrete Logarithms.Y = Gx mod P.

EllipticCurve(EC)C\>opensslecparam-namesecp256k1-genkey-outpriv.pem

C\>typeec-priv.pem-----BEGINECPARAMETERS-----BgUrgQQACg==-----ENDECPARAMETERS----------BEGINECPRIVATEKEY-----MHQCAQEEIEa56GG2PTUJyIt4FydaMNItYsjNj6ZIbd7jXvDY4ElfoAcGBSuBBAAKoUQDQgAEJQDn8/vd8oQpA/VE3ch0lM6VAprOTiV9VLp38rwfOog3qUYcTxxX/sxJl1M4HncqEopYIKkkovoFFi62Yph6nw==-----ENDECPRIVATEKEY-----

Example

Page 19: Chapter 4: Public Key · 2019. 2. 28. · Public Key Methods • Integer Factorization.Using prime numbers. Example: RSA. Digital Certs/SSL. • Discrete Logarithms.Y = Gx mod P.

EllipticCurve(EC)C\>opensslecparam-namesecp256k1-genkey-outpriv.pem

C\>typeec-priv.pem-----BEGINECPARAMETERS-----BgUrgQQACg==-----ENDECPARAMETERS----------BEGINECPRIVATEKEY-----MHQCAQEEIEa56GG2PTUJyIt4FydaMNItYsjNj6ZIbd7jXvDY4ElfoAcGBSuBBAAKoUQDQgAEJQDn8/vd8oQpA/VE3ch0lM6VAprOTiV9VLp38rwfOog3qUYcTxxX/sxJl1M4HncqEopYIKkkovoFFi62Yph6nw==-----ENDECPRIVATEKEY-----

C\>opensslec-inpriv.pem-text-nooutreadECkeyPrivate-Key(256bit)priv46b9e861b63d3509c88b7817275a30d22d62c8cd8fa6486ddee35ef0d8e0495fpub042500e7f3fbddf2842903f544ddc87494ce95029ace4e257d54ba77f2bc1f3a8837a9461c4f1c57fecc499753381e772a128a5820a924a2fa05162eb662987a9fASN1OIDsecp256k1

Example

Page 20: Chapter 4: Public Key · 2019. 2. 28. · Public Key Methods • Integer Factorization.Using prime numbers. Example: RSA. Digital Certs/SSL. • Discrete Logarithms.Y = Gx mod P.

EllipticCurve(EC)C\>opensslecparam-namesecp256k1-genkey-outpriv.pem

C\>typeec-priv.pem-----BEGINECPARAMETERS-----BgUrgQQACg==-----ENDECPARAMETERS----------BEGINECPRIVATEKEY-----MHQCAQEEIEa56GG2PTUJyIt4FydaMNItYsjNj6ZIbd7jXvDY4ElfoAcGBSuBBAAKoUQDQgAEJQDn8/vd8oQpA/VE3ch0lM6VAprOTiV9VLp38rwfOog3qUYcTxxX/sxJl1M4HncqEopYIKkkovoFFi62Yph6nw==-----ENDECPRIVATEKEY-----

C\>opensslec-inpriv.pem-text-nooutreadECkeyPrivate-Key(256bit)priv46b9e861b63d3509c88b7817275a30d22d62c8cd8fa6486ddee35ef0d8e0495fpub042500e7f3fbddf2842903f544ddc87494ce95029ace4e257d54ba77f2bc1f3a8837a9461c4f1c57fecc499753381e772a128a5820a924a2fa05162eb662987a9fASN1OIDsecp256k1

Example C:>opensslecparam-inpriv.pem-text-param_encexplicit-nooutFieldType:prime-fieldPrime:00:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:fe:ff:ff:fc:2fA:0B:7(0x7)Generator(uncompressed):04:79:be:66:7e:f9:dc:bb:ac:55:a0:62:95:ce:87:0b:07:02:9b:fc:db:2d:ce:28:d9:59:f2:81:5b:16:f8:17:98:48:3a:da:77:26:a3:c4:65:5d:a4:fb:fc:0e:11:08:a8:fd:17:b4:48:a6:85:54:19:9c:47:d0:8f:fb:10:d4:b8Order:00:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:fe:ba:ae:dc:e6:af:48:a0:3b:bf:d2:5e:8c:d0:36:41:41Cofactor:1(0x1)

Page 21: Chapter 4: Public Key · 2019. 2. 28. · Public Key Methods • Integer Factorization.Using prime numbers. Example: RSA. Digital Certs/SSL. • Discrete Logarithms.Y = Gx mod P.

EllipticCurveDiffieHellman(ECDH)

Page 22: Chapter 4: Public Key · 2019. 2. 28. · Public Key Methods • Integer Factorization.Using prime numbers. Example: RSA. Digital Certs/SSL. • Discrete Logarithms.Y = Gx mod P.

EllipticCurveDiffieHellman(ECDH)

Page 23: Chapter 4: Public Key · 2019. 2. 28. · Public Key Methods • Integer Factorization.Using prime numbers. Example: RSA. Digital Certs/SSL. • Discrete Logarithms.Y = Gx mod P.

EllipticCurveDiffieHellman(ECDH)

Page 24: Chapter 4: Public Key · 2019. 2. 28. · Public Key Methods • Integer Factorization.Using prime numbers. Example: RSA. Digital Certs/SSL. • Discrete Logarithms.Y = Gx mod P.

Chapter4:PublicKey ElGamal ProfBillBuchananOBE http://asecuritysite.com/crypto04http://asecuritysite.com/encryption

Page 25: Chapter 4: Public Key · 2019. 2. 28. · Public Key Methods • Integer Factorization.Using prime numbers. Example: RSA. Digital Certs/SSL. • Discrete Logarithms.Y = Gx mod P.

ElGamal

• Y=Gxmodp• Gispickedfromcyclicgroup

(ExplainedinKeyHandshakingsection).Here.

• pisaprimenumber.• Examplehere.

Page 26: Chapter 4: Public Key · 2019. 2. 28. · Public Key Methods • Integer Factorization.Using prime numbers. Example: RSA. Digital Certs/SSL. • Discrete Logarithms.Y = Gx mod P.

Chapter4:PublicKey PGP ProfBillBuchananOBE http://asecuritysite.com/crypto04http://asecuritysite.com/encryption

Page 27: Chapter 4: Public Key · 2019. 2. 28. · Public Key Methods • Integer Factorization.Using prime numbers. Example: RSA. Digital Certs/SSL. • Discrete Logarithms.Y = Gx mod P.

PGP

Page 28: Chapter 4: Public Key · 2019. 2. 28. · Public Key Methods • Integer Factorization.Using prime numbers. Example: RSA. Digital Certs/SSL. • Discrete Logarithms.Y = Gx mod P.

Chapter4:PublicKey Basics RSAEllipticCurveElGamal ProfBillBuchananOBE http://asecuritysite.com/crypto04http://asecuritysite.com/encryption


Recommended