Access over 20 million homework & study documents

AES encryptionPlease write a program to perform the first round of

Content type
User Generated
Rating
Showing Page:
1/8
AES encryption
Please write a program to perform the first round of AES
encryption using a 128-bit key. The inputs are a 128-bit
plaintext and a 128-bit key. Your code is to perform the
following steps, as taken from the pseudo-code found on
page 15 of the FIPS-197 document: AddRoundKey(state,
key) In this code state is the 16-byte plaintext (as it is
modified) and key is the 16-byte key. Test your program on
the inputs found in Appendix B of the FIPS-197 document
(page 33).
Looking at that, here is what should be in the state array
after each step:
AddRoundKey(state, key): 19 a0 9a e9 3d f4 c6 f8 e3 e2
8d 48 be 2b 2a 08
SubBytes(state): d4 e0 b8 1e 27 bf b4 41 11 98 5d 52 ae
f1 e5 30
ShiftRows(state): d4 e0 b8 1e bf b4 41 27 5d 52 11 98 30
ae f1 e5
MixColumns(state): 04 e0 48 28 66 cb f8 06 81 19 d3 26
e5 9a 7a 4c
The input should be two strings, each containing 32
hexadecimal characters. The first one should be the key
and the second the plaintext.
Test your program on the input pair:
2b7e151628aed2a6abf7158809cf4f3c
3243f6a8885a308d313198a2e0370734
**if anyone can help me with this I would really appreciate
it. I have tried numerous times and I cannot seem to get in
right. Thanks!! If this code could also be in Java because
that is what I understand the most I would appreciate it.

Sign up to view the full document!

lock_open Sign Up
Showing Page:
2/8
Solution
I have used the AES algorithm to design this program.
Instead of making user input the key, I have proceeded
through the randon generation of the key to encrypt the the
iput text and after that to decrypt it.
This algorithm uses the PKCS5 padding to create the
cipher text.
Below is the algorithm class and the main class to
demonstrate the example.
import javax.crypto.BadPaddingException;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.KeyGenerator;
import java.io.UnsupportedEncodingException;
import java.security.InvalidAlgorithmParameterException;
import java.security.SecureRandom;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.SecretKey;

Sign up to view the full document!

lock_open Sign Up
Showing Page:
3/8

Sign up to view the full document!

lock_open Sign Up
End of Preview - Want to read all 8 pages?
Access Now
Unformatted Attachment Preview
AES encryption Please write a program to perform the first round of AES encryption using a 128-bit key. The inputs are a 128-bit plaintext and a 128-bit key. Your code is to perform the following steps, as taken from the pseudo -code found on page 15 of the FIPS-197 document: AddRoundKey(state, key) In this code state is the 16 -byte plaintext (as it is modified) and key is the 16-byte key. Test your program on the inputs found in Appendix B of the FIPS -197 document (page 33). Looking at that, here is what should be in the state array after each step: AddRoundKey(state, key): 19 a0 9a e9 3d f4 c6 f8 e3 e2 8d 48 be 2b 2a 08 SubBytes(state): d4 e0 b8 1e 27 bf b4 41 11 98 5d 52 ae f1 e5 30 ShiftRows(state): d4 e0 b8 1e bf b4 41 27 5d 52 11 98 30 ae f1 e5 MixColumns(state): 04 e0 48 28 66 cb f8 06 81 19 d3 26 e5 9a 7a 4c The input should be two strings, each containing 32 hexadecimal characters. The first one should be the key and the second the plaintext. Test your program on the input pair: 2b7e151628aed2a6abf7158809cf4f3c 3243f6a8885a308d313198a2e0370734 **if anyone can help me with this I would really appreciate it. I have tried numerous times and I cannot seem to get in right. Thanks!! If this code could also be in Java because that is what I understand the most I would appreciate it. Solution I have used the AES algorithm to design this program. Instead of making user input the key, I have proceeded through the randon generation of the key to encrypt the the iput text a ...
Purchase document to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Anonymous
Really helpful material, saved me a great deal of time.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4