diff options
Diffstat (limited to 'OpenKeychain/src/main')
9 files changed, 21 insertions, 22 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java index a5ccfbd3b..c279b7a9b 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java @@ -258,7 +258,7 @@ public class PgpDecryptVerify { continue; } // get subkey which has been used for this encryption packet - secretEncryptionKey = secretKeyRing.getSubKey(encData.getKeyID()); + secretEncryptionKey = secretKeyRing.getSecretKey(encData.getKeyID()); if (secretEncryptionKey == null) { // continue with the next packet in the while loop continue; @@ -393,7 +393,7 @@ public class PgpDecryptVerify { signingRing = mProviderHelper.getWrappedPublicKeyRing( KeyRings.buildUnifiedKeyRingsFindBySubkeyUri(sigKeyId) ); - signingKey = signingRing.getSubkey(sigKeyId); + signingKey = signingRing.getPublicKey(sigKeyId); signatureIndex = i; } catch (ProviderHelper.NotFoundException e) { Log.d(Constants.TAG, "key not found!"); @@ -578,7 +578,7 @@ public class PgpDecryptVerify { signingRing = mProviderHelper.getWrappedPublicKeyRing( KeyRings.buildUnifiedKeyRingsFindBySubkeyUri(sigKeyId) ); - signingKey = signingRing.getSubkey(sigKeyId); + signingKey = signingRing.getPublicKey(sigKeyId); signatureIndex = i; } catch (ProviderHelper.NotFoundException e) { Log.d(Constants.TAG, "key not found!"); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/WrappedKeyRing.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/WrappedKeyRing.java index 2fcd05204..ba5ebea4a 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/WrappedKeyRing.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/WrappedKeyRing.java @@ -39,7 +39,7 @@ public abstract class WrappedKeyRing extends KeyRing { } public String getPrimaryUserId() throws PgpGeneralException { - return (String) getRing().getPublicKey().getUserIDs().next(); + return getPublicKey().getPrimaryUserId(); }; public boolean isRevoked() throws PgpGeneralException { @@ -101,6 +101,14 @@ public abstract class WrappedKeyRing extends KeyRing { abstract public IterableIterator<WrappedPublicKey> publicKeyIterator(); + public WrappedPublicKey getPublicKey() { + return new WrappedPublicKey(this, getRing().getPublicKey()); + } + + public WrappedPublicKey getPublicKey(long id) { + return new WrappedPublicKey(this, getRing().getPublicKey(id)); + } + public byte[] getEncoded() throws IOException { return getRing().getEncoded(); } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/WrappedPublicKeyRing.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/WrappedPublicKeyRing.java index b2abf15a4..57d84072a 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/WrappedPublicKeyRing.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/WrappedPublicKeyRing.java @@ -44,14 +44,6 @@ public class WrappedPublicKeyRing extends WrappedKeyRing { getRing().encode(stream); } - public WrappedPublicKey getSubkey() { - return new WrappedPublicKey(this, getRing().getPublicKey()); - } - - public WrappedPublicKey getSubkey(long id) { - return new WrappedPublicKey(this, getRing().getPublicKey(id)); - } - /** Getter that returns the subkey that should be used for signing. */ WrappedPublicKey getEncryptionSubKey() throws PgpGeneralException { PGPPublicKey key = getRing().getPublicKey(getEncryptId()); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/WrappedSecretKey.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/WrappedSecretKey.java index ef8044a9b..067aaeda3 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/WrappedSecretKey.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/WrappedSecretKey.java @@ -175,7 +175,7 @@ public class WrappedSecretKey extends WrappedPublicKey { } // get the master subkey (which we certify for) - PGPPublicKey publicKey = publicKeyRing.getSubkey().getPublicKey(); + PGPPublicKey publicKey = publicKeyRing.getPublicKey().getPublicKey(); // fetch public key ring, add the certification and return it for (String userId : new IterableIterator<String>(userIds.iterator())) { diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/WrappedSecretKeyRing.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/WrappedSecretKeyRing.java index c737b7c46..5cb24cf88 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/WrappedSecretKeyRing.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/WrappedSecretKeyRing.java @@ -41,11 +41,11 @@ public class WrappedSecretKeyRing extends WrappedKeyRing { return mRing; } - public WrappedSecretKey getSubKey() { + public WrappedSecretKey getSecretKey() { return new WrappedSecretKey(this, mRing.getSecretKey()); } - public WrappedSecretKey getSubKey(long id) { + public WrappedSecretKey getSecretKey(long id) { return new WrappedSecretKey(this, mRing.getSecretKey(id)); } 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 991c9f3a8..2d524f5b0 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java @@ -199,7 +199,7 @@ public class ProviderHelper { byte[] blob = cursor.getBlob(3); if (blob != null) { result.put(masterKeyId, - new WrappedPublicKeyRing(blob, hasAnySecret, verified).getSubkey()); + new WrappedPublicKeyRing(blob, hasAnySecret, verified).getPublicKey()); } } while (cursor.moveToNext()); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java index 4e435253a..1e4e926e9 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java @@ -44,7 +44,6 @@ import org.sufficientlysecure.keychain.pgp.PgpKeyOperation; import org.sufficientlysecure.keychain.pgp.PgpSignEncrypt; import org.sufficientlysecure.keychain.pgp.Progressable; import org.sufficientlysecure.keychain.pgp.UncachedKeyRing; -import org.sufficientlysecure.keychain.pgp.WrappedPublicKey; import org.sufficientlysecure.keychain.pgp.WrappedPublicKeyRing; import org.sufficientlysecure.keychain.pgp.WrappedSecretKey; import org.sufficientlysecure.keychain.pgp.WrappedSecretKeyRing; @@ -546,7 +545,7 @@ public class KeychainIntentService extends IntentService ProviderHelper providerHelper = new ProviderHelper(this); WrappedPublicKeyRing publicRing = providerHelper.getWrappedPublicKeyRing(pubKeyId); WrappedSecretKeyRing secretKeyRing = providerHelper.getWrappedSecretKeyRing(masterKeyId); - WrappedSecretKey certificationKey = secretKeyRing.getSubKey(); + WrappedSecretKey certificationKey = secretKeyRing.getSecretKey(); if(!certificationKey.unlock(signaturePassphrase)) { throw new PgpGeneralException("Error extracting key (bad passphrase?)"); } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivityOld.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivityOld.java index d9deb802c..70ccb8800 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivityOld.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivityOld.java @@ -280,7 +280,7 @@ public class EditKeyActivityOld extends ActionBarActivity implements EditorListe Uri secretUri = KeyRings.buildUnifiedKeyRingUri(mDataUri); WrappedSecretKeyRing keyRing = new ProviderHelper(this).getWrappedSecretKeyRing(secretUri); - mMasterCanSign = keyRing.getSubKey().canCertify(); + mMasterCanSign = keyRing.getSecretKey().canCertify(); for (WrappedSecretKey key : keyRing.secretKeyIterator()) { // Turn into uncached instance mKeys.add(key.getUncached()); @@ -288,7 +288,7 @@ public class EditKeyActivityOld extends ActionBarActivity implements EditorListe } boolean isSet = false; - for (String userId : keyRing.getSubKey().getUserIds()) { + for (String userId : keyRing.getSecretKey().getUserIds()) { Log.d(Constants.TAG, "Added userId " + userId); if (!isSet) { isSet = true; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewCertActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewCertActivity.java index c7fffe263..cfdea0611 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewCertActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewCertActivity.java @@ -149,8 +149,8 @@ public class ViewCertActivity extends ActionBarActivity providerHelper.getWrappedPublicKeyRing(sig.getKeyId()); try { - sig.init(signerRing.getSubkey()); - if (sig.verifySignature(signeeRing.getSubkey(), signeeUid)) { + sig.init(signerRing.getPublicKey()); + if (sig.verifySignature(signeeRing.getPublicKey(), signeeUid)) { mStatus.setText(R.string.cert_verify_ok); mStatus.setTextColor(getResources().getColor(R.color.result_green)); } else { |