diff options
Diffstat (limited to 'OpenKeychain/src/main')
5 files changed, 13 insertions, 11 deletions
| diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/CanonicalizedSecretKey.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/CanonicalizedSecretKey.java index e4ed50f8f..fe5db8c6d 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/CanonicalizedSecretKey.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/CanonicalizedSecretKey.java @@ -45,6 +45,7 @@ import org.sufficientlysecure.keychain.pgp.exception.PgpKeyNotFoundException;  import org.sufficientlysecure.keychain.util.IterableIterator;  import org.sufficientlysecure.keychain.util.Log; +import java.util.ArrayList;  import java.util.Date;  import java.util.HashMap;  import java.util.LinkedList; @@ -179,7 +180,7 @@ public class CanonicalizedSecretKey extends CanonicalizedPublicKey {      /**       * Returns a list of all supported hash algorithms.       */ -    public LinkedList<Integer> getSupportedHashAlgorithms() { +    public ArrayList<Integer> getSupportedHashAlgorithms() {          // TODO: intersection between preferred hash algos of this key and PgpConstants.PREFERRED_HASH_ALGORITHMS          // choose best algo diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpConstants.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpConstants.java index c0e254574..ba2a54b1a 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpConstants.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpConstants.java @@ -21,13 +21,13 @@ import org.spongycastle.bcpg.CompressionAlgorithmTags;  import org.spongycastle.bcpg.HashAlgorithmTags;  import org.spongycastle.bcpg.SymmetricKeyAlgorithmTags; -import java.util.LinkedList; +import java.util.ArrayList;  public class PgpConstants { -    public static LinkedList<Integer> sPreferredSymmetricAlgorithms = new LinkedList<>(); -    public static LinkedList<Integer> sPreferredHashAlgorithms = new LinkedList<>(); -    public static LinkedList<Integer> sPreferredCompressionAlgorithms = new LinkedList<>(); +    public static ArrayList<Integer> sPreferredSymmetricAlgorithms = new ArrayList<>(); +    public static ArrayList<Integer> sPreferredHashAlgorithms = new ArrayList<>(); +    public static ArrayList<Integer> sPreferredCompressionAlgorithms = new ArrayList<>();      /*       * Most preferred is first @@ -94,7 +94,7 @@ public class PgpConstants {          public static final int USE_PREFERRED = -1;      } -    public static int[] getAsArray(LinkedList<Integer> list) { +    public static int[] getAsArray(ArrayList<Integer> list) {          int[] array = new int[list.size()];          for (int i = 0; i < list.size(); i++) {              array[i] = list.get(i); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncryptOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncryptOperation.java index 59b95bdba..81cc2c847 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncryptOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncryptOperation.java @@ -57,6 +57,7 @@ import java.io.InputStreamReader;  import java.io.OutputStream;  import java.io.UnsupportedEncodingException;  import java.security.SignatureException; +import java.util.ArrayList;  import java.util.Arrays;  import java.util.Date;  import java.util.LinkedList; @@ -207,10 +208,10 @@ public class PgpSignEncryptOperation extends BaseOperation {              // Use preferred hash algo              int requestedAlgorithm = input.getSignatureHashAlgorithm(); -            LinkedList<Integer> supported = signingKey.getSupportedHashAlgorithms(); +            ArrayList<Integer> supported = signingKey.getSupportedHashAlgorithms();              if (requestedAlgorithm == PgpConstants.OpenKeychainHashAlgorithmTags.USE_PREFERRED) {                  // get most preferred -                input.setSignatureHashAlgorithm(supported.getFirst()); +                input.setSignatureHashAlgorithm(supported.get(0));              } else if (!supported.contains(requestedAlgorithm)) {                  log.add(LogType.MSG_PSE_ERROR_HASH_ALGO, indent);                  return new PgpSignEncryptResult(PgpSignEncryptResult.RESULT_ERROR, log); @@ -227,7 +228,7 @@ public class PgpSignEncryptOperation extends BaseOperation {              if (algo == PgpConstants.OpenKeychainSymmetricKeyAlgorithmTags.USE_PREFERRED) {                  // get most preferred                  // TODO: get from recipients -                algo = PgpConstants.sPreferredSymmetricAlgorithms.getFirst(); +                algo = PgpConstants.sPreferredSymmetricAlgorithms.get(0);              }              // has Integrity packet enabled!              JcePGPDataEncryptorBuilder encryptorBuilder = diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFilesActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFilesActivity.java index 8b18d9353..11b596c24 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFilesActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFilesActivity.java @@ -205,7 +205,7 @@ public class EncryptFilesActivity extends EncryptActivity implements EncryptActi          data.addOutputUris(mOutputUris);          if (mUseCompression) { -            data.setCompressionId(PgpConstants.sPreferredCompressionAlgorithms.getFirst()); +            data.setCompressionId(PgpConstants.sPreferredCompressionAlgorithms.get(0));          } else {              data.setCompressionId(CompressionAlgorithmTags.UNCOMPRESSED);          } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextActivity.java index 0f92bbb41..08ff5b962 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextActivity.java @@ -198,7 +198,7 @@ public class EncryptTextActivity extends EncryptActivity implements EncryptActiv          data.setCleartextSignature(true);          if (mUseCompression) { -            data.setCompressionId(PgpConstants.sPreferredCompressionAlgorithms.getFirst()); +            data.setCompressionId(PgpConstants.sPreferredCompressionAlgorithms.get(0));          } else {              data.setCompressionId(CompressionAlgorithmTags.UNCOMPRESSED);          } | 
