crypto_stash.py 文件源码

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

项目:sstash 作者: realcr 项目源码 文件源码
def read_store(self):
        """
        Get the store from file.
        """
        with open(self._path,'r',encoding='ascii') as fr:
            outer_data = json.load(fr)

        try:
            validate(outer_data,OUTER_SCHEMA)
        except ValidationError:
            raise SSError("Invalid outer schema")

        enc_bytes = hex_str_to_bytes(outer_data["enc_blob"])
        try:
            inner_data = self._box.decrypt(enc_bytes)
        except nacl.exceptions.CryptoError:
            raise SSCryptoError("Wrong password")

        return json.loads(inner_data.decode('utf-8'))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号