Python Forum
encrypt data in json file help
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
encrypt data in json file help
#1
Hello
I am trying to perfect my password manager app and one of the features i want to add is encrypting the json file so that only the user of the program can view the saved passwords. i accessed this article

https://stackoverflow.com/questions/6160...-in-python

that helped me encrypt the file. it worked. when i tried to read the file manually without using the software the content was encrypted. Now when actually writing to the json file new credentials get saved as encrypted code which works as it should however when trying to read the credentials that are saved in the json file i doesnt work as i mean it to. Basically in order to decrypt the data i have to use file.read() function when opening the file. But i want to keep using the json library for reading the files straight into a dictionary. I need to save them as dictionary because well basically that is how i built the whole program around it. For instance the website is the key and the value is a dictionary with username and password as keys and their counterparts as values. This helps me read the information comprehensively and it is easier to access these pieces of information using json. However like i said above in order to decrypt the data i have to use the read function that converts everything to a string. Can someone help me? Been stuck at this for days
Reply
#2
When you decrypt the file you should get a string. use json.loads(string) to read the string and create your deictionary.

Post the code. Your description is fuzzy.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  parse json field from csv file lebossejames 4 768 Nov-14-2023, 11:34 PM
Last Post: snippsat
  Python Script to convert Json to CSV file chvsnarayana 8 2,545 Apr-26-2023, 10:31 PM
Last Post: DeaD_EyE
  Loop through json file and reset values [SOLVED] AlphaInc 2 2,149 Apr-06-2023, 11:15 AM
Last Post: AlphaInc
  Converting a json file to a dataframe with rows and columns eyavuz21 13 4,521 Jan-29-2023, 03:59 PM
Last Post: eyavuz21
  validate large json file with millions of records in batches herobpv 3 1,282 Dec-10-2022, 10:36 PM
Last Post: bowlofred
  Read nested data from JSON - Getting an error marlonbown 5 1,383 Nov-23-2022, 03:51 PM
Last Post: snippsat
  Reading Data from JSON tpolim008 2 1,097 Sep-27-2022, 06:34 PM
Last Post: Larz60+
  Writing to json file ebolisa 1 1,013 Jul-17-2022, 04:51 PM
Last Post: deanhystad
  Trying to parse only 3 key values from json file cubangt 8 3,504 Jul-16-2022, 02:05 PM
Last Post: deanhystad
  Convert nested sample json api data into csv in python shantanu97 3 2,855 May-21-2022, 01:30 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020