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 22, 2019 in Cyber Security & Ethical Hacking by Ahmed
• 310 points

closed Aug 22, 2019 by Ahmed 156 views

Related Questions In Cyber Security & Ethical Hacking

+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,030 points
570 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
1,159 views
0 votes
1 answer

Not able to run nmap scan on router.

Might not be the actual router address. ...READ MORE

answered Jan 31, 2019 in Cyber Security & Ethical Hacking by Omkar
• 69,030 points
370 views
+1 vote
1 answer
0 votes
1 answer
+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 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,369 views