于是我又移植了 Brian Gladman的AES 库到Flash上.这个很容易基本没做什么就完成了.由于本人对密码学一无所知,很多地方还很困惑
这是 自述 文档:
Please note the following IMPORTANT points about the AES mode subroutines:
1. All modes are reset when a new AES key is set.
2. Incremental calls to the different modes cannot
be mixed. If a change of mode is needed a new
key must be set or a reset must be issued (see
3. For modes with IVs, the IV value is an input AND
an ouput since it is updated after each call to
the value needed for any subsequent incremental
call(s). If the mode is reset, the IV hence has
to be set (or reset) as well.
4. ECB operations must be multiples of 16 bytes
but do not need to be reset for new operations.
5. CBC operations must also be multiples of 16
bytes and are reset for a new operation by
setting the IV.
6. CFB, OFB and CTR mode must be reset by setting
a new IV value AND by calling: aes_mode_reset(aes_encrypt_ctx cx)
For CTR mode the cbuf value also has to be reset.
7. CFB, OFB and CTR modes only use AES encryption
operations and contexts and do not need AES
8. AES keys remain valid across resets and changes
of mode (but encryption and decryption keys must
both be set if they are needed).
1. 主要是第二条.. If a change of mode is needed a new key must be set or a reset must be issued (see below).
我是不是每次更改模式,比如从 CFB 切换到 CTR 需要重新设置 AES_Key?就是重新给 AES_Key 赋值
2. 带有 IV 的模式,我在Google上找了下好像要和密文一起传送.如果这样那么有什么标准的格式吗?? 比如把IV放在第一个字节块,或最后一个??