So I created a secure BigInteger for my cryptographic application.
Here is my code:
BigInteger b = new BigInteger(25, new SecureRandom());
Since you also need this for a cryptographic application, in my opinion, getting BigInteger is correct. Note. Remember that SecureRandom objects are considered expensive. Therefore, you should not initialize them many times.
After reading the comments, he is Here's a way that guarantees you more confidence in getting a prime number.
BigInteger b =BigInteger.probablePrime(25, new SecureRandom(););
maxx777 Apr 17 '14 at 22:13 2014-04-17 22:13
source share