Windows.py 文件源码

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

项目:keyrings.alt 作者: jaraco 项目源码 文件源码
def set_password(self, service, username, password):
        """Write the password to the registry
        """
        # encrypt the password
        password_encrypted = _win_crypto.encrypt(password.encode('utf-8'))
        # encode with base64
        password_base64 = base64.encodestring(password_encrypted)
        # encode again to unicode
        password_saved = password_base64.decode('ascii')

        # store the password
        key_name = r'Software\%s\Keyring' % service
        hkey = winreg.CreateKey(winreg.HKEY_CURRENT_USER, key_name)
        winreg.SetValueEx(hkey, username, 0, winreg.REG_SZ, password_saved)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号