Cracking The HMAC Message Authentication System In Cryptography | Hacker Noon

@gtmars.comMr.Vic

Founder of gtmars.com & plan2trip.com. Sharing knowledge in the digital world about Cybersecurity

★ HMAC, a popular authentication mechanism used for authenticating a message using cryptographic hash functions.

★ HMAC, a popular authentication mechanism used for authenticating a message using cryptographic hash functions. We can use HMAC with any iterative cryptographic hash function family, in combination with a shared secret key. The strength of HMAC depends on the underlying properties of the cryptographic hash function. In today’s computing world HMAC providing a necessary way to check the integrity of the message transmitted either stored in an unreliable medium. The mechanism used by HMAC to perform an integrity check on a shared secret key between two parties called the Hash message authentication code (HMAC).

Design and Development:

★ In this section, we use HMAC to design and develop a message-based system to encrypt and decrypt messages using an RSA algorithm. We implement and verify both the integrity and authenticity of messages between the two campuses and the required procedures such as designing, developing, testing various operations documented with cryptool open-source software.

Step 1: First, click on the left side navigation bar “NEW” icon in the Menu section as shown below in Fig1.

In Fig.1 To create a new project (workspace).

On the left side, CrypTool 2 (CT2) contains various classical and modern ciphers. We will use the search tool to fetch our ciphers.

Step 2: Open a “Text Input” file using the component “search” box. Find the “search” on the left side of the cryptool workspace. We will create two “Text Input” file as like shown in Fig.2.

In Fig.2 To create a text input and a Key input.

Step 3: Now, we need to add an “AES” encryption algorithm to the workspace. Use the component “search” box to find AES.

Note: 1. Set Action to “Encrypt”.

2. Set Key size to “256 bit”.

In Fig.3. To create an “AES” algorithm.

Step 4: Now, we will add an “SHA” algorithm file into the workspace and to establish a link between “Text Input”, “SHA”, and “AES” as like shown in Fig.22.

Note: 1. Set SHA function to “SHA-256”.

In Fig.4 To Add an “SHA” Algorithm and establish links between AES, key, SHA, and Text input files.

Step 5: Now, we need to add an “AES” for decryption purposes to the workspace. Use the component “search” box to find AES.

Note: 1. Set Action to “Decrypt”.

2. Set Key size to “256 bit”.

In Fig.5 To create an “AES” decryption.

Step 6: Now, we will add an “SHA” algorithm and a “Text Input” file into the workspace and also to establish a link between “Text Input”, “SHA”, and “AES” as like shown in Fig.6.

Note: 1. Set SHA function to “SHA-256”.

In Fig.6 Create an SHA, Text input file, and establish a link.

Step 7: Add a “String encoder” and a “Text Output” file to the workspace and to establish a link between them.

In Fig.7. To Add a string encoder and a Text output file.

Step 8: To provide the Plaintext message and pre-defined shared “key” in the “Text input” box.

In Fig.8 Plaintext and key fed into the Text input boxes.

Step 13: Finally, click on the “Play” button. If Cryptool run the simulation successfully. It encrypt and decrypt the plaintext and the key on the left side and display it exactly to the right side by using the SHA code system. Q.E.D.

In Fig.9 AES Encrypt and Decrypt with hashing code system.

HMAC Integration with AES and SHA:

Step 1: Add an “HMAC” algorithm and a “Text Input” into the existing workspace for encryption purposes. After that to establish a link between them as shown in Fig.10.

Note: Set HMAC to “Md5”.

In Fig.10 To add HMAC into the workspace.

Step 2: Add a “String comparator” and establish a link between the HMAC.

In Fig.11 To add a string comparator.

Step 3: Add an “HMAC” algorithm and a “Text Input” for decryption purposes.

In Fig.12 Add HMAC into the decryption.

Step 4: To establish a link between “Stream comparator” and “HMAC”.

In Fig.13 Link establishment.

Step 5: Add a “Boolean Output” and establish a link between the “Stream comparator”.

In Fig.14 Boolean output linked with Stream comparator.

Note: Play the simulation and check whether the boolean returns the integrity of the message.

In Fig.15 Boolean returns the value.

Step 6: Add a “Gate” to the stream comparator. Then link the AES encryption to the Gate and Gate to AES decryption as like shown in Fig.16.

In Fig.16 Gate linked with Boolean.

Step 7: Set the “Gate” value to “True”.

In Fig.17 Set the Gate value to “true” in the trigger section.

Step 8: Finally, click on the “Play” button. If Cryptool run the simulation successfully. It encrypt and decrypt the plaintext and the key on the left side and display it exactly to the right side by using the HMAC system. Boolean judges the system whether the message has tampered. If they do not tamper it, pass it over the gate and gate send it to AES for decryption and final plaintext is revealed on the other side. Q.E.D.

In Fig.18 HMAC integration result.

HMAC Integration with RSA: Part 1

Step 1: Message-based system to encrypt and decrypt messages using an RSA algorithm.

In Fig.19 Message-based digest encryption and decryption with RSA.

Step 2: To integrate the HMAC system by adding a “Text Input”, “Steam comparator”, “boolean output”, and “Gate” files into the workspace and link them accordingly as shown in Fig.20.

In Fig.20 HMAC integration and link establishment.

Step 3: Finally, click on the “Play” button. If Cryptool run the simulation successfully. It encrypt and decrypt the plaintext and the key on the left side and display it exactly to the right side by using the HMAC system. Boolean judges the system whether the message has tampered with. If they do not tamper it, pass it over the gate and gate send it to RSA for decryption and final plaintext is revealed on the other side. Q.E.D.

In Fig.21 HMAC integration with RSA -final result.

System strengths and weaknesses:

The strength of HMAC depends on the underlying properties of the cryptographic hash function. The key and the message in this prototype hashed separately. AES efficient key management system and computation helped us to meet the integrity and authenticity requirements effectively.

Conclusion:

This report presents the solution for students to develop a secure data transfer system from Port Macquarie to Canberra Campus vice versa and to better the enablement of dynamic service across the points. This report describes a practical algorithmic approach that applied in between the different campuses or locations or gov offices. After experimentation and extensive analysis, we made the ultimate design decision pledge to use the AES algorithm to establish a secure Web data transfer system between the two campuses in the Task1.

In Task 2, we used a message-based system to encrypt and decrypt the text using symmetric and asymmetric algorithms and integrated the HMAC algorithm into the prototype. This report elaborates on the cryptographic algorithm design requirements that led to this choice and presents detailed aspects of the security system and implementation method and detailed scenarios screenshot in this report. The key purpose is to ensure the integrity and authenticity of data.

Exchanging keys securely is not a major issue in AES. RSA algorithm is reliable for key exchange management but it’s not very efficient in terms of performance and cost factor. Therefore, we conclude our research report and recommend using the AES algorithm for implementation consideration.

Quote of the day: “You can lead a horse to water, but you can’t make him drink ” — English Proverb

Explanation: you can give someone an opportunity, but you can’t force them to take it.

Thanks for reading!

Have a pleasant day!

Take a look at other related articles:

Also published at https://medium.com/faun/what-is-hmac-message-authentication-system-in-cryptography-f385d1480642

Tags

The Noonification banner

Subscribe to get your daily round-up of top tech stories!

read original article here