python类PKCS1v15()的实例源码

travis_pypi_setup.py 文件源码 项目:logzero 作者: metachris 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def encrypt(pubkey, password):
    """Encrypt password using given RSA public key and encode it with base64.

    The encrypted password can only be decrypted by someone with the
    private key (in this case, only Travis).
    """
    key = load_key(pubkey)
    encrypted_password = key.encrypt(password, PKCS1v15())
    return base64.b64encode(encrypted_password)
travis_pypi_setup.py 文件源码 项目:modparc 作者: xie-dongping 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def encrypt(pubkey, password):
    """Encrypt password using given RSA public key and encode it with base64.

    The encrypted password can only be decrypted by someone with the
    private key (in this case, only Travis).
    """
    key = load_key(pubkey)
    encrypted_password = key.encrypt(password, PKCS1v15())
    return base64.b64encode(encrypted_password)
travis_pypi_setup.py 文件源码 项目:validus 作者: shopnilsazal 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def encrypt(pubkey, password):
    """Encrypt password using given RSA public key and encode it with base64.

    The encrypted password can only be decrypted by someone with the
    private key (in this case, only Travis).
    """
    key = load_key(pubkey)
    encrypted_password = key.encrypt(password, PKCS1v15())
    return base64.b64encode(encrypted_password)
travis_pypi_setup.py 文件源码 项目:proxyguy 作者: yudori 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def encrypt(pubkey, password):
    """Encrypt password using given RSA public key and encode it with base64.

    The encrypted password can only be decrypted by someone with the
    private key (in this case, only Travis).
    """
    key = load_key(pubkey)
    encrypted_password = key.encrypt(password, PKCS1v15())
    return base64.b64encode(encrypted_password)
travis_pypi_setup.py 文件源码 项目:hydrofunctions 作者: mroberge 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def encrypt(pubkey, password):
    """Encrypt password using given RSA public key and encode it with base64.

    The encrypted password can only be decrypted by someone with the
    private key (in this case, only Travis).
    """
    key = load_key(pubkey)
    encrypted_password = key.encrypt(password, PKCS1v15())
    return base64.b64encode(encrypted_password)
travis_pypi_setup.py 文件源码 项目:sql-assurance 作者: sql-assurance 项目源码 文件源码 阅读 34 收藏 0 点赞 0 评论 0
def encrypt(pubkey, password):
    """Encrypt password using given RSA public key and encode it with base64.

    The encrypted password can only be decrypted by someone with the
    private key (in this case, only Travis).
    """
    key = load_key(pubkey)
    encrypted_password = key.encrypt(password, PKCS1v15())
    return base64.b64encode(encrypted_password)
travis_pypi_setup.py 文件源码 项目:requests-staticmock 作者: tonybaloney 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def encrypt(pubkey, password):
    """Encrypt password using given RSA public key and encode it with base64.

    The encrypted password can only be decrypted by someone with the
    private key (in this case, only Travis).
    """
    key = load_key(pubkey)
    encrypted_password = key.encrypt(password, PKCS1v15())
    return base64.b64encode(encrypted_password)
travis_pypi_setup.py 文件源码 项目:inferno 作者: inferno-pytorch 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def encrypt(pubkey, password):
    """Encrypt password using given RSA public key and encode it with base64.

    The encrypted password can only be decrypted by someone with the
    private key (in this case, only Travis).
    """
    key = load_key(pubkey)
    encrypted_password = key.encrypt(password, PKCS1v15())
    return base64.b64encode(encrypted_password)
api_client.py 文件源码 项目:Complete-Bunq-API-Python-Wrapper 作者: PJUllrich 项目源码 文件源码 阅读 32 收藏 0 点赞 0 评论 0
def verify(self, res):
        """Verify response from server
        Taken from https://github.com/madeddie/python-bunq - Thanks!

        :param res: request to be verified
        :type res: requests.models.Response

        """
        if not self.server_pubkey:
            print('No server public key defined, skipping verification')
            return

        serv_headers = [
            'X-Bunq-Client-Request-Id',
            'X-Bunq-Client-Response-Id'
        ]

        msg = '%s\n%s\n\n%s' % (
            res.status_code,
            '\n'.join(
                ['%s: %s' % (k, v) for k, v in sorted(
                    res.headers.items()
                ) if k in serv_headers]
            ),
            res.text
        )

        signature = base64.b64decode(res.headers['X-Bunq-Server-Signature'])

        try:
            self.server_pubkey_pem.verify(
                signature,
                msg.encode(),
                padding.PKCS1v15(),
                hashes.SHA256()
            )
        except InvalidSignature:
            print('Message failed verification, data might be tampered with')
            return False
        else:
            return True
travis_pypi_setup.py 文件源码 项目:scarlett_os 作者: bossjones 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def encrypt(pubkey, password):
    """Encrypt password using given RSA public key and encode it with base64.

    The encrypted password can only be decrypted by someone with the
    private key (in this case, only Travis).
    """
    key = load_key(pubkey)
    encrypted_password = key.encrypt(password, PKCS1v15())
    return base64.b64encode(encrypted_password)
dkim.py 文件源码 项目:isthislegit 作者: duo-labs 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def sign(self, message):
        canonicalization = NoFWSCanonicalization()
        signer = self._key.signer(padding.PKCS1v15(), hashes.SHA1())

        headers, body = _rfc822_parse(message)

        h_field = []
        for header, value in headers:
            if self._signed_headers is None or header in self._signed_headers:
                h_field.append(header)

                header, value = canonicalization.canonicalize_header(
                    header, value)
                signer.update(header)
                signer.update(b":")
                signer.update(value)
        body = canonicalization.canonicalize_body(body)
        if body:
            signer.update(b"\r\n")
            signer.update(body)

        return _fold(
            b"DomainKey-Signature: a=rsa-sha1; c=nofws; d={domain}; "
            b"s={selector}; q=dns; h={headers}; b={signature}".format(
                domain=self._domain,
                selector=self._selector,
                headers=b": ".join(h_field),
                signature=base64.b64encode(signer.finalize())
            )) + b"\r\n"
travis_pypi_setup.py 文件源码 项目:pyramid_sms 作者: websauna 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def encrypt(pubkey, password):
    """Encrypt password using given RSA public key and encode it with base64.

    The encrypted password can only be decrypted by someone with the
    private key (in this case, only Travis).
    """
    key = load_key(pubkey)
    encrypted_password = key.encrypt(password, PKCS1v15())
    return base64.b64encode(encrypted_password)
travis_pypi_setup.py 文件源码 项目:annots 作者: Infernion 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def encrypt(pubkey, password):
    """Encrypt password using given RSA public key and encode it with base64.

    The encrypted password can only be decrypted by someone with the
    private key (in this case, only Travis).
    """
    key = load_key(pubkey)
    encrypted_password = key.encrypt(password, PKCS1v15())
    return base64.b64encode(encrypted_password)
travis_pypi_setup.py 文件源码 项目:epos-xml 作者: solvire 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def encrypt(pubkey, password):
    """Encrypt password using given RSA public key and encode it with base64.

    The encrypted password can only be decrypted by someone with the
    private key (in this case, only Travis).
    """
    key = load_key(pubkey)
    encrypted_password = key.encrypt(password, PKCS1v15())
    return base64.b64encode(encrypted_password)
travis_pypi_setup.py 文件源码 项目:wavefront_reader 作者: neuroneuro15 项目源码 文件源码 阅读 33 收藏 0 点赞 0 评论 0
def encrypt(pubkey, password):
    """Encrypt password using given RSA public key and encode it with base64.

    The encrypted password can only be decrypted by someone with the
    private key (in this case, only Travis).
    """
    key = load_key(pubkey)
    encrypted_password = key.encrypt(password, PKCS1v15())
    return base64.b64encode(encrypted_password)
travis_pypi_setup.py 文件源码 项目:aiohttp_swaggerify 作者: dchaplinsky 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def encrypt(pubkey, password):
    """Encrypt password using given RSA public key and encode it with base64.

    The encrypted password can only be decrypted by someone with the
    private key (in this case, only Travis).
    """
    key = load_key(pubkey)
    encrypted_password = key.encrypt(password, PKCS1v15())
    return base64.b64encode(encrypted_password)
travis_pypi_setup.py 文件源码 项目:kodiak 作者: alejandrodumas 项目源码 文件源码 阅读 37 收藏 0 点赞 0 评论 0
def encrypt(pubkey, password):
    """Encrypt password using given RSA public key and encode it with base64.

    The encrypted password can only be decrypted by someone with the
    private key (in this case, only Travis).
    """
    key = load_key(pubkey)
    encrypted_password = key.encrypt(password, PKCS1v15())
    return base64.b64encode(encrypted_password)
travis_pypi_setup.py 文件源码 项目:MLBox 作者: AxeldeRomblay 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def encrypt(pubkey, password):
    """Encrypt password using given RSA public key and encode it with base64.

    The encrypted password can only be decrypted by someone with the
    private key (in this case, only Travis).
    """
    key = load_key(pubkey)
    encrypted_password = key.encrypt(password, PKCS1v15())
    return base64.b64encode(encrypted_password)
travis_pypi_setup.py 文件源码 项目:predictive_imputer 作者: log0ymxm 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def encrypt(pubkey, password):
    """Encrypt password using given RSA public key and encode it with base64.

    The encrypted password can only be decrypted by someone with the
    private key (in this case, only Travis).
    """
    key = load_key(pubkey)
    encrypted_password = key.encrypt(password, PKCS1v15())
    return base64.b64encode(encrypted_password)
travis_pypi_setup.py 文件源码 项目:stf-selector 作者: RedQA 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def encrypt(pubkey, password):
    """Encrypt password using given RSA public key and encode it with base64.

    The encrypted password can only be decrypted by someone with the
    private key (in this case, only Travis).
    """
    key = load_key(pubkey)
    encrypted_password = key.encrypt(password, PKCS1v15())
    return base64.b64encode(encrypted_password)


问题


面经


文章

微信
公众号

扫码关注公众号