0

This is the code from my VB6 app using CAPICOM

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)

but I need to convert the same functionality to VB.NET. Is there an equivalent to get the same values?

RichC
  • 7,829
  • 21
  • 85
  • 149

2 Answers2

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).

Kris Oye
  • 1,158
  • 14
  • 27
0

As a start, look at the System.Security.Cryptography namespace. You'll find relevant classes there, include the TripleDES class.

President James K. Polk
  • 40,516
  • 21
  • 95
  • 125
  • 1
    Why is this considered a complete/accepted answer? It's EASY to find the classes, but how do you ensure that the 3DES IV and Key are initialized in the .NET equivalent code to decrypt a value previously encrypted in VB6? – Kris Oye Sep 01 '15 at 19:18
  • @KrisOye: The question was vague, so the answer is broad. – President James K. Polk Sep 01 '15 at 22:39