crypt.py 文件源码

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

项目:sndlatr 作者: Schibum 项目源码 文件源码
def from_string(key_pem, is_x509_cert):
      """Construct a Verified instance from a string.

      Args:
        key_pem: string, public key in PEM format.
        is_x509_cert: bool, True if key_pem is an X509 cert, otherwise it is
          expected to be an RSA key in PEM format.

      Returns:
        Verifier instance.

      Raises:
        NotImplementedError if is_x509_cert is true.
      """
      if is_x509_cert:
        # raise NotImplementedError(
        #     'X509 certs are not supported by the PyCrypto library. '
        #     'Try using PyOpenSSL if native code is an option.')
        key_pem = x509.get_pubkey(key_pem)
      pubkey = RSA.importKey(key_pem)
      return PyCryptoVerifier(pubkey)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号