如何将CAPICOM转换为.NET等效项

时间:2011-01-05 21:21:51

标签: vb.net encryption capicom

这是我使用CAPICOM的VB6应用程序的代码

Set ed = New EncryptedData
ed.Algorithm = CAPICOM_ENCRYPTION_ALGORITHM_3DES
ed.SetSecret mySecret, CAPICOM_SECRET_PASSWORD
ed.Content = myText
myResult = ed.Encrypt(CAPICOM_ENCODE_BINARY)

但我需要将相同的功能转换为VB.NET。是否有相同的值来获得相同的值?

2 个答案:

答案 0 :(得分:1)

I went down this road, too. I made various attempts to decrypt data from VB6/CAPICOM using the crypto namespaces James mentioned above (without any luck).

According to the MS documentation, I am given the impression it is not possible to migrate your code to anything other than a P/Invoke call to the CAPI library. If you find yourself doing this, you might be better served creating a migration tool that decrypts using CAPI and then encrypts/exports the data using an open standard (sounds like CAPI is/will be deprecated).

答案 1 :(得分:0)

首先,查看System.Security.Cryptography命名空间。你会在那里找到相关的课程,包括TripleDES课程。