Pass list to AES key generator in PyCrypto

后端 未结 1 1025
谎友^
谎友^ 2021-01-28 15:09

I\'m attempting to generate an AES key with Pycrypto but receive the following error:

TypeError: \'list\' does not support the buffer interface

相关标签:
1条回答
  • 2021-01-28 15:52

    You should not supply any kind of list/array when creating an AES key. The raw key bytes are normally supplied using a byte array of keysize / 8 bytes. For AES, the only key sizes that are supported are 128, 192 and 256 bits or 16, 24 and 32 bytes respectively.

    Note that padding keys until they fit may lead to major cryptographic vulnerabilities. So is using ECB mode instead of a more secure mode like CBC (or one that also provides authentication/integrity protection such as GCM of course).

    0 讨论(0)
提交回复
热议问题