pkey.py 文件源码

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

项目:RemoteTree 作者: deNULL 项目源码 文件源码
def _write_private_key_file(self, filename, key, format, password=None):
        """
        Write an SSH2-format private key file in a form that can be read by
        paramiko or openssh.  If no password is given, the key is written in
        a trivially-encoded format (base64) which is completely insecure.  If
        a password is given, DES-EDE3-CBC is used.

        :param str tag:
            ``"RSA"`` or ``"DSA"``, the tag used to mark the data block.
        :param filename: name of the file to write.
        :param str data: data blob that makes up the private key.
        :param str password: an optional password to use to encrypt the file.

        :raises: ``IOError`` -- if there was an error writing the file.
        """
        with open(filename, 'w') as f:
            os.chmod(filename, o600)
            self._write_private_key(f, key, format, password=password)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号