AES 加密。从 Python (pyCrypto) 到 .NET

发布于 2024-09-04 04:58:44 字数 342 浏览 2 评论 0原文

我目前正在尝试将旧版 Python 应用程序移植到 .NET,其中包含使用我可以告诉 pyCrpyto 的 AES 加密。我的 Python 和加密经验非常有限。该代码使用下一页中的代码片段。 我

到目前为止,我相信 我们已经设法解决它,它使用 AES 调用 Crypto.Cipher,并将密钥的前 32 个字符作为密码,但没有模式或 IV。当加密文本添加到数据库时,它还会在其上添加前缀。

我不知道如何解密 .NET 中现有的加密数据库记录。我一直在查看 RijndaelManaged 但它需要 IV 并且在 python 中看不到任何对 IV 的引用。

谁能告诉我在 .NET 中可以使用什么方法来获得所需的结果。

I am currently trying to port a legacy Python app over to .NET which contains AES encrpytion using from what I can tell pyCrpyto. I have very limited Python and Crypto experience. The code uses the snippet from the following page. http://www.djangosnippets.org/snippets/1095/

So far I believe I have managed to work out that it that it calls Crypto.Cipher with AES and the first 32 character of our secret key as the password, but no mode or IV. It also puts a prefix on the encrpyed text when it is added to database.

What I can't work out is how I can decrypt the existing ecrypted database records in .NET. I have been looking at RijndaelManaged but it requires an IV and can't see any reference to one in python.

Can anyone point me in the dirrection to what method could be used in .NET to get the desired result.

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

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

发布评论

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

评论(1

面犯桃花 2024-09-11 04:58:44

AES(和 Rijndael)需要模式和 IV。 IV 可能是一个由零组成的向量,但它仍然是一个 IV。模式可能没有明确指定...但如果它使用 AES,则仍然存在一种模式。

尝试这个答案来了解一些背景:
在 Ruby/Python 中使用哪个 AES 库?

AES (and Rijndael) requires a mode and an IV. The IV may be a vector of zeroes, but it is still an IV. the mode may not be explicitly specified... but if it's using AES, there's still a mode.

Try this answer for some background:
Which AES library to use in Ruby/Python?

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