sso.py 文件源码

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

项目:deb-python-pyvmomi 作者: openstack 项目源码 文件源码
def _sign(private_key, data):
    '''
    An internal helper method to sign the 'data' with the 'private_key'.

    @type  private_key: C{str}
    @param private_key: The private key used to sign the 'data', in one of
                        supported formats.
    @type         data: C{str}
    @param        data: The data that needs to be signed.

    @rtype: C{str}
    @return: Signed string.
    '''
    # Convert private key in arbitrary format into DER (DER is binary format
    # so we get rid of \n / \r\n differences, and line breaks in PEM).
    pkey = _load_private_key(_extract_certificate(private_key))
    return base64.b64encode(crypto.sign(pkey, data, 'sha256'))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号