Keyword Sizes TripleDES-.NET vs Wikipedia

According to Wikipedia , TripleDES supports 56, 112, and 168 bit lengths, but System.Cryptography.TripleDESCryptoServiceProvider.LegalKeySizes claims to accept only 128 and 192-bit key lengths.

The system that I am developing must be compatible (the data encrypted with my code must be decryptable in PHP, Java and Objective-C), and I do not know who is right in this case.

So who should I believe? And how can I be sure that my encrypted data is portable?

+6
source share
4 answers

Wikipedia does not say that TripleDES supports 56-bit keys. “Input parameters” speak of keys of “triple length” and “double length”, the latter “reduces the key size to 112 bits”. The effective key size for the original DES is 56 bits. Such a key is built from 64-bit input, although 8 bits remain unused. Thus, the key of the “triple length” key works with triple 56 bits (= 168), built of three times 64 bits (= 192 bits), and the option “double length” works with two short-term 56-bit keys (= 112) built of two times 64 bits (= 128).

Since your TripleDESCryptoServiceProvider must first extract the actual keys from 64-bit input, it will only accept 128 bits (double length) or 192 bits (triple length) as input, and then internally output 168 or 112 bits of actual keys from this input.

This is a standard procedure for TripleDES, so you should not have portability issues across platforms.

+13
source

Triple DES will only use 112/168 bits of your 128/192 key bit..NET asks for more bits for alignment purposes (each 56-bit subkey is 64-bit aligned).

56 bits of DES are broken, and I expect them to complicate its use.

0
source

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.

0
source

Des uses multiple 64-bit keys, but throws 8 bits, leaving a usable key length of 64 bits.
Triple des can use double or triple key length.
However, since repeating dec with the same key decrypts a message executed an even number of times, it can partially decrypt the material if the keys share the patterns.

For this reason, des always runs an odd number of times.

That is why you should never choose a key where the 64-bit parts are repeated.

With a triple descriptor of 192 bits, you thus have an effective key length of 112 bits

0
source

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


All Articles