x509.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:RPKI-toolkit 作者: pavel-odintsov 项目源码 文件源码
def check_auto_update(self):
    """
    Check for updates to a DER object that auto-updates from a file.
    """
    if self.filename is None:
      return
    try:
      filename = self.filename
      timestamp = os.stat(self.filename).st_mtime
      if self.timestamp is None or self.timestamp < timestamp:
        logger.debug("Updating %s, timestamp %s",
                     filename, rpki.sundial.datetime.fromtimestamp(timestamp))
        f = open(filename, "rb")
        value = f.read()
        f.close()
        self.clear()
        if looks_like_PEM(value):
          self._set_PEM(value)
        else:
          self.DER = value
        self.filename = filename
        self.timestamp = timestamp
    except (IOError, OSError), e:
      now = rpki.sundial.now()
      if self.lastfail is None or now > self.lastfail + self.failure_threshold:
        logger.warning("Could not auto_update %r (last failure %s): %s", self, self.lastfail, e)
      self.lastfail = now
    else:
      self.lastfail = None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号