DataEncryptionKey.generate constructor

DataEncryptionKey.generate(
  1. int byteLength
)

Create a new random data encryption key

Implementation

DataEncryptionKey.generate(int byteLength) {
  final secureRandom = pointy_castle.SecureRandom('Fortuna'); // Get directly
  final seedSource = Random.secure();
  final seeds = <int>[];
  for (var i = 0; i < 32; i++) {
    seeds.add(seedSource.nextInt(255));
  }
  secureRandom.seed(pointy_castle.KeyParameter(Uint8List.fromList(seeds)));
  this._key = secureRandom.nextBytes(byteLength);
}