如何包装/存储 TripleDESCryptoServiceProvider 的密钥

发布于 2024-07-29 02:32:52 字数 254 浏览 2 评论 0原文

我正在使用 DES 加密,并且我想存储 TripleDESCryptoServiceProvider 的密钥。

但密钥由 (Key + IV) 组成,

我试图将它们保存在 XML 文件中,

XmlTextWriter
Convert.ToBase64String(...)

但由于 IV 在 XML 中包含无效字符“=”而出现异常。

有没有更好的方法来存储对称加密密钥?

I'm using DES encryption, and I want to store the key of TripleDESCryptoServiceProvider.

But the key consists of (Key + IV),

I was trying to save them in an XML file using

XmlTextWriter
Convert.ToBase64String(...)

but there was an exception due to IV contains invalid characters "=" in XML.

Is there a better way to store symmetric cryptography key ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

静待花开 2024-08-05 02:32:52

如果使用 WriteCData 方法

You can store it in XML if you put it into a CDATA section using the WriteCData method

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文