From e45f000cb458e8608ad851ce7ecca0045e5ac6b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Thu, 5 Mar 2015 16:57:57 +0100 Subject: Remove advanced preferences, move compression as menu item in encrypt activites, select hash and encryption algo based on hardcoded preferred lists --- .../keychain/pgp/CanonicalizedSecretKey.java | 42 +++------------------- 1 file changed, 5 insertions(+), 37 deletions(-) (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/CanonicalizedSecretKey.java') 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 0fab4c747..9c74cf9a8 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/CanonicalizedSecretKey.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/CanonicalizedSecretKey.java @@ -177,52 +177,20 @@ public class CanonicalizedSecretKey extends CanonicalizedPublicKey { } /** - * Returns a list of all supported hash algorithms. This list is currently hardcoded to return - * a limited set of algorithms supported by Yubikeys. - * - * TODO: look into preferred algos of this key? + * Returns a list of all supported hash algorithms. */ public LinkedList getSupportedHashAlgorithms() { LinkedList supported = new LinkedList<>(); - if (mPrivateKeyState == PRIVATE_KEY_STATE_DIVERT_TO_CARD) { - // No support for MD5 - supported.add(HashAlgorithmTags.RIPEMD160); - // don't allow SHA1 - supported.add(HashAlgorithmTags.SHA224); - supported.add(HashAlgorithmTags.SHA384); - supported.add(HashAlgorithmTags.SHA512); - supported.add(HashAlgorithmTags.SHA256); // preferred is latest - } else { - // NOTE: List of hash algorithms OpenKeychain wants to support! - - // don't allow MD5 - supported.add(HashAlgorithmTags.RIPEMD160); - // don't allow SHA1 - supported.add(HashAlgorithmTags.SHA224); - supported.add(HashAlgorithmTags.SHA384); - supported.add(HashAlgorithmTags.SHA512); - supported.add(HashAlgorithmTags.SHA256); // preferred is latest - // some application don't support SHA512, thus preferred is SHA-256 (Mailvelope?) + // TODO: intersection between preferred hash algos of this key and PgpConstants.PREFERRED_HASH_ALGORITHMS + // choose best algo + for (int currentInt : PgpConstants.PREFERRED_HASH_ALGORITHMS) { + supported.add(currentInt); } return supported; } - /** - * TODO: look into preferred algos of this key? - */ - public static LinkedList getSupportedEncryptionAlgorithms() { - LinkedList supported = new LinkedList<>(); - - supported.add(SymmetricKeyAlgorithmTags.TWOFISH); - supported.add(SymmetricKeyAlgorithmTags.AES_128); - supported.add(SymmetricKeyAlgorithmTags.AES_192); - supported.add(SymmetricKeyAlgorithmTags.AES_256); // preferred is latest - - return supported; - } - private PGPContentSignerBuilder getContentSignerBuilder(int hashAlgo, byte[] nfcSignedHash, Date nfcCreationTimestamp) { if (mPrivateKeyState == PRIVATE_KEY_STATE_DIVERT_TO_CARD) { -- cgit v1.2.3