Which type of Key Format is better for AES 256

被刻印的时光 ゝ 提交于 2021-02-08 06:51:27

问题


here i want to encrypt and decrypt files using AES 256 Algorithm than i have to provide Key for Encrypt the files and same key for decrypt the files.

So which Key is better for good performance and Security also? Which type of Format of key i will use here so i can get more security.

Here i have to use same key in Encrypt and Decrypt.

So Any body please can suggest me the better suggestions for Key.


回答1:


An AES key is just a bunch of bits with no structure. An AES-128 key is 128 bits, which must be chosen randomly. An AES-192 key is 192 bits, an AES-256 key is 256 bits. There aren't any different types or formats of keys.

Most cryptography libraries will have a function to generate an AES secret key. For example, with a PKCS #11 interface, call C_GenerateKey with the CKM_AES_KEY_GEN mechanism. If the library doesn't have a specific function, use it to generate the required number of random bytes, for example with RAND_bytes in OpenSSL.

Consult your cryptographic library's implementation for proper usage. In particular, a random number generator requires entropy from its environment, make sure you are providing enough.



来源:https://stackoverflow.com/questions/9494869/which-type-of-key-format-is-better-for-aes-256

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!