From 02084ba14a5d1055dbb99d9f068b993310e0b517 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Thu, 5 Mar 2015 17:53:14 +0100 Subject: [PATCH] Cleanup of PgpConstants --- .../keychain/pgp/PgpConstants.java | 46 +++++++++---------- 1 file changed, 22 insertions(+), 24 deletions(-) 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 6c0a9bd48..c0e254574 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpConstants.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpConstants.java @@ -25,17 +25,9 @@ import java.util.LinkedList; public class PgpConstants { - public static interface OpenKeychainSymmetricKeyAlgorithmTags extends SymmetricKeyAlgorithmTags { - public static final int USE_PREFERRED = -1; - } - - public static interface OpenKeychainHashAlgorithmTags extends HashAlgorithmTags { - public static final int USE_PREFERRED = -1; - } - - public static interface OpenKeychainCompressionAlgorithmTags extends CompressionAlgorithmTags { - public static final int USE_PREFERRED = -1; - } + public static LinkedList sPreferredSymmetricAlgorithms = new LinkedList<>(); + public static LinkedList sPreferredHashAlgorithms = new LinkedList<>(); + public static LinkedList sPreferredCompressionAlgorithms = new LinkedList<>(); /* * Most preferred is first @@ -45,11 +37,6 @@ public class PgpConstants { * These lists also define the only algorithms which are used in OpenKeychain. * We do not support algorithms such as MD5 */ - - public static LinkedList sPreferredSymmetricAlgorithms = new LinkedList<>(); - public static LinkedList sPreferredHashAlgorithms = new LinkedList<>(); - public static LinkedList sPreferredCompressionAlgorithms = new LinkedList<>(); - static { sPreferredSymmetricAlgorithms.add(SymmetricKeyAlgorithmTags.AES_256); sPreferredSymmetricAlgorithms.add(SymmetricKeyAlgorithmTags.AES_192); @@ -69,14 +56,6 @@ public class PgpConstants { sPreferredCompressionAlgorithms.add(CompressionAlgorithmTags.ZIP); } - public static int[] getAsArray(LinkedList list) { - int[] array = new int[list.size()]; - for (int i = 0; i < list.size(); i++) { - array[i] = list.get(i); // Watch out for NullPointerExceptions! - } - return array; - } - /* * Note: s2kcount is a number between 0 and 0xff that controls the * number of times to iterate the password hash before use. More @@ -103,4 +82,23 @@ public class PgpConstants { // see http://tools.ietf.org/html/rfc488 0#section-5.5.3 public static final int SECRET_KEY_SIGNATURE_CHECKSUM_HASH_ALGO = HashAlgorithmTags.SHA1; + public static interface OpenKeychainSymmetricKeyAlgorithmTags extends SymmetricKeyAlgorithmTags { + public static final int USE_PREFERRED = -1; + } + + public static interface OpenKeychainHashAlgorithmTags extends HashAlgorithmTags { + public static final int USE_PREFERRED = -1; + } + + public static interface OpenKeychainCompressionAlgorithmTags extends CompressionAlgorithmTags { + public static final int USE_PREFERRED = -1; + } + + public static int[] getAsArray(LinkedList list) { + int[] array = new int[list.size()]; + for (int i = 0; i < list.size(); i++) { + array[i] = list.get(i); + } + return array; + } }