aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/CanonicalizedSecretKey.java
diff options
context:
space:
mode:
authorDominik Schürmann <dominik@dominikschuermann.de>2015-03-05 16:57:57 +0100
committerDominik Schürmann <dominik@dominikschuermann.de>2015-03-05 16:57:57 +0100
commite45f000cb458e8608ad851ce7ecca0045e5ac6b0 (patch)
treee6208f512239ad32fd9123c19781a1a3b3e70c58 /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/CanonicalizedSecretKey.java
parent8b7684baf78b01592777a1ccb29293a4b59bdf14 (diff)
downloadopen-keychain-e45f000cb458e8608ad851ce7ecca0045e5ac6b0.tar.gz
open-keychain-e45f000cb458e8608ad851ce7ecca0045e5ac6b0.tar.bz2
open-keychain-e45f000cb458e8608ad851ce7ecca0045e5ac6b0.zip
Remove advanced preferences, move compression as menu item in encrypt activites, select hash and encryption algo based on hardcoded preferred lists
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/CanonicalizedSecretKey.java')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/CanonicalizedSecretKey.java42
1 files changed, 5 insertions, 37 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 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<Integer> getSupportedHashAlgorithms() {
LinkedList<Integer> 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<Integer> getSupportedEncryptionAlgorithms() {
- LinkedList<Integer> 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) {