aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Breitmoser <valodim@mugenguild.com>2014-05-04 17:44:10 +0200
committerVincent Breitmoser <valodim@mugenguild.com>2014-05-04 17:44:10 +0200
commit90ac60b6db0637fbefbce5cb2cd80a64f5bb708d (patch)
tree237b37582019c8b443e8d4c3e821b13fed2f0225
parent9baddb7d719b09fb88f6fc4e7ed8ec495b68c3e1 (diff)
downloadopen-keychain-90ac60b6db0637fbefbce5cb2cd80a64f5bb708d.tar.gz
open-keychain-90ac60b6db0637fbefbce5cb2cd80a64f5bb708d.tar.bz2
open-keychain-90ac60b6db0637fbefbce5cb2cd80a64f5bb708d.zip
wrapped-key-ring: remove more unneeded methods
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyHelper.java91
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java17
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java8
3 files changed, 4 insertions, 112 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyHelper.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyHelper.java
index 77697b026..59a48e7eb 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyHelper.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyHelper.java
@@ -58,11 +58,6 @@ public class PgpKeyHelper {
}
@Deprecated
- public static Date getCreationDate(PGPSecretKey key) {
- return key.getPublicKey().getCreationTime();
- }
-
- @Deprecated
public static Date getExpiryDate(PGPPublicKey key) {
Date creationDate = getCreationDate(key);
if (key.getValidDays() == 0) {
@@ -76,38 +71,6 @@ public class PgpKeyHelper {
return calendar.getTime();
}
- @Deprecated
- public static Date getExpiryDate(PGPSecretKey key) {
- return getExpiryDate(key.getPublicKey());
- }
-
- public static int getKeyUsage(PGPSecretKey key) {
- return getKeyUsage(key.getPublicKey());
- }
-
- @SuppressWarnings("unchecked")
- private static int getKeyUsage(PGPPublicKey key) {
- int usage = 0;
- if (key.getVersion() >= 4) {
- for (PGPSignature sig : new IterableIterator<PGPSignature>(key.getSignatures())) {
- if (key.isMasterKey() && sig.getKeyID() != key.getKeyID()) {
- continue;
- }
-
- PGPSignatureSubpacketVector hashed = sig.getHashedSubPackets();
- if (hashed != null) {
- usage |= hashed.getKeyFlags();
- }
-
- PGPSignatureSubpacketVector unhashed = sig.getUnhashedSubPackets();
- if (unhashed != null) {
- usage |= unhashed.getKeyFlags();
- }
- }
- }
- return usage;
- }
-
@SuppressWarnings("unchecked")
@Deprecated
public static boolean isEncryptionKey(PGPPublicKey key) {
@@ -150,10 +113,6 @@ public class PgpKeyHelper {
return false;
}
- public static boolean isEncryptionKey(PGPSecretKey key) {
- return isEncryptionKey(key.getPublicKey());
- }
-
@SuppressWarnings("unchecked")
@Deprecated
public static boolean isSigningKey(PGPPublicKey key) {
@@ -186,11 +145,6 @@ public class PgpKeyHelper {
return false;
}
- @Deprecated
- public static boolean isSigningKey(PGPSecretKey key) {
- return isSigningKey(key.getPublicKey());
- }
-
@SuppressWarnings("unchecked")
@Deprecated
public static boolean isCertificationKey(PGPPublicKey key) {
@@ -218,51 +172,6 @@ public class PgpKeyHelper {
return false;
}
- @Deprecated
- public static boolean isAuthenticationKey(PGPSecretKey key) {
- return isAuthenticationKey(key.getPublicKey());
- }
-
- @SuppressWarnings("unchecked")
- @Deprecated
- public static boolean isAuthenticationKey(PGPPublicKey key) {
- if (key.getVersion() <= 3) {
- return true;
- }
-
- for (PGPSignature sig : new IterableIterator<PGPSignature>(key.getSignatures())) {
- if (key.isMasterKey() && sig.getKeyID() != key.getKeyID()) {
- continue;
- }
- PGPSignatureSubpacketVector hashed = sig.getHashedSubPackets();
-
- if (hashed != null && (hashed.getKeyFlags() & KeyFlags.AUTHENTICATION) != 0) {
- return true;
- }
-
- PGPSignatureSubpacketVector unhashed = sig.getUnhashedSubPackets();
-
- if (unhashed != null && (unhashed.getKeyFlags() & KeyFlags.AUTHENTICATION) != 0) {
- return true;
- }
- }
-
- return false;
- }
-
- @Deprecated
- public static boolean isCertificationKey(PGPSecretKey key) {
- return isCertificationKey(key.getPublicKey());
- }
-
- public static String getAlgorithmInfo(Context context, PGPPublicKey key) {
- return getAlgorithmInfo(context, key.getAlgorithm(), key.getBitStrength());
- }
-
- public static String getAlgorithmInfo(Context context, PGPSecretKey key) {
- return getAlgorithmInfo(context, key.getPublicKey());
- }
-
/**
* TODO: Only used in HkpKeyServer. Get rid of this one!
*/
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java
index d1a003ec1..0784a0f33 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java
@@ -263,23 +263,6 @@ public class ProviderHelper {
}
}
- @Deprecated
- public PGPSecretKeyRing getPGPSecretKeyRingWithKeyId(long keyId)
- throws NotFoundException {
- Uri uri = KeyRings.buildUnifiedKeyRingsFindBySubkeyUri(Long.toString(keyId));
- long masterKeyId = getMasterKeyId(uri);
- return getPGPSecretKeyRing(masterKeyId);
- }
-
- /**
- * Retrieves the actual PGPPublicKeyRing object from the database blob based on the masterKeyId
- */
- @Deprecated
- public PGPPublicKeyRing getPGPPublicKeyRing(long masterKeyId) throws NotFoundException {
- Uri queryUri = KeyRingData.buildPublicKeyRingUri(Long.toString(masterKeyId));
- return (PGPPublicKeyRing) getPGPKeyRing(queryUri);
- }
-
/**
* Retrieves the actual PGPSecretKeyRing object from the database blob based on the maserKeyId
*/
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java
index e595c1889..79f409663 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java
@@ -367,10 +367,10 @@ public class ViewKeyActivity extends ActionBarActivity {
try {
Uri blobUri =
KeychainContract.KeyRingData.buildPublicKeyRingUri(dataUri);
- mNfcKeyringBytes = mProviderHelper.getPGPKeyRing(
- blobUri).getEncoded();
- } catch (IOException e) {
- Log.e(Constants.TAG, "Error parsing keyring", e);
+ mNfcKeyringBytes = (byte[]) mProviderHelper.getGenericData(
+ blobUri,
+ KeychainContract.KeyRingData.KEY_RING_DATA,
+ ProviderHelper.FIELD_TYPE_BLOB);
} catch (ProviderHelper.NotFoundException e) {
Log.e(Constants.TAG, "key not found!", e);
}