I am creating a application where I have a Dictionary (which is produced from a specific cryptography algorithm) variable and save it to a text file. I retrieve the variable and convert it to Dictionary again like this:
f = open( '/sk.txt')
t_ref = f.read()
requested_encrypted_file = ast.literal_eval(t_ref)
print type(requested_encrypted_file)
f.close()
The Dictionary variable which contain the vital infos for the ciphertext has this form:
{'msg': '{"ALG": 0, "CipherText": "xcUHHV3ifPJKFqB8aL9fzQ==", "MODE": 2, "IV": "2Y2xDI+a7JRt7Zu6Vtq86g=="}', 'alg': 'HMAC_SHA1', 'digest': '4920934247257f548f3ca295455f5109c2bea437'}
The problem is that when I retrieve this variable from file all the fields are str and not the type they where before save it to a txt file? Is there a simple way to retrieve them with the correct types?
Any advice would be helpful and deeply appreciated.