How can i import json file and encrypt it by using ASE MODE CBC encryption

0 votes
How can I import json file and encrypt it by using ASE MODE CBC encryption by python (I'm using Ubuntu win)
Aug 20, 2019 in Python by Ahmed
• 310 points

recategorized Aug 20, 2019 by Omkar 3,213 views

1 answer to this question.

+1 vote
Best answer

Hi @Ahmed. Here's a sample code that reads the data from a json file, converts it into a string and then encrypt:

import json
from Cryptodome.Cipher import AES

with open('path_to_file/filename.json') as f:
key = '0123456789abcdef'
encryptor ='utf8'), mode,IV=IV.encode('utf8'))
ciphertext = encryptor.encrypt(text)

answered Aug 20, 2019 by Simran

selected Aug 21, 2019 by Ahmed

Related Questions In Python

0 votes
1 answer

how can i extact all the links from a website using python and save it in a csv file ?

Hi, @Shubham, Web scraping is the technique to ...READ MORE

answered Jun 16, 2020 in Python by Gitika
• 65,970 points
0 votes
1 answer
0 votes
1 answer

How can I upgrade specific packages using pip and a requirements file?

Hello @kartik, According to pip documentation example 3: pip install --upgrade ...READ MORE

answered Aug 6, 2020 in Python by Niroj
• 82,880 points
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 2,479 views
0 votes
1 answer
0 votes
0 answers

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

I'm using Ubuntu win. on python I ...READ MORE

Aug 23, 2019 in Cyber Security & Ethical Hacking by Ahmed
• 310 points

closed Aug 23, 2019 by Ahmed 319 views
+1 vote
1 answer

How can I map input to output without using dynamic()

Here am talking about my example you ...READ MORE

answered Aug 8, 2018 in Python by Priyaj
• 58,140 points
0 votes
1 answer

How can I expose callbacks to Fortran using Python

The code that I've written below. The ...READ MORE

answered Aug 24, 2018 in Python by aryya
• 7,440 points