本文介绍了TripleDES键大小 - .NET vs维基百科的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据,TripleDES支持56,112和168位密钥长度,但是System.Cryptography。 TripleDESCryptoServiceProvider.LegalKeySizes表示它只接受128和192位密钥长度。

According to Wikipedia, TripleDES supports 56, 112, and 168-bit key lengths, but the System.Cryptography.TripleDESCryptoServiceProvider.LegalKeySizes says it only accepts 128 and 192-bit key lengths.

我正在开发的系统需要互操作(由我的代码加密的数据需要被解密在PHP,Java和Objective-C中),我不知道在这种情况下谁是正确的。

The system I'm developing needs to be interoperable (data encrypted by my code needs to be decryptable in PHP, Java, and Objective-C) and I don't who is correct in this case.

那么我应该相信谁?我如何确保我的加密数据是可移植的?

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

推荐答案

维基百科不说TripleDES支持56位密钥。 键控选项涉及三重长度键和双长度键,后者将键大小减小到112位。
原始DES的有效密钥大小为56位。这样的密钥由64位输入构成,其中8位保持不用。 三重长度键选项因此使用由三位64位(= 192位)构成的三位56位(= 168),双倍长度选项与两位56位键(= 112)一起使用,由两倍64位(= 128)构成。

Wikipedia does not say TripleDES supports 56 bit keys. The "keying options" talk about "triple-length" keys and "double-length" keys, the latter "reduces the key size to 112 bits".The effective key size for the original DES is 56 bit. Such a key is constructed from 64 bit input though, where 8 bits remain unused. The "triple-length" key option thus works with a three times 56 bit (=168) constructed from three times 64 bit (=192 bit) and the "double-length" option works with two times 56 bit keys (=112) constructed from two times 64 bit (=128).

由于您的TripleDESCryptoServiceProvider需要首先从基于64位的输入中导出实际的密钥,所以只需要128位(双长度)或192位(三-length)作为输入,然后从该输入内部导出168或112位实际的键。

As your TripleDESCryptoServiceProvider needs to derive the actual keys from the 64 bit-based input first, it will only take either 128 bits (double-length) or 192 bits (triple-length) as input and then internally derive the 168 or 112 bit actual keys from that input.

这是TripleDES的标准过程,所以你应该没有可移植性问题平台。

That's standard procedure for TripleDES, so you should have no problems with portability across platforms.

这篇关于TripleDES键大小 - .NET vs维基百科的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 18:24