api.py 文件源码

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

项目:nucypher-kms 作者: nucypher 项目源码 文件源码
def ecies_priv2pub(
        privkey: Union[bytes, elliptic_curve.ec_element],
        to_bytes: bool = True
) -> Union[bytes, elliptic_curve.ec_element]:
    """
    Takes a private key (secret bytes or an elliptic_curve.ec_element) and
    derives the Public key from it.

    :param privkey: The Private key to derive the public key from
    :param to_bytes: Return the byte serialization of the pubkey?

    :return: The Public component of the Private key provided
    """
    if type(privkey) == bytes:
        privkey = priv_bytes2ec(privkey)

    pubkey = PRE.priv2pub(privkey)
    if to_bytes:
        return elliptic_curve.serialize(pubkey)[1:]
    return pubkey
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号