getSecureRandom method
SecureRandom
getSecureRandom()
Generates a SecureRandom
to use in computing RSA key pair
Returns FortunaRandom
to be used in the AsymmetricKeyPair
generation
Implementation
SecureRandom getSecureRandom() {
var secureRandom = FortunaRandom();
var random = Random.secure();
List<int> seeds = [];
for (int i = 0; i < 32; i++) {
seeds.add(random.nextInt(255));
}
secureRandom.seed(new KeyParameter(new Uint8List.fromList(seeds)));
return secureRandom;
}