secure random ################# JAVA: secure random 概要 ====================================== new SecureRandom() 之后,如果直接调用nextBytes,默认使用SecureRandom对象(例如/dev/urandom)自身做为seed。 setSeed是往当前seed数组增补内容,而非替换。 因此,不要在SecureRandom之后直接调用setSeed设置可预测/固定seed。 可以考虑先SecureRandom,再nextBytes,再setSeed。 参考资料 ========= - `Random Numbers `_ - `Is intel's RdRand TRNG or PRNG? `_ - `Pseudorandom number generator `_ - `The Right Way to Use SecureRandom `_ - `SecureRandom `_ - `Insufficient cryptographic randomness `_ - `Class SecureRandom `_ - `SecureRandom漏洞解析 `_