AES / CFB8 IV尺寸 [英] AES/CFB8 IV size
本文介绍了AES / CFB8 IV尺寸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
AFAIK,CFB8模式的块大小为1byte。所以我可以诱导IV也是1个字节长度。
然而,当我做一个测试传递同样iv只有1个字节到通用crypto创建函数加密和解密函数,加密和解密的消息不匹配。
AFAIK, CFB8 mode has block size of 1byte. So I can induce that IV is also 1byte length. However, when I do a test passing same iv of just 1 byte into common crypto create function for encrypt and decrypt function, encrypted and decrypted message mismatch.
所以我认为API应该使用超过1个字节作为IV。我想知道为什么?
So I think that the API should have taken more than 1 byte to use as IV. I would like to know why? Any thing wrong with my understanding?
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个字节重新同步。
IV实际上是16字节(对于AES)。
It doesn't have block size of 1 byte, it is just resynchronized each 1 byte. The IV is actually 16 bytes (for AES).
这篇关于AES / CFB8 IV尺寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文