I believe that some (all?) DES implementations use only 7 bits per key symbol (ASCII encoding). I'm not sure if the DES definition allows 8-bit characters to be used in keys or if it actually ignores the high-order bit of each byte. I think this is the last.
However, in the size of the .NET keys, they are based on the number of bytes, times 8 bits per byte, even if the main algorithm ignores this upper bit. This is probably the main discrepancy.
TripleDES runs DES three times with potentially three different 56-bit DES keys. In some implementations, the average mileage is reversed (encryption-decryption-encryption or "EDE"), so using the same 56-bit DES key for all three duplicates, plain DES encryption is used. This was done for compatibility with older systems where both use hardware encryption. I'm not sure if the TripleDESCryptoServiceProvider method uses this approach "EDE" or "EEE" (or gives you a choice). In addition, the same 56-bit DES key can be used for the first and third starts, using a 112-bit key instead of the 168-bit key, which it can also use.
A certified TripleDESCryptoServiceProvider will not accept 56-bit (64-bit) keys because it is not really 3DES security (can you use DESCryptoServiceProvider instead?). At one time, it was found that 168-bit EEE (or EDE?) 3DES does not provide more security than using a 112-bit (128-bit) key. However, there may be some extreme (usually inaccessible) attacks in which a shorter key is theoretically more vulnerable. This may also apply to the EDE vs EEE issue.
In terms of your compatibility and other languages, the .NET * CryptoServiceProvider classes are just a wrapper API around the Windows CRYPTO base library. If other languages also use the Windows CRYPTO library, it must be compatible. Otherwise, you will need to find out if they use EDE or EEE, and make sure they all use the same one (you may or may not have flexibility) and obviously use the same key length. They probably all use the same byte order, but if you find that it still doesn't match, this might be another thing to check. Most likely, on Windows they all use CRYPTO and are likely to match as long as you can set the parameters the same for all of them.
source share