Beispiel #1
0
	def __init__(self, filename, encryption_key):
		self._parser = ConfigParser.RawConfigParser()
		self.filename = filename
		self.encryption_key = encryption_key

		try:
			if self.encryption_key:
				self.cipher = AESObject(self.encryption_key)
				decrypted_string = self.cipher.decrypt(open(self.filename, 'rb').read())
				f = StringIO(decrypted_string)
				self._parser.readfp(f)
				self.encryption = True
			else:
				self._parser.read(self.filename)
				self.encryption = False
			self.success = True
		except:
			self.success = False
Beispiel #2
0
	def set_encryption_key(self, key):
		self.encryption_key = key
		self.cipher = AESObject(self.encryption_key)