예제 #1
0
 def _mastertoken_checks(self):
     """Perform checks to the MasterToken and executes a new key handshake when necessary"""
     is_handshake_required = False
     if self.crypto.mastertoken:
         if self.crypto.is_current_mastertoken_expired():
             LOG.debug(
                 'Stored MSL MasterToken is expired, a new key handshake will be performed'
             )
             is_handshake_required = True
         else:
             # Check if the current ESN is same of ESN bound to MasterToken
             if get_esn() != self.crypto.bound_esn:
                 LOG.debug(
                     'Stored MSL MasterToken is bound to a different ESN, '
                     'a new key handshake will be performed')
                 is_handshake_required = True
     else:
         LOG.debug(
             'MSL MasterToken is not available, a new key handshake will be performed'
         )
         is_handshake_required = True
     if is_handshake_required:
         if self.perform_key_handshake():
             msl_data = json.loads(common.load_file_def(MSL_DATA_FILENAME))
             self.crypto.load_msl_data(msl_data)
             self.crypto.load_crypto_session(msl_data)
예제 #2
0
 def _init_msl_handler(self):
     self.msl_requests = None
     try:
         msl_data = json.loads(common.load_file_def(MSL_DATA_FILENAME))
         LOG.info('Loaded MSL data from disk')
     except Exception:  # pylint: disable=broad-except
         msl_data = None
     self.msl_requests = MSLRequests(msl_data)
     self.switch_events_handler()