Closed Vanethos closed 5 years ago
I tried to create RSA keypair using @proteye 's gist: https://gist.github.com/proteye/982d9991922276ccfb011dfc55443d74, even creating a isolate for it, but on the iPhone 5s and iPad air it can't get past the keyGenerator.generateKeyPair(); line.
keyGenerator.generateKeyPair();
Code:
AsymmetricKeyPair<PublicKey, PrivateKey> computeRSAKeyPair( SecureRandom secureRandom) { var rsapars = new RSAKeyGeneratorParameters(BigInt(65537), 2048, 12); var params = new ParametersWithRandom(rsapars, secureRandom); var keyGenerator = new RSAKeyGenerator(); keyGenerator.init(params); /// CODE BLOCKS IN THE FOLLOWING LINE: return keyGenerator.generateKeyPair(); } Future<AsymmetricKeyPair<PublicKey, PrivateKey>> getRSAKeyPair( SecureRandom secureRandom) async { return await compute(computeRSAKeyPair, secureRandom); } 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; }
This works on OnePlus 6,and the android and ios simulator on the mac.
Am I doing something wrong? Is this not the correct way for generating a key-pair?
I tried to create RSA keypair using @proteye 's gist: https://gist.github.com/proteye/982d9991922276ccfb011dfc55443d74, even creating a isolate for it, but on the iPhone 5s and iPad air it can't get past the
keyGenerator.generateKeyPair();
line.Code:
This works on OnePlus 6,and the android and ios simulator on the mac.
Am I doing something wrong? Is this not the correct way for generating a key-pair?