如何使用RijndaelManaged加密vb.net中的字符串,并使用PKCS5填充? [英] How do I encrypt a string in vb.net using RijndaelManaged, and using PKCS5 padding?

查看:324
本文介绍了如何使用RijndaelManaged加密vb.net中的字符串,并使用PKCS5填充?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下代码初始化加密...

I use the following code to initialize encryption...

 Dim symmetricKey As New System.Security.Cryptography.RijndaelManaged()
 With symmetricKey
   .Key = Encoding.ASCII.GetBytes(Key)
   .IV = Encoding.ASCII.GetBytes(IV)
   .Mode = CipherMode.CBC
   .BlockSize = 128 
   .KeySize = 128 
   .Padding = PaddingMode.PKCS7
End With

要求是使用PKCS5。 vb.net中的填充模式只包括

The requirement is to use PKCS5. Padding modes in vb.net only include


  • ANSIX923

  • ISO10126


  • PKCS7

  • 零点

  • ANSIX923
  • ISO10126
  • None
  • PKCS7
  • Zeros

所以我不认为PKCS5有一个方法。有没有办法添加,还是需要自己编写加密方法?如果是这样 - 怎么写?有没有可靠的DLL支持它?

So I don't think there is a method for PKCS5. Is there any way to add it, or do I need to write an encryption method myself? If so - how do I write that? Is there a reliable DLL that will support it?

推荐答案

PKCS7填充和PKCS5填充是一回事。在这种情况下,它们是同义词。

PKCS7 padding and PKCS5 padding are the same thing. In this context they are synonyms.

编辑:

PKCS#7填充在第10.3节中的PKCS#7规范。 PKCS#5填充在6.1.1节中的 PKCS#5规范中有描述通过考试可以看出,填充算法是一样的。

The PKCS#7 padding is described in the PKCS#7 spec in section 10.3. PKCS#5 padding is described in the PKCS#5 spec in section 6.1.1 step 4. As you can see by examination, the padding algorithms are identical.

这篇关于如何使用RijndaelManaged加密vb.net中的字符串,并使用PKCS5填充?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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