I do not have a real result about encryption file use AES mode CFB in pycrptodome on python [closed]

0 votes
I'm using Ubuntu win. on python I want to encrypt file by use AES mode CFB in pycryptodome but the result I have is encryption the path as txt file on the real path of the file?

>>> import os
>>> import math
>>> import hashlib
>>> import json
>>> from Crypto.Cipher import AES
>>> from Crypto import Random
>>> from Crypto.Random import get_random_bytes
>>> from base64 import b64encode, b64decode
#######################################
>>> key = get_random_bytes(32)
>>> data = 'path_of_file.json'
>>> datanew = data.encode('utf-8')
>>> cipher = AES.new(key, AES.MODE_CFB)
>>> cipher_datanew = cipher.encrypt(datanew)
>>> iv = b64encode(cipher.iv).decode('utf-8')
>>> ct = b64encode(cipher_datanew).decode('utf-8')
>>> result = json.dumps({'iv':iv, 'ciphertext':ct})
>>> print(result)

{"ciphertext": "3s1bIOPwYAMCQxwcdmQ910mxeEiizD64LAZeP0eVQM0P8Mm6", "iv": "MtIYXOP2Z23jpukldmSNXA=="}
closed with the note: i have the solution
Aug 23, 2019 in Cyber Security & Ethical Hacking by Ahmed
• 310 points

closed Aug 23, 2019 by Ahmed 889 views

Related Questions In Cyber Security & Ethical Hacking

0 votes
0 answers

How do I use Metasploit to perform NetBIOS enumeration on a target?

I’d like to use Metasploit to perform ...READ MORE

Nov 6 in Cyber Security & Ethical Hacking by Anupam
• 3,950 points
33 views
+1 vote
1 answer

Not able to use nmap in python.

nmap module doesn’t have PortScanner attribute. The ...READ MORE

answered Jan 28, 2019 in Cyber Security & Ethical Hacking by Omkar
• 69,220 points
3,411 views
+1 vote
0 answers

How can I encryption/decryption in Rijndael using python

I found this https://github.com/moeenz/rijndael ,but does not ...READ MORE

Sep 28, 2019 in Cyber Security & Ethical Hacking by Ahmed
• 310 points
4,925 views
0 votes
1 answer

How do i check a ip address range whether it falls in Class A,Class B,Class C

class NetworkId{ static String findClass(String str){ int index = ...READ MORE

answered Feb 16, 2022 in Cyber Security & Ethical Hacking by Edureka
• 13,620 points
899 views
0 votes
1 answer

How to use Python to read block of data in txt file and convert it to structured data?

Okay, I understand. To extract structured data ...READ MORE

answered Apr 19, 2023 in Cyber Security & Ethical Hacking by Edureka
• 12,690 points
1,565 views
0 votes
1 answer
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,443 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP