views:

336

answers:

2

I have a database that encrypted with windows CAPICOM library with RC4. Following PHP script works fine on windows server.

    ...
$oCapiCapi = new COM("CAPICOM.EncryptedData");
$oCapiCapi -> Algorithm = 1;
$oCapiCapi -> Algorithm -> KeyLength = 3;
$oCapiCapi -> SetSecret('OURveRYSecretKey');
    ...
 $oCapiCapi -> Decrypt($orsd[1]);
 $Decrypted = $oCapiCapi -> Content;
    ...

I would like to decrypt the same database on linux server. How Should I do that? Can I decrypt the a data that encrypted with CAPICOM?

Thank you.

A: 

This looks like your best bet: http://sourceforge.net/projects/rc4crypt/

Obviously, if you want to make your application cross-platform, you should abandon COM() entirely -- but I understand if that's beyond your control at this point.

Frank Farmer
+1  A: 

CAPICOM uses standard encryption algorithms such as 3DES. If you parse the encrypted buffers yourself, you should be able to decode them using any language.

For details on CAPICOM buffers, start here: http://www.jensign.com/JavaScience/dotnet/DeriveBytes/index.html

If you're dealing with data from a single source using only one crypto algorithm, you should be able to simplify your buffer parsing code significantly.

Carl Russmann