diff options
author | Dominik <dominik@dominikschuermann.de> | 2012-06-20 14:49:57 +0300 |
---|---|---|
committer | Dominik <dominik@dominikschuermann.de> | 2012-06-20 14:49:57 +0300 |
commit | e9c01957f4797d13518115e7e26ed015547f0891 (patch) | |
tree | c4f78c5f7f4522c7daa7ff8ddc3c8d6b705375dd /org_apg/src/org/thialfihar/android/apg/ui/dialog | |
parent | 437ec9c49a61af9949dcb04dedc43d0c074f8f42 (diff) | |
download | open-keychain-e9c01957f4797d13518115e7e26ed015547f0891.tar.gz open-keychain-e9c01957f4797d13518115e7e26ed015547f0891.tar.bz2 open-keychain-e9c01957f4797d13518115e7e26ed015547f0891.zip |
working on decrypt and restructering...
Diffstat (limited to 'org_apg/src/org/thialfihar/android/apg/ui/dialog')
-rw-r--r-- | org_apg/src/org/thialfihar/android/apg/ui/dialog/FileDialogFragment.java | 9 | ||||
-rw-r--r-- | org_apg/src/org/thialfihar/android/apg/ui/dialog/PassphraseDialogFragment.java | 16 |
2 files changed, 13 insertions, 12 deletions
diff --git a/org_apg/src/org/thialfihar/android/apg/ui/dialog/FileDialogFragment.java b/org_apg/src/org/thialfihar/android/apg/ui/dialog/FileDialogFragment.java index 7f1fbf87b..531cddfcf 100644 --- a/org_apg/src/org/thialfihar/android/apg/ui/dialog/FileDialogFragment.java +++ b/org_apg/src/org/thialfihar/android/apg/ui/dialog/FileDialogFragment.java @@ -18,7 +18,8 @@ package org.thialfihar.android.apg.ui.dialog; import org.thialfihar.android.apg.Constants; import org.thialfihar.android.apg.R; -import org.thialfihar.android.apg.util.Utils; +import org.thialfihar.android.apg.helper.FileHelper; +import org.thialfihar.android.apg.helper.OtherHelper; import android.app.Activity; import android.app.AlertDialog; @@ -51,7 +52,7 @@ public class FileDialogFragment extends DialogFragment { public static final int MESSAGE_OKAY = 1; public static final String MESSAGE_DATA_FILENAME = "filename"; - public static final String MESSAGE_CHECKED = "checked"; + public static final String MESSAGE_DATA_CHECKED = "checked"; /** * Creates new instance of this file dialog fragment @@ -107,7 +108,7 @@ public class FileDialogFragment extends DialogFragment { mBrowse.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // only .asc or .gpg files - Utils.openFile(activity, mFilename.getText().toString(), "text/plain", requestCode); + FileHelper.openFile(activity, mFilename.getText().toString(), "text/plain", requestCode); } }); @@ -135,7 +136,7 @@ public class FileDialogFragment extends DialogFragment { // return resulting data back to activity Bundle data = new Bundle(); data.putString(MESSAGE_DATA_FILENAME, mFilename.getText().toString()); - data.putBoolean(MESSAGE_CHECKED, checked); + data.putBoolean(MESSAGE_DATA_CHECKED, checked); sendMessageToHandler(MESSAGE_OKAY, data); diff --git a/org_apg/src/org/thialfihar/android/apg/ui/dialog/PassphraseDialogFragment.java b/org_apg/src/org/thialfihar/android/apg/ui/dialog/PassphraseDialogFragment.java index 3b83aaaa3..ce08c6c86 100644 --- a/org_apg/src/org/thialfihar/android/apg/ui/dialog/PassphraseDialogFragment.java +++ b/org_apg/src/org/thialfihar/android/apg/ui/dialog/PassphraseDialogFragment.java @@ -21,8 +21,8 @@ import org.spongycastle.openpgp.PGPPrivateKey; import org.spongycastle.openpgp.PGPSecretKey; import org.spongycastle.openpgp.operator.PBESecretKeyDecryptor; import org.spongycastle.openpgp.operator.jcajce.JcePBESecretKeyDecryptorBuilder; -import org.thialfihar.android.apg.Apg; -import org.thialfihar.android.apg.Apg.GeneralException; +import org.thialfihar.android.apg.helper.PGPHelper; +import org.thialfihar.android.apg.helper.PGPHelper.GeneralException; import org.thialfihar.android.apg.Constants; import org.thialfihar.android.apg.Id; import org.thialfihar.android.apg.R; @@ -68,7 +68,7 @@ public class PassphraseDialogFragment extends DialogFragment { // check if secret key has a passphrase if (!(secretKeyId == Id.key.symmetric || secretKeyId == Id.key.none)) { if (!hasPassphrase(secretKeyId)) { - throw new Apg.GeneralException("No passphrase! No passphrase dialog needed!"); + throw new PGPHelper.GeneralException("No passphrase! No passphrase dialog needed!"); } } @@ -91,7 +91,7 @@ public class PassphraseDialogFragment extends DialogFragment { private static boolean hasPassphrase(long secretKeyId) { // check if the key has no passphrase try { - PGPSecretKey secretKey = Apg.getMasterKey(Apg.getSecretKeyRing(secretKeyId)); + PGPSecretKey secretKey = PGPHelper.getMasterKey(PGPHelper.getSecretKeyRing(secretKeyId)); Log.d(Constants.TAG, "Check if key has no passphrase..."); PBESecretKeyDecryptor keyDecryptor = new JcePBESecretKeyDecryptorBuilder().setProvider( @@ -101,7 +101,7 @@ public class PassphraseDialogFragment extends DialogFragment { Log.d(Constants.TAG, "Key has no passphrase! Caches empty passphrase!"); // cache empty passphrase - Apg.setCachedPassPhrase(secretKey.getKeyID(), ""); + PGPHelper.setCachedPassPhrase(secretKey.getKeyID(), ""); return false; } @@ -132,7 +132,7 @@ public class PassphraseDialogFragment extends DialogFragment { secretKey = null; alert.setMessage(getString(R.string.passPhraseForSymmetricEncryption)); } else { - secretKey = Apg.getMasterKey(Apg.getSecretKeyRing(secretKeyId)); + secretKey = PGPHelper.getMasterKey(PGPHelper.getSecretKeyRing(secretKeyId)); if (secretKey == null) { alert.setTitle(R.string.title_keyNotFound); alert.setMessage(getString(R.string.keyNotFound, secretKeyId)); @@ -144,7 +144,7 @@ public class PassphraseDialogFragment extends DialogFragment { alert.setCancelable(false); return alert.create(); } - String userId = Apg.getMainUserIdSafe(activity, secretKey); + String userId = PGPHelper.getMainUserIdSafe(activity, secretKey); alert.setMessage(getString(R.string.passPhraseFor, userId)); } @@ -189,7 +189,7 @@ public class PassphraseDialogFragment extends DialogFragment { // cache the new passphrase Log.d(Constants.TAG, "Everything okay! Caching entered passphrase"); - Apg.setCachedPassPhrase(keyId, passPhrase); + PGPHelper.setCachedPassPhrase(keyId, passPhrase); sendMessageToHandler(MESSAGE_OKAY); } |