Differences between CAPICOM TripleDES and System.Security.Cryptography TripleDES

I am trying to move away from using CAPICOM since I can no longer use it (64-bit Windows 7 machine).

The existing code for using TripleDES is as follows:

EncryptedDataClass cryptic = new EncryptedDataClass();
cryptic.Algorithm.Name = CAPICOM_ENCRYPTION_ALGORITHM.CAPICOM_ENCRYPTION_ALGORITHM_3DES;
cryptic.SetSecret(secretKey, CAPICOM_SECRET_TYPE.CAPICOM_SECRET_PASSWORD);
cryptic.Content = stringToEncrypt;
encryptedString = cryptic.Encrypt(CAPICOM_ENCODING_TYPE.CAPICOM_ENCODE_ANY);

The only information provided for encryption is secretKey. And secretKey is about ten bytes. Is there a way to use the .NET class for the same encryption. Note. This is used to test the connection to a web service that will still use CAPICOM. Any help or ideas are appreciated.

+3
source share
3 answers

SetSecret is not the key!

from MSDN:

CAPICOM_SECRET_TYPE

CAPICOM_SECRET_TYPE , , / .

CAPICOM_SECRET_PASSWORD .

+1

, , CAPICOM 64- :

  • [windows]\syswow64
  • ( , regsvr32 capicon.dll)
0

CAPICOM 32- 64- (). script, 32- cscript.exe wscript.exe. :

c:\windows\sysWOW64\cscript.exe "c:\path\to\script.wsf"

c:\windows\sysWOW64\cscript.exe "c:\path\to\another\vbscript.vbs"

, .

In addition, this answer contains the surrogate registration procedure for CAPICOM, so it can be used from 64-bit processes (including a 64-bit script).

I really did this to use CAPICOM with 64-bit SQL Server and it works fine.

0
source

Source: https://habr.com/ru/post/1755546/


All Articles