open-keychain/open-keychain — pull request #536 by gogowitczak (2014-04-07 16:07:36+00:00)
Title: Added possibility to enter custom key length.

This is a reference to issue https://github.com/open-keychain/open-keychain/issues/505.

Custom key length `EditText` is shown to user only if appropriate option is selected from `mKeySizeSpinner`. Every key lenght is being checked by method `private int getProperKeyLength(int algorithmId, int currentKeyLength)` (see Javadoc comment for details).

I've limited RSA key length to 8192, because generating bigger keys take too much time. But changing it is really simple. I've tested this commit and everything works fine.

I think that there is a lot of confusion and special rules for key length, so it would be more user-friendly to show user true key length, which is sometimes different from one selected from Spinner or entered to EditText. All rules that apply:
- RSA key length must be in range (1024, 8192>
- RSA key length must be dividable by 8
- ElGamal key length must be one of following: 1536, 2048, 3072, 4096, 8192
- DSA key length must be in range <512, 1024>
- DSA key length must be dividable by 64

Maybe we should just display info message that will depend on algorithm selected from a Spinner? It would be more user-friendly than current solution.