Exemplo n.º 1
0
    def useSharedSecret(self, obj):

        # validate shared secret input
        if(self.shared_secret_value.text != ''):
            self.shared_secret_value.disabled = True

            # use hashed shared secret as key for mutual authentication
            self.shared_secret_hash = md5.new(self.shared_secret_value.text).digest()
            self.mutual_auth = MutualAuth(self.shared_secret_hash, self.mode)
        else:
            self.console.text = self.console.text + "\nERROR: Please enter a shared secret."
            print "ERROR: Please enter a shared secret."
            return
        
        # on success 
        if(self.mutualAuthentication()):    
            self.key_estabilshment_inprogress = False
            self.send_data_button.disabled = False
            self.send_secret_button.disabled = True

            # initialize the CBC cipher
            key = md5.new(str(self.total_session_key)).digest()
            self.cipher = CBC.generateCBC(key)

            # start up thread for receiving incoming messages
            threading.Thread(target=self.messageReceivingService).start()

            # in server, start up thread to periodically refresh session key
            if(self.mode == 'server'):
                threading.Thread(target=self.updateSessionKeyService).start()
Exemplo n.º 2
0
Arquivo: main.py Projeto: iim/442VPN
    def useSharedSecret(self, obj):

        # validate shared secret input
        if (self.shared_secret_value.text != ''):
            self.shared_secret_value.disabled = True

            # use hashed shared secret as key for mutual authentication
            self.shared_secret_hash = md5.new(
                self.shared_secret_value.text).digest()
            self.mutual_auth = MutualAuth(self.shared_secret_hash, self.mode)
        else:
            self.console.text = self.console.text + "\nERROR: Please enter a shared secret."
            print "ERROR: Please enter a shared secret."
            return

        # on success
        if (self.mutualAuthentication()):
            self.key_estabilshment_inprogress = False
            self.send_data_button.disabled = False
            self.send_secret_button.disabled = True

            # initialize the CBC cipher
            key = md5.new(str(self.total_session_key)).digest()
            self.cipher = CBC.generateCBC(key)

            # start up thread for receiving incoming messages
            threading.Thread(target=self.messageReceivingService).start()

            # in server, start up thread to periodically refresh session key
            if (self.mode == 'server'):
                threading.Thread(target=self.updateSessionKeyService).start()
Exemplo n.º 3
0
	def setUp(self):
		iv = cbc.generateIV()
		key = cbc.generateKey()
		self.encryptCipher = cbc.generateCBC(key,iv)
		self.decryptCipher = cbc.generateCBC(key,iv)
Exemplo n.º 4
0
 def setUp(self):
     iv = cbc.generateIV()
     key = cbc.generateKey()
     self.encryptCipher = cbc.generateCBC(key, iv)
     self.decryptCipher = cbc.generateCBC(key, iv)