def checkKeys(srvState):
 assert ((srvState.hmacKey is not None) and (srvState.aesKey is not None) and (srvState.keyCreation is not None))
 if ((int(time.time()) - srvState.keyCreation) > const.KEY_ROTATION_TIME):
  log.info('Rotating server key material for session tickets.')
  srvState.oldAesKey = srvState.aesKey
  srvState.oldHmacKey = srvState.hmacKey
  srvState.aesKey = mycrypto.strongRandom(const.TICKET_AES_KEY_LENGTH)
  srvState.hmacKey = mycrypto.strongRandom(const.TICKET_HMAC_KEY_LENGTH)
  srvState.keyCreation = int(time.time())
  srvState.writeState()

def checkKeys ( srvState ) : assert ( ( srvState . hmacKey is not None ) and ( srvState . aesKey is not None ) and ( srvState . keyCreation is not None ) ) if ( ( int ( time . time ( ) ) - srvState . keyCreation ) > const . KEY_ROTATION_TIME ) : log . info ( 'Rotating server key material for session tickets.' ) srvState . oldAesKey = srvState . aesKey srvState . oldHmacKey = srvState . hmacKey srvState . aesKey = mycrypto . strongRandom ( const . TICKET_AES_KEY_LENGTH ) srvState . hmacKey = mycrypto . strongRandom ( const . TICKET_HMAC_KEY_LENGTH ) srvState . keyCreation = int ( time . time ( ) ) srvState . writeState ( )
check whether the key material for session tickets must be rotated .