mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-12-25 00:18:51 -05:00
choose the NEAREST prime for ElGamal, rather than the next lowest
This commit is contained in:
parent
81cdd6b943
commit
d8e89c8822
@ -166,15 +166,15 @@ public final class Primes {
|
|||||||
|
|
||||||
public static BigInteger getBestPrime(int keySize) {
|
public static BigInteger getBestPrime(int keySize) {
|
||||||
String primeString;
|
String primeString;
|
||||||
if (keySize >= 8192) {
|
if (keySize >= (8192 + 6144) / 2) {
|
||||||
primeString = P8192;
|
primeString = P8192;
|
||||||
} else if (keySize >= 6144) {
|
} else if (keySize >= (6144 + 4096) / 2) {
|
||||||
primeString = P6144;
|
primeString = P6144;
|
||||||
} else if (keySize >= 4096) {
|
} else if (keySize >= (4096 + 3072) / 2) {
|
||||||
primeString = P4096;
|
primeString = P4096;
|
||||||
} else if (keySize >= 3072) {
|
} else if (keySize >= (3072 + 2048) / 2) {
|
||||||
primeString = P3072;
|
primeString = P3072;
|
||||||
} else if (keySize >= 2048) {
|
} else if (keySize >= (2048 + 1536) / 2) {
|
||||||
primeString = P2048;
|
primeString = P2048;
|
||||||
} else {
|
} else {
|
||||||
primeString = P1536;
|
primeString = P1536;
|
||||||
|
@ -181,8 +181,9 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
|
|||||||
View view = mInflater.inflate(R.layout.create_key, null);
|
View view = mInflater.inflate(R.layout.create_key, null);
|
||||||
dialog.setView(view);
|
dialog.setView(view);
|
||||||
dialog.setTitle("Create Key");
|
dialog.setTitle("Create Key");
|
||||||
dialog.setMessage("Note: only subkeys support ElGamal, and for ElGamal will use " +
|
dialog.setMessage("Note: only subkeys support ElGamal, and for ElGamal " +
|
||||||
"the next smallest keysize of 1536, 2048, 3072, 4096, or 8192.");
|
"the nearest keysize of 1536, 2048, 3072, 4096, or 8192 " +
|
||||||
|
"will be used");
|
||||||
|
|
||||||
boolean wouldBeMasterKey = (mEditors.getChildCount() == 0);
|
boolean wouldBeMasterKey = (mEditors.getChildCount() == 0);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user