mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-13 04:25:00 -05:00
wrapped-key-ring: remove more unneeded methods
This commit is contained in:
parent
9baddb7d71
commit
90ac60b6db
@ -57,11 +57,6 @@ public class PgpKeyHelper {
|
|||||||
return key.getCreationTime();
|
return key.getCreationTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public static Date getCreationDate(PGPSecretKey key) {
|
|
||||||
return key.getPublicKey().getCreationTime();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static Date getExpiryDate(PGPPublicKey key) {
|
public static Date getExpiryDate(PGPPublicKey key) {
|
||||||
Date creationDate = getCreationDate(key);
|
Date creationDate = getCreationDate(key);
|
||||||
@ -76,38 +71,6 @@ public class PgpKeyHelper {
|
|||||||
return calendar.getTime();
|
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")
|
@SuppressWarnings("unchecked")
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static boolean isEncryptionKey(PGPPublicKey key) {
|
public static boolean isEncryptionKey(PGPPublicKey key) {
|
||||||
@ -150,10 +113,6 @@ public class PgpKeyHelper {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isEncryptionKey(PGPSecretKey key) {
|
|
||||||
return isEncryptionKey(key.getPublicKey());
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static boolean isSigningKey(PGPPublicKey key) {
|
public static boolean isSigningKey(PGPPublicKey key) {
|
||||||
@ -186,11 +145,6 @@ public class PgpKeyHelper {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public static boolean isSigningKey(PGPSecretKey key) {
|
|
||||||
return isSigningKey(key.getPublicKey());
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static boolean isCertificationKey(PGPPublicKey key) {
|
public static boolean isCertificationKey(PGPPublicKey key) {
|
||||||
@ -218,51 +172,6 @@ public class PgpKeyHelper {
|
|||||||
return false;
|
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!
|
* TODO: Only used in HkpKeyServer. Get rid of this one!
|
||||||
*/
|
*/
|
||||||
|
@ -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
|
* Retrieves the actual PGPSecretKeyRing object from the database blob based on the maserKeyId
|
||||||
*/
|
*/
|
||||||
|
@ -367,10 +367,10 @@ public class ViewKeyActivity extends ActionBarActivity {
|
|||||||
try {
|
try {
|
||||||
Uri blobUri =
|
Uri blobUri =
|
||||||
KeychainContract.KeyRingData.buildPublicKeyRingUri(dataUri);
|
KeychainContract.KeyRingData.buildPublicKeyRingUri(dataUri);
|
||||||
mNfcKeyringBytes = mProviderHelper.getPGPKeyRing(
|
mNfcKeyringBytes = (byte[]) mProviderHelper.getGenericData(
|
||||||
blobUri).getEncoded();
|
blobUri,
|
||||||
} catch (IOException e) {
|
KeychainContract.KeyRingData.KEY_RING_DATA,
|
||||||
Log.e(Constants.TAG, "Error parsing keyring", e);
|
ProviderHelper.FIELD_TYPE_BLOB);
|
||||||
} catch (ProviderHelper.NotFoundException e) {
|
} catch (ProviderHelper.NotFoundException e) {
|
||||||
Log.e(Constants.TAG, "key not found!", e);
|
Log.e(Constants.TAG, "key not found!", e);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user