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 1,113 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 20, 2019 by Ahmed

Related Questions In Python

0 votes
1 answer
+2 votes
3 answers

How can I play an audio file in the background using Python?

down voteacceptedFor windows: you could use  winsound.SND_ASYNC to play them ...READ MORE

answered Apr 3, 2018 in Python by charlie_brown
• 7,760 points
+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 962 views
0 votes
0 answers
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 22, 2019 in Cyber Security & Ethical Hacking by Ahmed
• 310 points

closed Aug 22, 2019 by Ahmed 95 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
• 57,530 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 23, 2018 in Python by aryya
• 7,350 points