提交 10bfac4f 编写于 作者: M Matt Perry

Merge pull request #1946 from mpcomplete/throw

Check platform before opening /dev/urandom
......@@ -31,10 +31,16 @@ class CipherParameters {
// Disclaimer: I don't really understand why we need 2 parameters for
// cipher's API.
Future seedRandom() async {
RandomAccessFile file = await new File("/dev/urandom").open();
Uint8List key = new Uint8List.fromList(await file.read(16));
Uint8List iv = new Uint8List.fromList(await file.read(16));
_initRandom(key, iv);
try {
RandomAccessFile file = await new File("/dev/urandom").open();
Uint8List key = new Uint8List.fromList(await file.read(16));
Uint8List iv = new Uint8List.fromList(await file.read(16));
_initRandom(key, iv);
} on FileSystemException {
// TODO(mpcomplete): need an entropy source on Windows. We might get this
// for free from Dart itself soon.
print("Warning: Failed to seed random number generator. No /dev/urandom.");
}
}
SecureRandom _random;
......
name: flx
version: 0.0.7
version: 0.0.8
author: Flutter Authors <flutter-dev@googlegroups.com>
description: Library for dealing with Flutter bundle (.flx) files
homepage: http://flutter.io
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册