SlideShare a Scribd company logo
1 of 25
Distribution of Public Keys and HMAC
Presented by:
Anurag Jagetiya
Astt. Prof. MLV Textile & Engineering
College, Bhilwara
Objective
• Understand the technique use for distribution
of Public keys.
• Understanding of MAC.
Prerequisite
• Understanding of Network Security Principles
Outline
• Background
• Key Distribution
– RSA approach
– Publicly available directory
– Public key authority
– Public key certificate
• Hash base Message Authentication Code (HMAC)
Background
"Cryptography, defined as "the science and study of
secret writing" concerns the ways in which
communications and data can be encoded to prevent
disclosure of their contents through eavesdropping
or message interception, using codes, ciphers and
other methods, so that only certain people can see
the real message.“
- Yamen Akdeniz
The Need for Cryptography
Cryptography is required to ensure:
• Confidentiality
• Authentication
• Authorization
• Data Integrity
• Non-Repudiation
Types of Cryptography
• Private key (Symmetric) Cryptography
• Public Key (Asymmetric)Cryptography
Private key Cryptography
• Sender and the Recipient share a key that
must be kept private to them.
• Same key is used to encrypt and decrypt the
message.
• Example: DES, Triple DES, IDEA, blowfish, RC4
Problem: Private key Cryptography
• Every pair of user needs a unique key, thus
number of keys are very large.
• Number of keys for N users are N(N-1)/2.
• Key distribution is a big problem: cannot trust
upon third party
• Solution: Public Key Cryptography
Public Key Cryptography
• Sender & Receiver both has two sets of keys
Public key and Private key.
• Both the keys can be used for encryption/
decryption.
• Public key is publically available to everyone
wish to send secret message.
• Private key remains secret to user.
• Example: RSA, ECC, etc
Key Distribution
Distribution of Public Keys
RSA
• Based upon mathematics that it is easier to
multiply two large prime numbers but it’s very
difficult to find its factor.
• e.g. 40259, find its factors
• Public key is the product of two long prime
numbers
• Considered very secure but may suffer from
man in middle attack
317 *217
Publicly available directory
• directory must be trusted with properties:
– contain {name, public-key} entries
– participants register securely with directory
– participants can replace key at any time
– directory is periodically published
• Still vulnerable: trusted party can be attacked.
Or if intruder somehow know the private key
of any participant, she can pass counterfeit
key information to the directory.
Public key authority
• Authority provides its public keys to participants
• Participants can request for their keys in an
encrypted manner that can be decrypted by the
private key of the authority.
• Danger of tempering with authority is still
prevailing
• Dependency upon Authority is an overhead.
Public key certificate
• Digitally signed electronic certificates are used by the
participants to exchange public keys safely.
• These certificates are assigned by the certificate
authority like: VeriSign etc.
• Nobody other than the trusted certificate authority
can generate the certificates.
• Popular TLS protocol uses the services of X.509
directory authentication service for the same.
HMAC: Background
• Authentication techniques ensures
– Message is from alleged sender
– And, its integrity is preserved
• Hash functions are used to produce a fixed
length digest of the input message
• It is known as message digest or message
authentication code
Contd…
• Hash functions are known as one way
function i.e. easy in one direction but difficult
in another direction.
• for any two different messages it’s impossible
to get similar digest.
• Common hash algorithms
– MD5 produces fixed 128 bit digest
– SHA-1 produces 160 bit bits
HMAC Introduction
• HMAC uses popular cryptographic hash
function like MD-5 or SHA-1 to generate
strong and secure MAC.
• HMAC uses a secret key for the calculation
and verification of the MACs.
• HMAC is specified in RFC 2104
Contd…
• To use available and approved cryptographic hash
functions whose:
– Cryptographic strength has been proved effectively.
– Code is freely available and they perform well in software.
• Old embedded hash functions can be easily replaced
with new hash functions, when developed.
• To make a simple use of keys
HMAC Algorithm: Parameters and symbols
M Input Message to HMAC (With necessary padding)
B Block Size (In Bytes) of Input Message
H Embedded hash function
Ipad Inner Pad: the byte 0x36 (In hexadecimal) repeated B times
K Secret Key (Shared by only sender and receiver)
K0 Key K after necessary pre-processing (i.e. padded with zeros
on the left) to form a B byte key
Opad Outerpad: 0x5C (In hexadecimal) repeated B times
L Length of the hash code (in bytes)
|| Concatenation
Exclusive or
HMAC Algorithm: Cryptographic Key
• The size of secret key K used in HMAC shall be
equal to or greater than L/2
• Here L is the size of Hash function output
• If key size greater than input block size (B
bytes), first apply the key to hash function (H)
than the resultant L byte string is used as key
• Key should be chosen at random using key
generation algorithms and change
periodically.
HMAC Algorithm
1. If K = B than Set K0:= K. Go to step 4
2. If K < B than K is padded with zeros in the left that form B byte string K0.
Go to step 4.
3. If K> B than hash the key K through H to get L byte string than add B-L
zeros to get a B byte string. (i.e. K0=H (K) || 0000…) Go to step 4
4. XOR K0 and ipad to generate a B byte string: K0 ipad
5. Append the input message to the output string of step 4. (K0 ipad) || M
6. Apply H to the stream generate in step 5. H ((K0 ipad) || M)
7. XOR K0 and opad: K0 opad
8. Append the result of step 6 to result of step 7:
9. (K0 opad)|| H ((K0 ipad) || M)
10. Apply H to the stream generated in step 8 to get the final output:
11. H((K0 opad)|| H ((K0 ipad) || M))
Graphical representation of HMAC Algorithm
Image Source: http://blog.mousavi.net/2013/01/23/hmac-the-keyed-hash-based-
mac-function/
• XORing of ipad and opad with key K result in
the flipping of half of its key bits.
• But the flipped value will be different for ipad
and opad respectively.
• Thus two keys are pseudo randomly
generated by key K.
References
• Anurag Jagetiya, C. Ramakrishna, “Secure Socket Layer-A
Boon to E-commerce”, CSI Communications, May-2013.
• William Stallings, Cryptography and Network Security
Principles and Practices, Pearson Publication, 4th Edition.

More Related Content

What's hot

Types of Cryptosystem and Cryptographic Attack
Types of Cryptosystem and Cryptographic AttackTypes of Cryptosystem and Cryptographic Attack
Types of Cryptosystem and Cryptographic Attack
Mona Rajput
 
Cryptography.ppt
Cryptography.pptCryptography.ppt
Cryptography.ppt
Uday Meena
 
PUBLIC KEY ENCRYPTION
PUBLIC KEY ENCRYPTIONPUBLIC KEY ENCRYPTION
PUBLIC KEY ENCRYPTION
raf_slide
 

What's hot (20)

RSA ALGORITHM
RSA ALGORITHMRSA ALGORITHM
RSA ALGORITHM
 
Internet Key Exchange Protocol
Internet Key Exchange ProtocolInternet Key Exchange Protocol
Internet Key Exchange Protocol
 
18CS2005 Cryptography and Network Security
18CS2005 Cryptography and Network Security18CS2005 Cryptography and Network Security
18CS2005 Cryptography and Network Security
 
Network security cryptographic hash function
Network security  cryptographic hash functionNetwork security  cryptographic hash function
Network security cryptographic hash function
 
Key management and distribution
Key management and distributionKey management and distribution
Key management and distribution
 
Kerberos
KerberosKerberos
Kerberos
 
Kerberos : An Authentication Application
Kerberos : An Authentication ApplicationKerberos : An Authentication Application
Kerberos : An Authentication Application
 
Elgamal digital signature
Elgamal digital signatureElgamal digital signature
Elgamal digital signature
 
Types of Cryptosystem and Cryptographic Attack
Types of Cryptosystem and Cryptographic AttackTypes of Cryptosystem and Cryptographic Attack
Types of Cryptosystem and Cryptographic Attack
 
Asymmetric Cryptography
Asymmetric CryptographyAsymmetric Cryptography
Asymmetric Cryptography
 
Secure Socket Layer
Secure Socket LayerSecure Socket Layer
Secure Socket Layer
 
Cryptography.ppt
Cryptography.pptCryptography.ppt
Cryptography.ppt
 
MAC-Message Authentication Codes
MAC-Message Authentication CodesMAC-Message Authentication Codes
MAC-Message Authentication Codes
 
Cryptography
CryptographyCryptography
Cryptography
 
Message Authentication Code & HMAC
Message Authentication Code & HMACMessage Authentication Code & HMAC
Message Authentication Code & HMAC
 
History of cryptography
History of cryptographyHistory of cryptography
History of cryptography
 
Secure Socket Layer (SSL)
Secure Socket Layer (SSL)Secure Socket Layer (SSL)
Secure Socket Layer (SSL)
 
Public Key Cryptosystem
Public Key CryptosystemPublic Key Cryptosystem
Public Key Cryptosystem
 
PUBLIC KEY ENCRYPTION
PUBLIC KEY ENCRYPTIONPUBLIC KEY ENCRYPTION
PUBLIC KEY ENCRYPTION
 
CRYPTOGRAPHY AND NETWORK SECURITY
CRYPTOGRAPHY AND NETWORK SECURITYCRYPTOGRAPHY AND NETWORK SECURITY
CRYPTOGRAPHY AND NETWORK SECURITY
 

Viewers also liked

Ch01
Ch01Ch01
Ch01
n C
 
8 Authentication Security Protocols
8 Authentication Security Protocols8 Authentication Security Protocols
8 Authentication Security Protocols
guestfbf635
 
12 symmetric key cryptography
12   symmetric key cryptography12   symmetric key cryptography
12 symmetric key cryptography
drewz lin
 
13 asymmetric key cryptography
13   asymmetric key cryptography13   asymmetric key cryptography
13 asymmetric key cryptography
drewz lin
 

Viewers also liked (20)

Lecture 9 key distribution and user authentication
Lecture 9 key distribution and user authentication Lecture 9 key distribution and user authentication
Lecture 9 key distribution and user authentication
 
key distribution in network security
key distribution in network securitykey distribution in network security
key distribution in network security
 
Cryptography and applications
Cryptography and applicationsCryptography and applications
Cryptography and applications
 
Protocols for Public Key Management
Protocols for Public Key ManagementProtocols for Public Key Management
Protocols for Public Key Management
 
Ch14
Ch14Ch14
Ch14
 
NetworkSecurity
NetworkSecurityNetworkSecurity
NetworkSecurity
 
Implementation of Bitcoin Miner on SW and HW
Implementation of Bitcoin Miner on SW and HWImplementation of Bitcoin Miner on SW and HW
Implementation of Bitcoin Miner on SW and HW
 
Digital signature
Digital signatureDigital signature
Digital signature
 
Fuzzy Set | Statistics
Fuzzy Set | StatisticsFuzzy Set | Statistics
Fuzzy Set | Statistics
 
Encryption and Key Distribution Methods
Encryption and Key Distribution MethodsEncryption and Key Distribution Methods
Encryption and Key Distribution Methods
 
Fuzzy Set
Fuzzy SetFuzzy Set
Fuzzy Set
 
Authentication Protocols
Authentication ProtocolsAuthentication Protocols
Authentication Protocols
 
Ch01
Ch01Ch01
Ch01
 
Digital signature
Digital  signatureDigital  signature
Digital signature
 
CCNA Security 012- cryptographic systems
CCNA Security 012- cryptographic systemsCCNA Security 012- cryptographic systems
CCNA Security 012- cryptographic systems
 
Email security
Email securityEmail security
Email security
 
8 Authentication Security Protocols
8 Authentication Security Protocols8 Authentication Security Protocols
8 Authentication Security Protocols
 
block ciphers
block ciphersblock ciphers
block ciphers
 
12 symmetric key cryptography
12   symmetric key cryptography12   symmetric key cryptography
12 symmetric key cryptography
 
13 asymmetric key cryptography
13   asymmetric key cryptography13   asymmetric key cryptography
13 asymmetric key cryptography
 

Similar to Distribution of public keys and hmac

UNIT3_class (1).ppt CRYPTOGRAPHY NOTES AND NETWORK
UNIT3_class (1).ppt CRYPTOGRAPHY NOTES AND NETWORKUNIT3_class (1).ppt CRYPTOGRAPHY NOTES AND NETWORK
UNIT3_class (1).ppt CRYPTOGRAPHY NOTES AND NETWORK
jeevasreemurali
 
Cryptography and Message Authentication NS3
Cryptography and Message Authentication NS3Cryptography and Message Authentication NS3
Cryptography and Message Authentication NS3
koolkampus
 
BAIT1103 Chapter 2
BAIT1103 Chapter 2BAIT1103 Chapter 2
BAIT1103 Chapter 2
limsh
 
CISSP Week 20
CISSP Week 20CISSP Week 20
CISSP Week 20
jemtallon
 

Similar to Distribution of public keys and hmac (20)

Message authentication and hash function
Message authentication and hash functionMessage authentication and hash function
Message authentication and hash function
 
Cs8792 cns - unit iv
Cs8792   cns - unit ivCs8792   cns - unit iv
Cs8792 cns - unit iv
 
Cs8792 cns - unit iv
Cs8792   cns - unit ivCs8792   cns - unit iv
Cs8792 cns - unit iv
 
Cns
CnsCns
Cns
 
Cryptography Key Management.pptx
Cryptography Key Management.pptxCryptography Key Management.pptx
Cryptography Key Management.pptx
 
UNIT3_class (1).ppt CRYPTOGRAPHY NOTES AND NETWORK
UNIT3_class (1).ppt CRYPTOGRAPHY NOTES AND NETWORKUNIT3_class (1).ppt CRYPTOGRAPHY NOTES AND NETWORK
UNIT3_class (1).ppt CRYPTOGRAPHY NOTES AND NETWORK
 
Hash Function
Hash FunctionHash Function
Hash Function
 
Public Key Encryption & Hash functions
Public Key Encryption & Hash functionsPublic Key Encryption & Hash functions
Public Key Encryption & Hash functions
 
Cryptography and Message Authentication NS3
Cryptography and Message Authentication NS3Cryptography and Message Authentication NS3
Cryptography and Message Authentication NS3
 
IS413 Topic 5.pptx
IS413 Topic 5.pptxIS413 Topic 5.pptx
IS413 Topic 5.pptx
 
Message authentication
Message authenticationMessage authentication
Message authentication
 
SHA_and_DS.pdf
SHA_and_DS.pdfSHA_and_DS.pdf
SHA_and_DS.pdf
 
Message auth. code Based on Hash Functions.pptx
Message auth. code Based on Hash Functions.pptxMessage auth. code Based on Hash Functions.pptx
Message auth. code Based on Hash Functions.pptx
 
Information and data security cryptographic hash functions
Information and data security cryptographic hash functionsInformation and data security cryptographic hash functions
Information and data security cryptographic hash functions
 
BAIT1103 Chapter 2
BAIT1103 Chapter 2BAIT1103 Chapter 2
BAIT1103 Chapter 2
 
CISSP Week 20
CISSP Week 20CISSP Week 20
CISSP Week 20
 
CNIT 1417. Keyed Hashing
CNIT 1417. Keyed HashingCNIT 1417. Keyed Hashing
CNIT 1417. Keyed Hashing
 
CNIT 141 7. Keyed Hashing
CNIT 141 7. Keyed HashingCNIT 141 7. Keyed Hashing
CNIT 141 7. Keyed Hashing
 
Improved authentication & key agreement protocol using elliptic curve cryptog...
Improved authentication & key agreement protocol using elliptic curve cryptog...Improved authentication & key agreement protocol using elliptic curve cryptog...
Improved authentication & key agreement protocol using elliptic curve cryptog...
 
CNIT 141: 7. Keyed Hashing
CNIT 141: 7. Keyed HashingCNIT 141: 7. Keyed Hashing
CNIT 141: 7. Keyed Hashing
 

Recently uploaded

Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
dharasingh5698
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
dollysharma2066
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
MsecMca
 

Recently uploaded (20)

Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
Intro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfIntro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdf
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
 

Distribution of public keys and hmac

  • 1. Distribution of Public Keys and HMAC Presented by: Anurag Jagetiya Astt. Prof. MLV Textile & Engineering College, Bhilwara
  • 2. Objective • Understand the technique use for distribution of Public keys. • Understanding of MAC.
  • 3. Prerequisite • Understanding of Network Security Principles
  • 4. Outline • Background • Key Distribution – RSA approach – Publicly available directory – Public key authority – Public key certificate • Hash base Message Authentication Code (HMAC)
  • 5. Background "Cryptography, defined as "the science and study of secret writing" concerns the ways in which communications and data can be encoded to prevent disclosure of their contents through eavesdropping or message interception, using codes, ciphers and other methods, so that only certain people can see the real message.“ - Yamen Akdeniz
  • 6. The Need for Cryptography Cryptography is required to ensure: • Confidentiality • Authentication • Authorization • Data Integrity • Non-Repudiation
  • 7. Types of Cryptography • Private key (Symmetric) Cryptography • Public Key (Asymmetric)Cryptography
  • 8. Private key Cryptography • Sender and the Recipient share a key that must be kept private to them. • Same key is used to encrypt and decrypt the message. • Example: DES, Triple DES, IDEA, blowfish, RC4
  • 9. Problem: Private key Cryptography • Every pair of user needs a unique key, thus number of keys are very large. • Number of keys for N users are N(N-1)/2. • Key distribution is a big problem: cannot trust upon third party • Solution: Public Key Cryptography
  • 10. Public Key Cryptography • Sender & Receiver both has two sets of keys Public key and Private key. • Both the keys can be used for encryption/ decryption. • Public key is publically available to everyone wish to send secret message. • Private key remains secret to user. • Example: RSA, ECC, etc
  • 12. RSA • Based upon mathematics that it is easier to multiply two large prime numbers but it’s very difficult to find its factor. • e.g. 40259, find its factors • Public key is the product of two long prime numbers • Considered very secure but may suffer from man in middle attack 317 *217
  • 13. Publicly available directory • directory must be trusted with properties: – contain {name, public-key} entries – participants register securely with directory – participants can replace key at any time – directory is periodically published • Still vulnerable: trusted party can be attacked. Or if intruder somehow know the private key of any participant, she can pass counterfeit key information to the directory.
  • 14. Public key authority • Authority provides its public keys to participants • Participants can request for their keys in an encrypted manner that can be decrypted by the private key of the authority. • Danger of tempering with authority is still prevailing • Dependency upon Authority is an overhead.
  • 15. Public key certificate • Digitally signed electronic certificates are used by the participants to exchange public keys safely. • These certificates are assigned by the certificate authority like: VeriSign etc. • Nobody other than the trusted certificate authority can generate the certificates. • Popular TLS protocol uses the services of X.509 directory authentication service for the same.
  • 16. HMAC: Background • Authentication techniques ensures – Message is from alleged sender – And, its integrity is preserved • Hash functions are used to produce a fixed length digest of the input message • It is known as message digest or message authentication code
  • 17. Contd… • Hash functions are known as one way function i.e. easy in one direction but difficult in another direction. • for any two different messages it’s impossible to get similar digest. • Common hash algorithms – MD5 produces fixed 128 bit digest – SHA-1 produces 160 bit bits
  • 18. HMAC Introduction • HMAC uses popular cryptographic hash function like MD-5 or SHA-1 to generate strong and secure MAC. • HMAC uses a secret key for the calculation and verification of the MACs. • HMAC is specified in RFC 2104
  • 19. Contd… • To use available and approved cryptographic hash functions whose: – Cryptographic strength has been proved effectively. – Code is freely available and they perform well in software. • Old embedded hash functions can be easily replaced with new hash functions, when developed. • To make a simple use of keys
  • 20. HMAC Algorithm: Parameters and symbols M Input Message to HMAC (With necessary padding) B Block Size (In Bytes) of Input Message H Embedded hash function Ipad Inner Pad: the byte 0x36 (In hexadecimal) repeated B times K Secret Key (Shared by only sender and receiver) K0 Key K after necessary pre-processing (i.e. padded with zeros on the left) to form a B byte key Opad Outerpad: 0x5C (In hexadecimal) repeated B times L Length of the hash code (in bytes) || Concatenation Exclusive or
  • 21. HMAC Algorithm: Cryptographic Key • The size of secret key K used in HMAC shall be equal to or greater than L/2 • Here L is the size of Hash function output • If key size greater than input block size (B bytes), first apply the key to hash function (H) than the resultant L byte string is used as key • Key should be chosen at random using key generation algorithms and change periodically.
  • 22. HMAC Algorithm 1. If K = B than Set K0:= K. Go to step 4 2. If K < B than K is padded with zeros in the left that form B byte string K0. Go to step 4. 3. If K> B than hash the key K through H to get L byte string than add B-L zeros to get a B byte string. (i.e. K0=H (K) || 0000…) Go to step 4 4. XOR K0 and ipad to generate a B byte string: K0 ipad 5. Append the input message to the output string of step 4. (K0 ipad) || M 6. Apply H to the stream generate in step 5. H ((K0 ipad) || M) 7. XOR K0 and opad: K0 opad 8. Append the result of step 6 to result of step 7: 9. (K0 opad)|| H ((K0 ipad) || M) 10. Apply H to the stream generated in step 8 to get the final output: 11. H((K0 opad)|| H ((K0 ipad) || M))
  • 23. Graphical representation of HMAC Algorithm Image Source: http://blog.mousavi.net/2013/01/23/hmac-the-keyed-hash-based- mac-function/
  • 24. • XORing of ipad and opad with key K result in the flipping of half of its key bits. • But the flipped value will be different for ipad and opad respectively. • Thus two keys are pseudo randomly generated by key K.
  • 25. References • Anurag Jagetiya, C. Ramakrishna, “Secure Socket Layer-A Boon to E-commerce”, CSI Communications, May-2013. • William Stallings, Cryptography and Network Security Principles and Practices, Pearson Publication, 4th Edition.