is AES key random?

后端 未结 4 1429
轮回少年
轮回少年 2021-02-10 22:46

AES key may be generate by this code

KeyGenerator kgen = KeyGenerator.getInstance(\"AES\");
kgen.init(128); 

but

If I have a \"very re

4条回答
  •  离开以前
    2021-02-10 22:57

    It sounds like you're trying to generate an AES key based on a password.

    If this is the case, you can use javax.crypto.SecretKeyFactory's generateSecret method, passing in a javax.crypto.spec.PBEKeySpec as the parameter. The PBEKeySpec allows to to specify the password as an argument to its constructor.

提交回复
热议问题