keypair.py 文件源码

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

项目:constantina 作者: wwoast 项目源码 文件源码
def __age_keypair(self, source_id, dest_id):
        """
        Migrate a signing key and an encryption key from the source_id slot
        into the dest_id slot. Afterwards, the source slot gets a new keypair.
        """
        for key_type in ["sign", "encrypt"]:
            section = key_type + "_" + source_id
            if not self.config.has_section(section):
                self.__create_slotpair(source_id)
            # If keypair is malformed, just make a new one
            # Then there will be no need to age it
            if self.config.get(section, "date") == '':
                self.__regen_keypair(source_id)
                break
            else:
                keydate = self.config.getint(section, "date")
                # syslog.syslog("age id %s keydate: %s expiry: %s"
                #              % (source_id, str(keydate), str(keydate + self.lifetime)))
                if self.time > (keydate + self.sunset):
                    syslog.syslog("aging keyid " + source_id + " into " + dest_id)
                    self.__age_key(key_type, source_id, dest_id)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号