对于AES128使用CCCrypt()的密钥可以长于128位? [英] For AES128 using CCCrypt() can the key be longer than 128 bits?

查看:523
本文介绍了对于AES128使用CCCrypt()的密钥可以长于128位?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 CCCrypt 方法。

I am using the CCCrypt method.

我可以使用比128位长的密钥吗?它可以任意长吗?或者是128的倍数?

Can I use a longer key than than 128bit? Can it be arbitrarily long? Or perhaps multiples of 128?

如果是这样,我该怎么做?

If so how would I do this?

但我发现这则文字:这里


某些算法(例如AES和RSA)允许不同长度的键,但其他算法是固定的,例如DES和3DES。使用较长密钥的加密通常意味着对消息恢复的更强的抵抗力。像往常一样,安全性和时间之间存在权衡,因此请适当选择密钥长度。

Some algorithms such as AES and RSA allow for keys of different lengths, but others are fixed, such as DES and 3DES. Encryption using a longer key generally implies a stronger resistance to message recovery. As usual, there is a trade off between security and time, so choose the key length appropriately.

AES如何允许不同的长度,是否忽略高于128的位?

How does AES allow for different lengths, does it ignore the bits higher than 128?

我把头发拉过来,任何帮助都会感激。

Im pulling my hair out over this, any help would be appreciated.

推荐答案

AES(高级加密标准)实际上是三个相关的块密码算法(或成对的算法,如果单独计数加密和解密)的集合。它们都工作在128位块(16字节)。

AES (the Advanced Encryption Standard) is actually a collection of three related block cipher algorithms (or pairs of algorithms, if one counts encryption and decryption individually). They all work on 128-bit blocks (16 bytes).

最常用的是AES-128,它需要一个128位的密钥(即16字节) 。 AES-192采用192位密钥(24字节),AES-256采用256位密钥(32字节)。

The most commonly used one is AES-128, which takes a 128-bit key (i.e. 16 bytes). AES-192 takes a 192-bit key (24 bytes), AES-256 takes a 256-bit key (32 bytes).

这三种算法工作方式类似,但是仍然不同的方式(并且用于较长密钥的密钥需要更长的时间,因为它们做更多的内部混淆操作的轮),所以密钥的所有比特可以以某种方式影响密文的所有比特。因此,所有这些算法的所有这些密钥以不同的方式加密和解密(即,没有AES-256密钥,其作用与AES-128密钥相同)。

These three algorithms work in similar, but still different ways (and the ones for longer keys take a bit longer, since they do more "rounds" of the internal confusion operation, so all bits of the keys can somehow influence all bits of the ciphertext). Thus all these keys for all these algorithms encrypt and decrypt differently (i.e. there is no AES-256 key which does the same thing as an AES-128 key).

说,我不幸不知道CommonCrypto库是否支持AES的所有变体,如果是(我想),如何选择正确的。

That said, I unfortunately have no idea if the CommonCrypto library supports all variants of AES, and if yes (what I suppose), how to select the right one.

这篇关于对于AES128使用CCCrypt()的密钥可以长于128位?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆