generate_passwords.py 文件源码

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

项目:kolla-kubernetes 作者: openstack 项目源码 文件源码
def generate_RSA(bits=4096):
    # public_exponent set to 655537 is what pyCA recommends
    new_key = rsa.generate_private_key(public_exponent=65537,
                                       key_size=bits,
                                       backend=default_backend())
    # we strip trailing space for 1:1 compat with previous implementation
    private_key = new_key.private_bytes(
        encoding=Encoding.PEM,
        format=PrivateFormat.PKCS8,
        encryption_algorithm=NoEncryption())
    public_key = new_key.public_key().public_bytes(encoding=Encoding.OpenSSH,
                                                   format=PublicFormat.OpenSSH)
    return private_key, public_key
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号