DPAPI加密与my.settings不兼容 [英] DPAPI encryption not working so well with my.settings

查看:232
本文介绍了DPAPI加密与my.settings不兼容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当my.settings.datastorage没有任何内容时,这样可以正常工作。但是在我经历了两次之后,它给了我一个错误

when my.settings.datastorage has nothing in it, this works fine. but after i go through this twice, it gives me an error

total_string = "some string"
My.Settings.datastorage = My.Settings.datastorage & DPAPI.Encrypt(total_string)
My.Settings.Save()
MsgBox(DPAPI.Decrypt(My.Settings.datastorage))

这是它给出的错误:

Base-64字符串中的字符无效。

"Invalid character in a Base-64 string."

推荐答案

您不能简单地将加密字符串连接到& amp;;如果您以后要解码它们,则不能。为了添加信息,您必须解码您已经拥有的信息,将清晰的文本合并到编码中。

You can't simply concatenate encrypted strings with &, not if you want to decode them later anyway. In order to Add information you'll have to decode what you've already got, combine the clear text en encode the total.

这篇关于DPAPI加密与my.settings不兼容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆