Very slow key generation on certain Android versions
MJegorovas <[email protected]> Mon, 29 Oct 2018 10:43:02 -0500 (CDT)
| Newsgroups | gmane.comp.encryption.bouncy-castle.devel |
|---|---|
| Message-ID | <[email protected]> |
I am building an app in which I use the boucycastle (spongycastle, but its the same thing) and when I try to derivate a key for decryption or encryption with AES (AES/GCM/NoPadding) and use the following: KeyParameter key = (KeyParameter) generator.generateDerivedMacParameters(keyLength * 8); // key length in bits and build it on any phone which has OS 6.0 or below the operation is extremely slow. The 'for' cycle in 'F' method (PKCS5S2ParametersGenerator class) runs through very slowly. The iteration count is always 800000 because I need it to be very secure, but the process to execute this code takes almost 5 minutes on these devices. The interesting part is that on API 4.4 it only takes about a minute. So, is there any workaround for this without reducing the iteration count, or should I try to use another key derivation method? Also - what are the differences between generateDerivedParameters and generateDerivedMacParameters as the latter just returns the call for the first method? Thanks in advance. -- Sent from: http://bouncy-castle.1462172.n4.nabble.com/Bouncy-Castle-Dev-f1462173.html