__init__.py 文件源码

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

项目:Tktr 作者: Intuity 项目源码 文件源码
def verifySignature(self):
        key = RSA.importKey(open(self.raven_public_key).read())

        # Compile the parts to hash together
        parts = self.rav_str.split("!")
        parts.pop() # Remove the last two items related to signing
        parts.pop()
        to_hash = "!".join(parts)
        # Now hash it and verify
        our_hash = SHA.new(to_hash)
        #print our_hash
        verifier = PKCS1_v1_5.new(key)
        # Obtain the correct form of the signature
        signature = urllib.unquote(self.raven_signature)
        signature = signature.replace("-","+")
        signature = signature.replace(".","/")
        signature = signature.replace("_","=")
        signature = base64.b64decode(signature)
        if verifier.verify(our_hash, signature):
            return True
        else:
            return False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号