예제 #1
0
class PartitionCrypt(object):
    """
	classdocs
	"""
    def __init__(self, key):
        """
		Constructor
		"""
        self.log = logging.getLogger(__name__)
        self.log.debug('initializing')
        self.key = key
        self.cl = CryptoLib(key, HEADER)

    ###############################################################################
    ###############################################################################

    ###############################################################################
    ###############################################################################
    def encryptBytesIO(self, plaintext):
        self.log.debug('encrypting partition with key: {}'.format(self.key))
        return self.cl.encryptBytesIO(plaintext)

    def decryptBytesIO(self, ciphertext):
        self.log.debug('decrypting partition with key: {}'.format(self.key))
        return self.cl.decryptBytesIO(ciphertext)
예제 #2
0
class DataCrypt(object):
	"""
	classdocs
	"""


	def __init__(self, key):
		"""
		Constructor
		"""
		self.log = logging.getLogger(__name__)
		self.log.debug('initializing')
		self.key = key
		self.cl = CryptoLib(key, HEADER)

	###############################################################################
	###############################################################################



	###############################################################################
	###############################################################################
	def encryptBytesIO(self, plaintext):
		self.log.debug('encrypting data with key: {}'.format(self.key))
		return self.cl.encryptBytesIO(plaintext)

	def decryptBytesIO(self, ciphertext):
		self.log.debug('decrypting data with key: {}'.format(self.key))
		return self.cl.decryptBytesIO(ciphertext)
예제 #3
0
    def __init__(self, key):
        """
		Constructor
		"""
        self.log = logging.getLogger(__name__)
        self.log.debug('initializing')
        self.key = key
        self.cl = CryptoLib(key, HEADER)
예제 #4
0
	def __init__(self, key):
		"""
		Constructor
		"""
		self.log = logging.getLogger(__name__)
		self.log.debug('initializing')
		self.key = key
		self.cl = CryptoLib(key, HEADER)
예제 #5
0
	Copyright (C) <2016> Tim Waizenegger, <University of Stuttgart>

	This software may be modified and distributed under the terms
	of the MIT license.  See the LICENSE file for details.
"""

from sys import argv
import io
from mcm.sdos.crypto.CryptoLib import CryptoLib

if __name__ == '__main__':
	print("SDOS decrypt tool")
	print("syntax: 1) keystring, 2) in-file")
	print("tool will create a new file with the decrypted content")
	print(argv[1])
	print(argv[2])

	keyString = argv[1]
	filePath = argv[2]

	cl = CryptoLib()
	cl.setKeyString(keyString)
	f = open(filePath, 'b+r')
	enc = io.BytesIO(f.read())
	f.close()
	dec = cl.decryptBytesIO(enc)
	f2 = open(filePath + '_decrypted', 'b+w')
	f2.write(dec.getvalue())
	f2.close()
예제 #6
0
	Copyright (C) <2016> Tim Waizenegger, <University of Stuttgart>

	This software may be modified and distributed under the terms
	of the MIT license.  See the LICENSE file for details.
"""

from sys import argv
import io
from mcm.sdos.crypto.CryptoLib import CryptoLib

if __name__ == '__main__':
    print("SDOS decrypt tool")
    print("syntax: 1) keystring, 2) in-file")
    print("tool will create a new file with the decrypted content")
    print(argv[1])
    print(argv[2])

    keyString = argv[1]
    filePath = argv[2]

    cl = CryptoLib()
    cl.setKeyString(keyString)
    f = open(filePath, 'b+r')
    enc = io.BytesIO(f.read())
    f.close()
    dec = cl.decryptBytesIO(enc)
    f2 = open(filePath + '_decrypted', 'b+w')
    f2.write(dec.getvalue())
    f2.close()