AES / CFB8 IV尺寸

AFAIK,CFB8模式的块大小为1byte。 所以我可以诱导IV也是1字节长度。 但是,当我进行测试时,只将1个字节的相同iv传递到公共加密创建加密和解密function的函数,加密和解密的消息不匹配。

所以我认为API应该使用超过1个字节作为IV。 我想知道为什么? 我的理解有什么不对吗?

CCCryptorStatus result = CCCryptorCreateWithMode(operation, kCCModeCFB8, kCCAlgorithmAES128, ccNoPadding, iv.bytes, key.bytes, key.length, NULL, 0, 0, 0, &_cryptor); if (result == kCCSuccess) result = CCCryptorUpdate(_cryptor, data.bytes, data.length, cipherData.mutableBytes, cipherData.length, &outLength); if (result == kCCSuccess) result = CCCryptorFinal(_cryptor, cipherData.mutableBytes, cipherData.length, &outLength); if (result == kCCSuccess) result = CCCryptorRelease(_cryptor); 

它没有1字节的块大小,它只是每1字节重新同步。 IV实际上是16个字节(对于AES)。

IV大小必须与对称算法块大小匹配。 因此,对于AES,您应该具有16字节的IV。

CFB-8的移位大小为一个字节。 它与密码的块大小无关。