I am trying to decrypt password run time reading encrypted password from .config file. Decryption is not working when pw coming from config file but working when calling method directly by passing arguments. Code for encryption as below
from Crypto.Cipher import AES
def main():
obj = AES.new(b'AbcDefPqrXyzSvcs', AES.MODE_CFB, b'AbcDefPqrXyzSvcs')
ciphertext = obj.encrypt(b'abc@123')
print ciphertex
if __name__ == "__main__":main()
and code for decryption
def abc(self, user, pw, somoMoreInfo)
decr= AES.new(b'AbcDefPqrXyzSvcs', AES.MODE_CFB, b'AbcDefPqrXyzSvcs')
x= decr.decrypt(pw)
Now when I pass pw to method "abc" via config file which looks like below it is not working.(In code it is converted into dictionary before passing FYI.)
[EndSystem]
user=user
pw=\xaf\xc6m\t\x84\xbd\xbe
but when I am calling method directly like below it is working.
abc("user", "\xaf\xc6m\t\x84\xbd\xbe", "xyz")
Can some one please help what is going wrong when pw coming from dictionary?