Пример #1
0
	def __init__(self, key):
		if not isinstance(key, bytes):
			raise Exception('Key needs to be bytes!')
		self.key = key
		self.encryptor = None
		self.decryptor = None
		symmetricBASE.__init__(self)
Пример #2
0
    def __init__(self,
                 key,
                 mode=cipherMODE.ECB,
                 IV=None,
                 pad=None,
                 padMode=None):
        self.IV = IV
        #the python cryptography module sets the IV in the operational mode!!!
        if mode == cipherMODE.ECB:
            self.IV = modes.ECB()
        elif mode == cipherMODE.CBC:
            self.IV = modes.CBC(IV)
        elif mode == cipherMODE.CBC:
            self.IV = modes.CTR(IV)
        else:
            raise Exception('Unknown cipher mode!')

        self.key = key
        """ TODO padding
		if self.padMode is not None:
		"""

        self.encryptor = None
        self.decryptor = None
        symmetricBASE.__init__(self)
Пример #3
0
	def __init__(self, key, mode = cipherMODE.ECB, IV = None):
		self.key = key
		if len(key) == 7:
			self.key = __expand_DES_key(key)

		self.mode = mode
		self.IV = IV
		symmetricBASE.__init__(self)
Пример #4
0
    def __init__(self,
                 key,
                 mode=cipherMODE.ECB,
                 IV=None,
                 pad=None,
                 padMode=None):
        self.key = key
        self.mode = mode
        self.IV = IV
        self.pad = pad
        self.padMode = padMode

        symmetricBASE.__init__(self)
Пример #5
0
    def __init__(self,
                 key,
                 mode=cipherMODE.ECB,
                 IV=None,
                 pad=None,
                 padMode=None):
        symmetricBASE.__init__(self)
        if not isinstance(key, bytes):
            raise Exception('Key needs to be bytes!')

        self.mode = mode
        self.IV = IV
        self.pad = pad
        self.padMode = padMode
Пример #6
0
    def __init__(self,
                 key,
                 mode=cipherMODE.ECB,
                 IV=None,
                 pad=None,
                 padMode=None):
        if not isinstance(key, bytes):
            raise Exception('Key needs to be bytes!')
        self.IV = IV
        if mode == cipherMode.ECB:
            self.IV = modes.ECB()
        elif mode == cipherMODE.CBC:
            self.IV = modes.CBC(IV)
        else:
            raise Exception('Unknown cipher mode!')
        self.key = key
        """ TODO padding
		if self.padMode is not None:
		"""

        self.encryptor = None
        self.decryptor = None
        symmetricBASE.__init__(self)
Пример #7
0
	def __init__(self, key):
		self.key = key
		symmetricBASE.__init__(self)