使用Windows Crypto API进行Windows 2000和Windows 2003 RC2加密/解密?

时间:2022-01-23 18:30:47

Our app encrypts a value using RC2 in C++ code and I wrote a decryption routine in .NET

我们的应用程序使用C ++代码中的RC2加密值,我在.NET中编写了一个解密例程

The problem is that it works fine on our dev server, which is Windows 2003 but fails on the Windows 2000 one. It's running the same code and I checked everything else and it seems there are differences in the way the 2 encrypt.

问题是它在我们的开发服务器上工作正常,它是Windows 2003但在Windows 2000上失败了。它运行相同的代码,我检查了其他一切,似乎2加密的方式有所不同。

Has anyone had any experience with that?

有没有人有过这方面的经验?

3 个解决方案

#1


1  

  1. Make sure Windows 2000 has SP3, or encryption is far less likely to work, particularly if using Capicom (or the api it wraps).
  2. 确保Windows 2000具有SP3,或者加密的可能性要小得多,特别是在使用Capicom(或api it wraps)时。

  3. Not all of the encryption algorithms and keylengths are supported on Windows 2000 if using Capicom (or the api it wraps).
  4. 如果使用Capicom(或api it wraps),并非Windows 2000都支持所有加密算法和密钥长度。

#2


0  

There's an obscure issue with win2000/winxp encryption/decryption. The Cryptography Service Provider on win2000 has 40 for the effective key length and that's used by default even if you use a 128 bit key. So to fix that you have to manually reset the effective key length on 2000 or you can set it to 40 before you decrypt on the winxp (or win2003 in my case).

win2000 / winxp加密/解密存在一个模糊的问题。 win2000上的加密服务提供程序有效密钥长度为40,即使您使用128位密钥也默认使用。所以要修复你必须在2000上手动重置有效密钥长度,或者你可以在解密winxp(或我的情况下为win2003)之前将其设置为40。

If you're using C# to decrypt you can't set the effective key size to something different than the key size if you use the RC2CryptoServiceProvider class.

如果您使用C#进行解密,则在使用RC2CryptoServiceProvider类时,无法将有效密钥大小设置为与密钥大小不同的大小。

#3


0  

I have face the same problem between XP SP1 and XP SP2 using crypto service provider, the encrypted value is different for 1 particular crypto which I can't recall at the moment.

我使用加密服务提供程序在XP SP1和XP SP2之间遇到了同样的问题,加密值对于1个特定的加密是不同的,我现在不记得了。

#1


1  

  1. Make sure Windows 2000 has SP3, or encryption is far less likely to work, particularly if using Capicom (or the api it wraps).
  2. 确保Windows 2000具有SP3,或者加密的可能性要小得多,特别是在使用Capicom(或api it wraps)时。

  3. Not all of the encryption algorithms and keylengths are supported on Windows 2000 if using Capicom (or the api it wraps).
  4. 如果使用Capicom(或api it wraps),并非Windows 2000都支持所有加密算法和密钥长度。

#2


0  

There's an obscure issue with win2000/winxp encryption/decryption. The Cryptography Service Provider on win2000 has 40 for the effective key length and that's used by default even if you use a 128 bit key. So to fix that you have to manually reset the effective key length on 2000 or you can set it to 40 before you decrypt on the winxp (or win2003 in my case).

win2000 / winxp加密/解密存在一个模糊的问题。 win2000上的加密服务提供程序有效密钥长度为40,即使您使用128位密钥也默认使用。所以要修复你必须在2000上手动重置有效密钥长度,或者你可以在解密winxp(或我的情况下为win2003)之前将其设置为40。

If you're using C# to decrypt you can't set the effective key size to something different than the key size if you use the RC2CryptoServiceProvider class.

如果您使用C#进行解密,则在使用RC2CryptoServiceProvider类时,无法将有效密钥大小设置为与密钥大小不同的大小。

#3


0  

I have face the same problem between XP SP1 and XP SP2 using crypto service provider, the encrypted value is different for 1 particular crypto which I can't recall at the moment.

我使用加密服务提供程序在XP SP1和XP SP2之间遇到了同样的问题,加密值对于1个特定的加密是不同的,我现在不记得了。