aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThialfihar <thialfihar@gmail.com>2010-04-24 17:52:13 +0000
committerThialfihar <thialfihar@gmail.com>2010-04-24 17:52:13 +0000
commitd8e89c88224d3e32e853fbb9c59a6fadb8d0f832 (patch)
tree8fc807f359008c528bc8cad6c342c776c12ff850 /src
parent81cdd6b9433c2dd15467de780b3a584d18609070 (diff)
downloadopen-keychain-d8e89c88224d3e32e853fbb9c59a6fadb8d0f832.tar.gz
open-keychain-d8e89c88224d3e32e853fbb9c59a6fadb8d0f832.tar.bz2
open-keychain-d8e89c88224d3e32e853fbb9c59a6fadb8d0f832.zip
choose the NEAREST prime for ElGamal, rather than the next lowest
Diffstat (limited to 'src')
-rw-r--r--src/org/thialfihar/android/apg/Primes.java10
-rw-r--r--src/org/thialfihar/android/apg/ui/widget/SectionView.java5
2 files changed, 8 insertions, 7 deletions
diff --git a/src/org/thialfihar/android/apg/Primes.java b/src/org/thialfihar/android/apg/Primes.java
index 28ff732a2..e97a6c6c5 100644
--- a/src/org/thialfihar/android/apg/Primes.java
+++ b/src/org/thialfihar/android/apg/Primes.java
@@ -166,15 +166,15 @@ public final class Primes {
public static BigInteger getBestPrime(int keySize) {
String primeString;
- if (keySize >= 8192) {
+ if (keySize >= (8192 + 6144) / 2) {
primeString = P8192;
- } else if (keySize >= 6144) {
+ } else if (keySize >= (6144 + 4096) / 2) {
primeString = P6144;
- } else if (keySize >= 4096) {
+ } else if (keySize >= (4096 + 3072) / 2) {
primeString = P4096;
- } else if (keySize >= 3072) {
+ } else if (keySize >= (3072 + 2048) / 2) {
primeString = P3072;
- } else if (keySize >= 2048) {
+ } else if (keySize >= (2048 + 1536) / 2) {
primeString = P2048;
} else {
primeString = P1536;
diff --git a/src/org/thialfihar/android/apg/ui/widget/SectionView.java b/src/org/thialfihar/android/apg/ui/widget/SectionView.java
index 2cac2375b..865267660 100644
--- a/src/org/thialfihar/android/apg/ui/widget/SectionView.java
+++ b/src/org/thialfihar/android/apg/ui/widget/SectionView.java
@@ -181,8 +181,9 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
View view = mInflater.inflate(R.layout.create_key, null);
dialog.setView(view);
dialog.setTitle("Create Key");
- dialog.setMessage("Note: only subkeys support ElGamal, and for ElGamal will use " +
- "the next smallest keysize of 1536, 2048, 3072, 4096, or 8192.");
+ dialog.setMessage("Note: only subkeys support ElGamal, and for ElGamal " +
+ "the nearest keysize of 1536, 2048, 3072, 4096, or 8192 " +
+ "will be used");
boolean wouldBeMasterKey = (mEditors.getChildCount() == 0);