Question






Use the python erypto library to demonstrate how to encrypt and decrypt a message using AES n ECB mode. The python interrupter is installed by default with Kali Linux Take screenshots of command walkthrough and explain your steps Note: You will need to create a separate object for encryption and decryption similar to the example illustrate in the course slides You can also use pydoc command to view the documentation for the library. For example if you type: pydoc Crypto.cCipher.AEs in the console you will see information about how to use the AES python class, the constructor arguments, the functions supported, as well as the different options like eipher chaining modes
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Please find below screenshot from IDLE and copyable code

>>>from Crypto.Cipher import AES >>key-myrandomkev1234567890abc >>encrypt_objectAES.new(key, AES.MODE_ECB) >>> # message to encrypt msgmysecretmessagea >>encrypted_msg-encrypt_object.encrypt(msg) >>> #now message encrypted , building decrypted message decryptd_object AEs.new(key, AES.MODE_ECB) >>decrypted_msg decryptd object.decrypt (encrypted_msg) >>> decrypted_msg mysecretmessage@

from Crypto.Cipher import AES
key="myrandomkey1234567890abc"
encrypt_object = AES.new(key, AES.MODE_ECB)
# message to encrypt
msg = 'mysecretmessage@'
encrypted_msg = encrypt_object.encrypt(msg)
#now message encrypted , building decrypted message
decryptd_object = AES.new(key, AES.MODE_ECB)
decrypted_msg = decryptd_object.decrypt(encrypted_msg)
print(decrypted_msg)
Add a comment
Know the answer?
Add Answer to:
Use the python erypto library to demonstrate how to encrypt and decrypt a message using AES...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Implement in Go language AES encryption mode CBC with providing the packages name for Go language....

    Implement in Go language AES encryption mode CBC with providing the packages name for Go language. You can implement AES-ECB Mode (the basic AES) from crypto/aes package and crypto/cipher.Block. You can also get the SHA-256 hash function from crypto/sha256. You can get the secure random numbers generator from crypto/rand package. However, the you will implement both CBC mode and HMAC from scratch. You are NOT allowed to use any libraries or packages to implement these two things for you. You...

  • 1. Write a python code: Using a dictionary, make a text encrypter/decrypter. In decrypt mode, if...

    1. Write a python code: Using a dictionary, make a text encrypter/decrypter. In decrypt mode, if the user inputs “Y r u l8?”, the program should output “Why are you late?”, for example. In encrypt mode, if the user inputs “See you later”, it should output “c u l8r”. Obviously you can’t handle every possible phrase, but add as many as you can. Don’t bother with multiword shortcuts for now (LOL, BRB, etc.) 2. Draw a flowchart of your encryption/decryption...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT