From 89a4c38cc09425ac2e302882a63a30bdfe8a7e86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Tue, 4 Mar 2014 15:18:05 +0100 Subject: return SIGNATURE_SUCCESS_UNCERTIFIED from service --- OpenPGP-Keychain/src/main/AndroidManifest.xml | 3 ++- .../org/sufficientlysecure/keychain/service/remote/OpenPgpService.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'OpenPGP-Keychain/src/main') diff --git a/OpenPGP-Keychain/src/main/AndroidManifest.xml b/OpenPGP-Keychain/src/main/AndroidManifest.xml index 749229115..cec1422d9 100644 --- a/OpenPGP-Keychain/src/main/AndroidManifest.xml +++ b/OpenPGP-Keychain/src/main/AndroidManifest.xml @@ -22,7 +22,8 @@ Remarks about the ugly android:pathPattern: - We are matching all files with a specific file ending. This is done in an ugly way because of Android limitations. - Read http://stackoverflow.com/questions/1733195/android-intent-filter-for-a-particular-file-extension and http://stackoverflow.com/questions/3400072/pathpattern-to-match-file-extension-does-not-work-if-a-period-exists-elsewhere-i/8599921 + Read http://stackoverflow.com/questions/1733195/android-intent-filter-for-a-particular-file-extension + and http://stackoverflow.com/questions/3400072/pathpattern-to-match-file-extension-does-not-work-if-a-period-exists-elsewhere-i/8599921 for more information. - Do _not_ set mimeType for gpg! Cyanogenmod's file manager will only show Keychain for gpg files if no mimeType is set! diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/remote/OpenPgpService.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/remote/OpenPgpService.java index 8c8e6f00a..5d2f5a815 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/remote/OpenPgpService.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/remote/OpenPgpService.java @@ -369,9 +369,10 @@ public class OpenPgpService extends RemoteService { boolean signatureOnly = outputBundle .getBoolean(KeychainIntentService.RESULT_CLEARTEXT_SIGNATURE_ONLY, false); + // TODO: SIGNATURE_SUCCESS_CERTIFIED is currently not implemented int signatureStatus = OpenPgpSignatureResult.SIGNATURE_ERROR; if (signatureSuccess) { - signatureStatus = OpenPgpSignatureResult.SIGNATURE_SUCCESS_CERTIFIED; + signatureStatus = OpenPgpSignatureResult.SIGNATURE_SUCCESS_UNCERTIFIED; } else if (signatureUnknown) { signatureStatus = OpenPgpSignatureResult.SIGNATURE_UNKNOWN_PUB_KEY; -- cgit v1.2.3 From 06f9134eb1c386446d56fe58fa49c35b7482ed86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Tue, 4 Mar 2014 20:53:44 +0100 Subject: Enforce private key for applications, verify signed-only texts without passphrase input, better internal decrypt and verify method --- .../keychain/pgp/PgpDecryptVerify.java | 137 +++++++++++++++------ .../keychain/pgp/PgpDecryptVerifyResult.java | 88 +++++++++++++ .../keychain/service/KeychainIntentService.java | 19 ++- .../keychain/service/remote/OpenPgpService.java | 111 +++-------------- .../keychain/ui/DecryptActivity.java | 57 ++++++--- 5 files changed, 250 insertions(+), 162 deletions(-) create mode 100644 OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerifyResult.java (limited to 'OpenPGP-Keychain/src/main') diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java index fb97f3a5c..be80da4e3 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java @@ -18,8 +18,8 @@ package org.sufficientlysecure.keychain.pgp; import android.content.Context; -import android.os.Bundle; +import org.openintents.openpgp.OpenPgpSignatureResult; import org.spongycastle.bcpg.ArmoredInputStream; import org.spongycastle.bcpg.SignatureSubpacketTags; import org.spongycastle.openpgp.PGPCompressedData; @@ -36,6 +36,7 @@ import org.spongycastle.openpgp.PGPPublicKey; import org.spongycastle.openpgp.PGPPublicKeyEncryptedData; import org.spongycastle.openpgp.PGPPublicKeyRing; import org.spongycastle.openpgp.PGPSecretKey; +import org.spongycastle.openpgp.PGPSecretKeyRing; import org.spongycastle.openpgp.PGPSignature; import org.spongycastle.openpgp.PGPSignatureList; import org.spongycastle.openpgp.PGPSignatureSubpacketVector; @@ -53,7 +54,7 @@ import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException; import org.sufficientlysecure.keychain.provider.ProviderHelper; -import org.sufficientlysecure.keychain.service.KeychainIntentService; +import org.sufficientlysecure.keychain.service.PassphraseCacheService; import org.sufficientlysecure.keychain.util.InputData; import org.sufficientlysecure.keychain.util.Log; import org.sufficientlysecure.keychain.util.ProgressDialogUpdater; @@ -75,9 +76,10 @@ public class PgpDecryptVerify { private InputData data; private OutputStream outStream; - private ProgressDialogUpdater progress; - boolean assumeSymmetric; - String passphrase; + private ProgressDialogUpdater progressDialogUpdater; + private boolean assumeSymmetric; + private String passphrase; + private long enforcedKeyId; private PgpDecryptVerify(Builder builder) { // private Constructor can only be called from Builder @@ -85,9 +87,10 @@ public class PgpDecryptVerify { this.data = builder.data; this.outStream = builder.outStream; - this.progress = builder.progress; + this.progressDialogUpdater = builder.progressDialogUpdater; this.assumeSymmetric = builder.assumeSymmetric; this.passphrase = builder.passphrase; + this.enforcedKeyId = builder.enforcedKeyId; } public static class Builder { @@ -97,9 +100,10 @@ public class PgpDecryptVerify { private OutputStream outStream; // optional - private ProgressDialogUpdater progress = null; + private ProgressDialogUpdater progressDialogUpdater = null; private boolean assumeSymmetric = false; private String passphrase = ""; + private long enforcedKeyId = 0; public Builder(Context context, InputData data, OutputStream outStream) { this.context = context; @@ -107,8 +111,8 @@ public class PgpDecryptVerify { this.outStream = outStream; } - public Builder progress(ProgressDialogUpdater progress) { - this.progress = progress; + public Builder progressDialogUpdater(ProgressDialogUpdater progressDialogUpdater) { + this.progressDialogUpdater = progressDialogUpdater; return this; } @@ -122,20 +126,32 @@ public class PgpDecryptVerify { return this; } + /** + * Allow this key id alone for decryption. + * This means only ciphertexts encrypted for this private key can be decrypted. + * + * @param enforcedKeyId + * @return + */ + public Builder enforcedKeyId(long enforcedKeyId) { + this.enforcedKeyId = enforcedKeyId; + return this; + } + public PgpDecryptVerify build() { return new PgpDecryptVerify(this); } } public void updateProgress(int message, int current, int total) { - if (progress != null) { - progress.setProgress(message, current, total); + if (progressDialogUpdater != null) { + progressDialogUpdater.setProgress(message, current, total); } } public void updateProgress(int current, int total) { - if (progress != null) { - progress.setProgress(current, total); + if (progressDialogUpdater != null) { + progressDialogUpdater.setProgress(current, total); } } @@ -177,9 +193,8 @@ public class PgpDecryptVerify { * @throws PGPException * @throws SignatureException */ - public Bundle execute() + public PgpDecryptVerifyResult execute() throws IOException, PgpGeneralException, PGPException, SignatureException { - // automatically works with ascii armor input and binary InputStream in = PGPUtil.getDecoderStream(data.getInputStream()); if (in instanceof ArmoredInputStream) { @@ -207,9 +222,9 @@ public class PgpDecryptVerify { * @throws PGPException * @throws SignatureException */ - private Bundle decryptVerify(InputStream in) + private PgpDecryptVerifyResult decryptVerify(InputStream in) throws IOException, PgpGeneralException, PGPException, SignatureException { - Bundle returnData = new Bundle(); + PgpDecryptVerifyResult returnData = new PgpDecryptVerifyResult(); PGPObjectFactory pgpF = new PGPObjectFactory(in); PGPEncryptedDataList enc; @@ -277,9 +292,38 @@ public class PgpDecryptVerify { PGPPublicKeyEncryptedData encData = (PGPPublicKeyEncryptedData) obj; secretKey = ProviderHelper.getPGPSecretKeyByKeyId(context, encData.getKeyID()); if (secretKey != null) { + // secret key exists in database + + // allow only a specific key for decryption? + if (enforcedKeyId != 0) { + // TODO: improve this code! get master key directly! + PGPSecretKeyRing secretKeyRing = ProviderHelper.getPGPSecretKeyRingByKeyId(context, encData.getKeyID()); + long masterKeyId = PgpKeyHelper.getMasterKey(secretKeyRing).getKeyID(); + Log.d(Constants.TAG, "encData.getKeyID():" + encData.getKeyID()); + Log.d(Constants.TAG, "enforcedKeyId: " + enforcedKeyId); + Log.d(Constants.TAG, "masterKeyId: " + masterKeyId); + + if (enforcedKeyId != masterKeyId) { + throw new PgpGeneralException(context.getString(R.string.error_no_secret_key_found)); + } + } + pbe = encData; + + // passphrase handling... + if (passphrase == null) { + // try to get cached passphrase + passphrase = PassphraseCacheService.getCachedPassphrase(context, encData.getKeyID()); + } + // if passphrase was not cached, return here! + if (passphrase == null) { + returnData.setKeyPassphraseNeeded(true); + return returnData; + } break; } + + } } @@ -317,6 +361,7 @@ public class PgpDecryptVerify { PGPObjectFactory plainFact = new PGPObjectFactory(clear); Object dataChunk = plainFact.nextObject(); PGPOnePassSignature signature = null; + OpenPgpSignatureResult signatureResult = null; PGPPublicKey signatureKey = null; int signatureIndex = -1; @@ -334,7 +379,7 @@ public class PgpDecryptVerify { if (dataChunk instanceof PGPOnePassSignatureList) { updateProgress(R.string.progress_processing_signature, currentProgress, 100); - returnData.putBoolean(KeychainIntentService.RESULT_SIGNATURE, true); + signatureResult = new OpenPgpSignatureResult(); PGPOnePassSignatureList sigList = (PGPOnePassSignatureList) dataChunk; for (int i = 0; i < sigList.size(); ++i) { signature = sigList.get(i); @@ -354,12 +399,12 @@ public class PgpDecryptVerify { if (signKeyRing != null) { userId = PgpKeyHelper.getMainUserId(PgpKeyHelper.getMasterKey(signKeyRing)); } - returnData.putString(KeychainIntentService.RESULT_SIGNATURE_USER_ID, userId); + signatureResult.setUserId(userId); break; } } - returnData.putLong(KeychainIntentService.RESULT_SIGNATURE_KEY_ID, signatureKeyId); + signatureResult.setKeyId(signatureKeyId); if (signature != null) { JcaPGPContentVerifierBuilderProvider contentVerifierBuilderProvider = new JcaPGPContentVerifierBuilderProvider() @@ -367,7 +412,7 @@ public class PgpDecryptVerify { signature.init(contentVerifierBuilderProvider, signatureKey); } else { - returnData.putBoolean(KeychainIntentService.RESULT_SIGNATURE_UNKNOWN, true); + signatureResult.setStatus(OpenPgpSignatureResult.SIGNATURE_UNKNOWN_PUB_KEY); } dataChunk = plainFact.nextObject(); @@ -395,25 +440,24 @@ public class PgpDecryptVerify { } int n; - // TODO: progress calculation is broken here! Try to rework it based on commented code! -// int progress = 0; + // TODO: progressDialogUpdater calculation is broken here! Try to rework it based on commented code! +// int progressDialogUpdater = 0; long startPos = data.getStreamPosition(); while ((n = dataIn.read(buffer)) > 0) { outStream.write(buffer, 0, n); -// progress += n; +// progressDialogUpdater += n; if (signature != null) { try { signature.update(buffer, 0, n); } catch (SignatureException e) { - returnData - .putBoolean(KeychainIntentService.RESULT_SIGNATURE_SUCCESS, false); + signatureResult.setStatus(OpenPgpSignatureResult.SIGNATURE_ERROR); signature = null; } } // TODO: dead code?! - // unknown size, but try to at least have a moving, slowing down progress bar -// currentProgress = startProgress + (endProgress - startProgress) * progress -// / (progress + 100000); + // unknown size, but try to at least have a moving, slowing down progressDialogUpdater bar +// currentProgress = startProgress + (endProgress - startProgress) * progressDialogUpdater +// / (progressDialogUpdater + 100000); if (data.getSize() - startPos == 0) { currentProgress = endProgress; } else { @@ -430,17 +474,20 @@ public class PgpDecryptVerify { PGPSignature messageSignature = signatureList.get(signatureIndex); // these are not cleartext signatures! - returnData.putBoolean(KeychainIntentService.RESULT_CLEARTEXT_SIGNATURE_ONLY, false); + // TODO: what about binary signatures? + signatureResult.setSignatureOnly(false); //Now check binding signatures boolean keyBinding_isok = verifyKeyBinding(context, messageSignature, signatureKey); boolean sig_isok = signature.verify(messageSignature); - returnData.putBoolean(KeychainIntentService.RESULT_SIGNATURE_SUCCESS, keyBinding_isok & sig_isok); + // TODO: implement CERTIFIED! + if (keyBinding_isok & sig_isok) { + signatureResult.setStatus(OpenPgpSignatureResult.SIGNATURE_SUCCESS_UNCERTIFIED); + } } } - // TODO: test if this integrity really check works! if (encryptedData.isIntegrityProtected()) { updateProgress(R.string.progress_verifying_integrity, 95, 100); @@ -455,9 +502,12 @@ public class PgpDecryptVerify { } else { // no integrity check Log.e(Constants.TAG, "Encrypted data was not integrity protected!"); + // TODO: inform user? } updateProgress(R.string.progress_done, 100, 100); + + returnData.setSignatureResult(signatureResult); return returnData; } @@ -474,11 +524,12 @@ public class PgpDecryptVerify { * @throws PGPException * @throws SignatureException */ - private Bundle verifyCleartextSignature(ArmoredInputStream aIn) + private PgpDecryptVerifyResult verifyCleartextSignature(ArmoredInputStream aIn) throws IOException, PgpGeneralException, PGPException, SignatureException { - Bundle returnData = new Bundle(); + PgpDecryptVerifyResult returnData = new PgpDecryptVerifyResult(); + OpenPgpSignatureResult signatureResult = new OpenPgpSignatureResult(); // cleartext signatures are never encrypted ;) - returnData.putBoolean(KeychainIntentService.RESULT_CLEARTEXT_SIGNATURE_ONLY, true); + signatureResult.setSignatureOnly(true); ByteArrayOutputStream out = new ByteArrayOutputStream(); @@ -504,8 +555,6 @@ public class PgpDecryptVerify { byte[] clearText = out.toByteArray(); outStream.write(clearText); - returnData.putBoolean(KeychainIntentService.RESULT_SIGNATURE, true); - updateProgress(R.string.progress_processing_signature, 60, 100); PGPObjectFactory pgpFact = new PGPObjectFactory(aIn); @@ -533,15 +582,15 @@ public class PgpDecryptVerify { if (signKeyRing != null) { userId = PgpKeyHelper.getMainUserId(PgpKeyHelper.getMasterKey(signKeyRing)); } - returnData.putString(KeychainIntentService.RESULT_SIGNATURE_USER_ID, userId); + signatureResult.setUserId(userId); break; } } - returnData.putLong(KeychainIntentService.RESULT_SIGNATURE_KEY_ID, signatureKeyId); + signatureResult.setKeyId(signatureKeyId); if (signature == null) { - returnData.putBoolean(KeychainIntentService.RESULT_SIGNATURE_UNKNOWN, true); + signatureResult.setStatus(OpenPgpSignatureResult.SIGNATURE_UNKNOWN_PUB_KEY); updateProgress(R.string.progress_done, 100, 100); return returnData; } @@ -574,9 +623,15 @@ public class PgpDecryptVerify { //Now check binding signatures boolean keyBinding_isok = verifyKeyBinding(context, signature, signatureKey); - returnData.putBoolean(KeychainIntentService.RESULT_SIGNATURE_SUCCESS, sig_isok & keyBinding_isok); + if (sig_isok & keyBinding_isok) { + signatureResult.setStatus(OpenPgpSignatureResult.SIGNATURE_SUCCESS_UNCERTIFIED); + } + + // TODO: what about SIGNATURE_SUCCESS_CERTIFIED and SIGNATURE_ERROR???? updateProgress(R.string.progress_done, 100, 100); + + returnData.setSignatureResult(signatureResult); return returnData; } diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerifyResult.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerifyResult.java new file mode 100644 index 000000000..0477c4fdf --- /dev/null +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerifyResult.java @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2014 Dominik Schürmann + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package org.sufficientlysecure.keychain.pgp; + +import android.os.Parcel; +import android.os.Parcelable; + +import org.openintents.openpgp.OpenPgpSignatureResult; + +public class PgpDecryptVerifyResult implements Parcelable { + boolean symmetricPassphraseNeeded; + boolean keyPassphraseNeeded; + OpenPgpSignatureResult signatureResult; + + public boolean isSymmetricPassphraseNeeded() { + return symmetricPassphraseNeeded; + } + + public void setSymmetricPassphraseNeeded(boolean symmetricPassphraseNeeded) { + this.symmetricPassphraseNeeded = symmetricPassphraseNeeded; + } + + public boolean isKeyPassphraseNeeded() { + return keyPassphraseNeeded; + } + + public void setKeyPassphraseNeeded(boolean keyPassphraseNeeded) { + this.keyPassphraseNeeded = keyPassphraseNeeded; + } + + public OpenPgpSignatureResult getSignatureResult() { + return signatureResult; + } + + public void setSignatureResult(OpenPgpSignatureResult signatureResult) { + this.signatureResult = signatureResult; + } + + public PgpDecryptVerifyResult() { + + } + + public PgpDecryptVerifyResult(PgpDecryptVerifyResult b) { + this.symmetricPassphraseNeeded = b.symmetricPassphraseNeeded; + this.keyPassphraseNeeded = b.keyPassphraseNeeded; + this.signatureResult = b.signatureResult; + } + + + public int describeContents() { + return 0; + } + + public void writeToParcel(Parcel dest, int flags) { + dest.writeByte((byte) (symmetricPassphraseNeeded ? 1 : 0)); + dest.writeByte((byte) (keyPassphraseNeeded ? 1 : 0)); + dest.writeParcelable(signatureResult, 0); + } + + public static final Creator CREATOR = new Creator() { + public PgpDecryptVerifyResult createFromParcel(final Parcel source) { + PgpDecryptVerifyResult vr = new PgpDecryptVerifyResult(); + vr.symmetricPassphraseNeeded = source.readByte() == 1; + vr.keyPassphraseNeeded = source.readByte() == 1; + vr.signatureResult = source.readParcelable(OpenPgpSignatureResult.class.getClassLoader()); + return vr; + } + + public PgpDecryptVerifyResult[] newArray(final int size) { + return new PgpDecryptVerifyResult[size]; + } + }; +} diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java index 302dbea0b..9c499ebd7 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java @@ -44,6 +44,7 @@ import org.sufficientlysecure.keychain.helper.OtherHelper; import org.sufficientlysecure.keychain.helper.Preferences; import org.sufficientlysecure.keychain.pgp.PgpConversionHelper; import org.sufficientlysecure.keychain.pgp.PgpDecryptVerify; +import org.sufficientlysecure.keychain.pgp.PgpDecryptVerifyResult; import org.sufficientlysecure.keychain.pgp.PgpHelper; import org.sufficientlysecure.keychain.pgp.PgpImportExport; import org.sufficientlysecure.keychain.pgp.PgpKeyOperation; @@ -181,13 +182,7 @@ public class KeychainIntentService extends IntentService implements ProgressDial // decrypt/verify public static final String RESULT_DECRYPTED_STRING = "decrypted_message"; public static final String RESULT_DECRYPTED_BYTES = "decrypted_data"; - public static final String RESULT_SIGNATURE = "signature"; - public static final String RESULT_SIGNATURE_KEY_ID = "signature_key_id"; - public static final String RESULT_SIGNATURE_USER_ID = "signature_user_id"; - public static final String RESULT_CLEARTEXT_SIGNATURE_ONLY = "signature_only"; - - public static final String RESULT_SIGNATURE_SUCCESS = "signature_success"; - public static final String RESULT_SIGNATURE_UNKNOWN = "signature_unknown"; + public static final String RESULT_DECRYPT_VERIFY_RESULT = "signature"; // import public static final String RESULT_IMPORT_ADDED = "added"; @@ -489,15 +484,17 @@ public class KeychainIntentService extends IntentService implements ProgressDial // verifyText and decrypt returning additional resultData values for the // verification of signatures PgpDecryptVerify.Builder builder = new PgpDecryptVerify.Builder(this, inputData, outStream); - builder.progress(this); + builder.progressDialogUpdater(this); builder.assumeSymmetric(assumeSymmetricEncryption) .passphrase(PassphraseCacheService.getCachedPassphrase(this, secretKeyId)); - resultData = builder.build().execute(); + PgpDecryptVerifyResult decryptVerifyResult = builder.build().execute(); outStream.close(); + resultData.putParcelable(RESULT_DECRYPT_VERIFY_RESULT, decryptVerifyResult); + /* Output */ switch (target) { @@ -867,10 +864,10 @@ public class KeychainIntentService extends IntentService implements ProgressDial } /** - * Set progress of ProgressDialog by sending message to handler on UI thread + * Set progressDialogUpdater of ProgressDialog by sending message to handler on UI thread */ public void setProgress(String message, int progress, int max) { - Log.d(Constants.TAG, "Send message by setProgress with progress=" + progress + ", max=" + Log.d(Constants.TAG, "Send message by setProgress with progressDialogUpdater=" + progress + ", max=" + max); Bundle data = new Bundle(); diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/remote/OpenPgpService.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/remote/OpenPgpService.java index 5d2f5a815..8b34c4421 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/remote/OpenPgpService.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/remote/OpenPgpService.java @@ -21,7 +21,6 @@ import android.app.PendingIntent; import android.content.Intent; import android.database.Cursor; import android.net.Uri; -import android.os.Bundle; import android.os.IBinder; import android.os.ParcelFileDescriptor; @@ -33,9 +32,10 @@ import org.spongycastle.util.Arrays; import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.Id; import org.sufficientlysecure.keychain.pgp.PgpDecryptVerify; +import org.sufficientlysecure.keychain.pgp.PgpDecryptVerifyResult; import org.sufficientlysecure.keychain.pgp.PgpSignEncrypt; +import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException; import org.sufficientlysecure.keychain.provider.KeychainContract; -import org.sufficientlysecure.keychain.service.KeychainIntentService; import org.sufficientlysecure.keychain.service.PassphraseCacheService; import org.sufficientlysecure.keychain.util.InputData; import org.sufficientlysecure.keychain.util.Log; @@ -284,98 +284,29 @@ public class OpenPgpService extends RemoteService { Intent result = new Intent(); try { - // TODO: - // fix the mess: http://stackoverflow.com/questions/148130/how-do-i-peek-at-the-first-two-bytes-in-an-inputstream - // should we allow to decrypt everything under every key id or only the one set? - // TODO: instead of trying to get the passphrase before - // pause stream when passphrase is missing and then resume - - // TODO: put this code into PgpDecryptVerify class - - // TODO: This allows to decrypt messages with ALL secret keys, not only the one for the - // app, Fix this? -// String passphrase = null; -// if (!signedOnly) { -// // BEGIN Get key -// // TODO: this input stream is consumed after PgpMain.getDecryptionKeyId()... do it -// // better! -// InputStream inputStream2 = new ByteArrayInputStream(inputBytes); -// -// // TODO: duplicates functions from DecryptActivity! -// long secretKeyId; -// try { -// if (inputStream2.markSupported()) { -// // should probably set this to the max size of two -// // pgpF objects, if it even needs to be anything other -// // than 0. -// inputStream2.mark(200); -// } -// secretKeyId = PgpHelper.getDecryptionKeyId(this, inputStream2); -// if (secretKeyId == Id.key.none) { -// throw new PgpGeneralException(getString(R.string.error_no_secret_key_found)); -// } -// } catch (NoAsymmetricEncryptionException e) { -// if (inputStream2.markSupported()) { -// inputStream2.reset(); -// } -// secretKeyId = Id.key.symmetric; -// if (!PgpDecryptVerify.hasSymmetricEncryption(this, inputStream2)) { -// throw new PgpGeneralException( -// getString(R.string.error_no_known_encryption_found)); -// } -// // we do not support symmetric decryption from the API! -// throw new Exception("Symmetric decryption is not supported!"); -// } -// -// Log.d(Constants.TAG, "secretKeyId " + secretKeyId); - - // NOTE: currently this only gets the passphrase for the key set for this client - String passphrase; - if (data.hasExtra(OpenPgpApi.EXTRA_PASSPHRASE)) { - passphrase = data.getStringExtra(OpenPgpApi.EXTRA_PASSPHRASE); - } else { - passphrase = PassphraseCacheService.getCachedPassphrase(getContext(), appSettings.getKeyId()); - } - if (passphrase == null) { - // get PendingIntent for passphrase input, add it to given params and return to client - Intent passphraseBundle = getPassphraseBundleIntent(data, appSettings.getKeyId()); - return passphraseBundle; - } - + String passphrase = data.getStringExtra(OpenPgpApi.EXTRA_PASSPHRASE); long inputLength = is.available(); InputData inputData = new InputData(is, inputLength); - Bundle outputBundle; PgpDecryptVerify.Builder builder = new PgpDecryptVerify.Builder(this, inputData, os); - - builder.assumeSymmetric(false) + builder.assumeSymmetric(false) // no support for symmetric encryption + .enforcedKeyId(appSettings.getKeyId()) // allow only the private key for this app for decryption .passphrase(passphrase); - // TODO: this also decrypts with other secret keys that have no passphrase!!! - outputBundle = builder.build().execute(); - - //TODO: instead of using all these wrapping use OpenPgpSignatureResult directly - // in DecryptVerify class and then in DecryptActivity - boolean signature = outputBundle.getBoolean(KeychainIntentService.RESULT_SIGNATURE, false); - if (signature) { - long signatureKeyId = outputBundle - .getLong(KeychainIntentService.RESULT_SIGNATURE_KEY_ID, 0); - String signatureUserId = outputBundle - .getString(KeychainIntentService.RESULT_SIGNATURE_USER_ID); - boolean signatureSuccess = outputBundle - .getBoolean(KeychainIntentService.RESULT_SIGNATURE_SUCCESS, false); - boolean signatureUnknown = outputBundle - .getBoolean(KeychainIntentService.RESULT_SIGNATURE_UNKNOWN, false); - boolean signatureOnly = outputBundle - .getBoolean(KeychainIntentService.RESULT_CLEARTEXT_SIGNATURE_ONLY, false); - - // TODO: SIGNATURE_SUCCESS_CERTIFIED is currently not implemented - int signatureStatus = OpenPgpSignatureResult.SIGNATURE_ERROR; - if (signatureSuccess) { - signatureStatus = OpenPgpSignatureResult.SIGNATURE_SUCCESS_UNCERTIFIED; - } else if (signatureUnknown) { - signatureStatus = OpenPgpSignatureResult.SIGNATURE_UNKNOWN_PUB_KEY; + // TODO: currently does not support binary signed-only content + PgpDecryptVerifyResult decryptVerifyResult = builder.build().execute(); + if (decryptVerifyResult.isKeyPassphraseNeeded()) { + // get PendingIntent for passphrase input, add it to given params and return to client + Intent passphraseBundle = getPassphraseBundleIntent(data, appSettings.getKeyId()); + return passphraseBundle; + } else if (decryptVerifyResult.isSymmetricPassphraseNeeded()) { + throw new PgpGeneralException("Decryption of symmetric content not supported by API!"); + } + + OpenPgpSignatureResult signatureResult = decryptVerifyResult.getSignatureResult(); + if (signatureResult != null) { + if (signatureResult.getStatus() == OpenPgpSignatureResult.SIGNATURE_UNKNOWN_PUB_KEY) { // If signature is unknown we return an additional PendingIntent // to retrieve the missing key // TODO!!! @@ -390,11 +321,9 @@ public class OpenPgpService extends RemoteService { result.putExtra(OpenPgpApi.RESULT_INTENT, pi); } - - OpenPgpSignatureResult sigResult = new OpenPgpSignatureResult(signatureStatus, - signatureUserId, signatureOnly, signatureKeyId); - result.putExtra(OpenPgpApi.RESULT_SIGNATURE, sigResult); + result.putExtra(OpenPgpApi.RESULT_SIGNATURE, signatureResult); } + } finally { is.close(); os.close(); diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptActivity.java index 9bb675db0..a81576687 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptActivity.java @@ -25,6 +25,7 @@ import java.io.FileNotFoundException; import java.io.InputStream; import java.util.regex.Matcher; +import org.openintents.openpgp.OpenPgpSignatureResult; import org.spongycastle.openpgp.PGPPublicKeyRing; import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.Id; @@ -32,6 +33,7 @@ import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.compatibility.ClipboardReflection; import org.sufficientlysecure.keychain.helper.ActionBarHelper; import org.sufficientlysecure.keychain.helper.FileHelper; +import org.sufficientlysecure.keychain.pgp.PgpDecryptVerifyResult; import org.sufficientlysecure.keychain.pgp.PgpHelper; import org.sufficientlysecure.keychain.pgp.PgpKeyHelper; import org.sufficientlysecure.keychain.pgp.PgpDecryptVerify; @@ -690,11 +692,15 @@ public class DecryptActivity extends DrawerActivity { } - if (returnData.getBoolean(KeychainIntentService.RESULT_SIGNATURE)) { - String userId = returnData - .getString(KeychainIntentService.RESULT_SIGNATURE_USER_ID); - mSignatureKeyId = returnData - .getLong(KeychainIntentService.RESULT_SIGNATURE_KEY_ID); + PgpDecryptVerifyResult decryptVerifyResult = + returnData.getParcelable(KeychainIntentService.RESULT_DECRYPT_VERIFY_RESULT); + + OpenPgpSignatureResult signatureResult = decryptVerifyResult.getSignatureResult(); + + if (signatureResult != null) { + + String userId = signatureResult.getUserId(); + mSignatureKeyId = signatureResult.getKeyId(); mUserIdRest.setText("id: " + PgpKeyHelper.convertKeyIdToHex(mSignatureKeyId)); if (userId == null) { @@ -707,19 +713,32 @@ public class DecryptActivity extends DrawerActivity { } mUserId.setText(userId); - if (returnData.getBoolean(KeychainIntentService.RESULT_SIGNATURE_SUCCESS)) { - mSignatureStatusImage.setImageResource(R.drawable.overlay_ok); - mLookupKey.setVisibility(View.GONE); - } else if (returnData - .getBoolean(KeychainIntentService.RESULT_SIGNATURE_UNKNOWN)) { - mSignatureStatusImage.setImageResource(R.drawable.overlay_error); - mLookupKey.setVisibility(View.VISIBLE); - AppMsg.makeText(DecryptActivity.this, - R.string.unknown_signature, - AppMsg.STYLE_ALERT).show(); - } else { - mSignatureStatusImage.setImageResource(R.drawable.overlay_error); - mLookupKey.setVisibility(View.GONE); + switch (signatureResult.getStatus()) { + case OpenPgpSignatureResult.SIGNATURE_SUCCESS_UNCERTIFIED: { + mSignatureStatusImage.setImageResource(R.drawable.overlay_ok); + mLookupKey.setVisibility(View.GONE); + break; + } + + // TODO! +// case OpenPgpSignatureResult.SIGNATURE_SUCCESS_CERTIFIED: { +// break; +// } + + case OpenPgpSignatureResult.SIGNATURE_UNKNOWN_PUB_KEY: { + mSignatureStatusImage.setImageResource(R.drawable.overlay_error); + mLookupKey.setVisibility(View.VISIBLE); + AppMsg.makeText(DecryptActivity.this, + R.string.unknown_signature, + AppMsg.STYLE_ALERT).show(); + break; + } + + default: { + mSignatureStatusImage.setImageResource(R.drawable.overlay_error); + mLookupKey.setVisibility(View.GONE); + break; + } } mSignatureLayout.setVisibility(View.VISIBLE); } @@ -733,7 +752,7 @@ public class DecryptActivity extends DrawerActivity { Messenger messenger = new Messenger(saveHandler); intent.putExtra(KeychainIntentService.EXTRA_MESSENGER, messenger); - // show progress dialog + // show progressDialogUpdater dialog saveHandler.showProgressDialog(this); // start service with intent -- cgit v1.2.3 From fe8044d18172faf21ac8085c823eb4f8e13a35ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Tue, 4 Mar 2014 20:58:53 +0100 Subject: 2.3.1 beta2 --- OpenPGP-Keychain/src/main/AndroidManifest.xml | 4 ++-- .../main/java/org/sufficientlysecure/keychain/ui/DecryptActivity.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenPGP-Keychain/src/main') diff --git a/OpenPGP-Keychain/src/main/AndroidManifest.xml b/OpenPGP-Keychain/src/main/AndroidManifest.xml index cec1422d9..76c4c6a2e 100644 --- a/OpenPGP-Keychain/src/main/AndroidManifest.xml +++ b/OpenPGP-Keychain/src/main/AndroidManifest.xml @@ -2,8 +2,8 @@ + android:versionCode="23102" + android:versionName="2.3.1 beta2"> - OpenKeychain: Datei entschlüsseln - OpenKeychain: Schlüssel importieren - OpenKeychain: Verschlüsseln - OpenKeychain: Entschlüsseln Keine registrierten Anwendungen vorhanden!\n\nAnwendungen von Dritten können Zugriff auf OpenKeychain erbitten. Nachdem Zugriff gewährt wurde, werden diese hier aufgelistet. Erweiterte Einstellungen anzeigen diff --git a/OpenPGP-Keychain/src/main/res/values-es/strings.xml b/OpenPGP-Keychain/src/main/res/values-es/strings.xml index 48ea6cc69..e07e049cd 100644 --- a/OpenPGP-Keychain/src/main/res/values-es/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-es/strings.xml @@ -266,6 +266,9 @@ la fecha de caducidad debe ser posterior a la fecha de creación no puedes eliminar este contacto porque eres tú mismo. no puedes eliminar los siguientes contactos porque son tú mismo:\n%s + Consulta al servidor insuficiente + La consulta al servidor de claves ha fallado + Demasiadas respuestas Por favor, bórralo desde la pantalla \'Mis claves\'! Por favor, bórralos desde la pantalla \'Mis claves\'! @@ -337,10 +340,10 @@ Ayuda Tomar la clave desde el portapapeles - OpenKeychain: Descifrar archivo - OpenKeychain: Importar clave - OpenKeychain: Cifrar - OpenKeychain: Descifrar + Descifrar archivo con OpenKeychain + Importar clave con OpenKeychain + Cifrar con OpenKeychain + Descifrar con OpenKeychain ¡No hay aplicaciones registradas!\n\nLas aplicaciones de terceros pueden pedir permiso de acceso a OpenKeychain. Después de obtener acceso, serán enumeradas aquí. Mostrar la configuración avanzada diff --git a/OpenPGP-Keychain/src/main/res/values-fr/strings.xml b/OpenPGP-Keychain/src/main/res/values-fr/strings.xml index bf66756cf..563ee636e 100644 --- a/OpenPGP-Keychain/src/main/res/values-fr/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-fr/strings.xml @@ -340,10 +340,10 @@ Aide Obtenir la clef depuis le presse-papiers - OpenKeychain : déchiffrer le ficher - OpenKeychain : importer la clef - OpenKeychain : chiffrer - OpenKeychain : déchiffrer + Déchiffrer le fichier avec OpenKeychain + Importer la clef avec OpenKeychain + Chiffrer avec OpenKeychain + Déchiffrer avec OpenKeychain Aucune application enregistrée !\n\nLes applications tierces peuvent demander l\'accès à OpenKeychain. Après avoir autorisé l\'accès, elles seront listées ici. Afficher les paramètres avancés diff --git a/OpenPGP-Keychain/src/main/res/values-it-rIT/strings.xml b/OpenPGP-Keychain/src/main/res/values-it-rIT/strings.xml index 86a094c41..041a9d0f1 100644 --- a/OpenPGP-Keychain/src/main/res/values-it-rIT/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-it-rIT/strings.xml @@ -340,10 +340,10 @@ Aiuto Ottieni chiave dagli appunti - OpenKeyChain: Decodifica File - OpenKeyChain: Importa Chiave - OpenKeychain: Codifica - OpenKeychain: Decodifica + Decodifica File con OpenKeychain + Importa Chiave con OpenKeychain + Codifica con OpenKeychain + Decodifica con OpenKeychain Nessuna app registrata!\n\nApp di terza parti possono richiedere accesso a OpenKeychain. Dopo aver concesso l\'accesso, saranno elencate qui. Mostra impostazioni avanzate diff --git a/OpenPGP-Keychain/src/main/res/values-ja/strings.xml b/OpenPGP-Keychain/src/main/res/values-ja/strings.xml index c99f8b31c..0c80d4a2c 100644 --- a/OpenPGP-Keychain/src/main/res/values-ja/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-ja/strings.xml @@ -329,10 +329,10 @@ ヘルプ クリップボードから鍵を取得 - OpenKeychain: ファイル復号化 - OpenKeychain: 鍵のインポート - OpenKeychain: 暗号化 - OpenKeychain: 復号化 + OpenKeychainでファイルを復号化 + OpenKeychainに鍵をインポート + OpenKeychainで暗号化 + OpenKeychainで復号化 登録されていないアプリケーション!\n\nサードパーティアプリケーションはOpenKeychainにアクセスを要求できます。アクセスを与えた後、それらはここにリストされます。 拡張設定を表示 diff --git a/OpenPGP-Keychain/src/main/res/values-uk/strings.xml b/OpenPGP-Keychain/src/main/res/values-uk/strings.xml index 7f1766a5c..c883ea583 100644 --- a/OpenPGP-Keychain/src/main/res/values-uk/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-uk/strings.xml @@ -351,10 +351,10 @@ Довідка Отримати ключ з буфера обміну - OpenPGP: розшифрувати файл - OpenPGP: імпортувати ключ - OpenPGP: зашифрувати - OpenPGP: розшифрувати + Розшифрувати файл з OpenKeychain + Імпортувати ключ з OpenKeychain + Зашифрувати з OpenKeychain + Розшифрувати з OpenKeychain Нема зареєстрованих програм!\n\nСтороні програми можуть вимагати доступ до OpenPGP Keychain. Після надання доступу вони будуть наведені тут. Показати додаткові налаштування -- cgit v1.2.3 From e1f525a0ac9614ed10538ce1552cf036c06fb88c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Tue, 4 Mar 2014 22:17:45 +0100 Subject: name KeychainIntentService properly --- .../org/sufficientlysecure/keychain/service/KeychainIntentService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenPGP-Keychain/src/main') diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java index 9c499ebd7..cf507826e 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java @@ -201,7 +201,7 @@ public class KeychainIntentService extends IntentService implements ProgressDial private boolean mIsCanceled; public KeychainIntentService() { - super("ApgService"); + super("KeychainIntentService"); } @Override -- cgit v1.2.3 From a83c18bafbb8bb0316716a1d934363e43bec93f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Tue, 4 Mar 2014 22:20:59 +0100 Subject: Remove unused imports --- .../main/java/org/sufficientlysecure/keychain/util/KeyServer.java | 6 ------ 1 file changed, 6 deletions(-) (limited to 'OpenPGP-Keychain/src/main') diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/KeyServer.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/KeyServer.java index 072affb1f..3d72c00c0 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/KeyServer.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/KeyServer.java @@ -16,14 +16,8 @@ package org.sufficientlysecure.keychain.util; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Date; import java.util.List; -import android.os.Parcel; -import android.os.Parcelable; - import org.sufficientlysecure.keychain.ui.adapter.ImportKeysListEntry; public abstract class KeyServer { -- cgit v1.2.3 From 61ee811d600f9f0d27fc4ac5ef0b6ca32a5b1ed2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Tue, 4 Mar 2014 22:42:44 +0100 Subject: Fix license header of key server files --- .../main/java/org/sufficientlysecure/keychain/util/HkpKeyServer.java | 4 +++- .../src/main/java/org/sufficientlysecure/keychain/util/KeyServer.java | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'OpenPGP-Keychain/src/main') diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/HkpKeyServer.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/HkpKeyServer.java index b94c42e90..921d22f21 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/HkpKeyServer.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/HkpKeyServer.java @@ -1,6 +1,8 @@ /* + * Copyright (C) 2012-2014 Dominik Schürmann + * Copyright (C) 2011 Thialfihar * Copyright (C) 2011 Senecaso - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/KeyServer.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/KeyServer.java index 3d72c00c0..b1e6b3c71 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/KeyServer.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/KeyServer.java @@ -1,6 +1,8 @@ /* + * Copyright (C) 2012-2014 Dominik Schürmann + * Copyright (C) 2011 Thialfihar * Copyright (C) 2011 Senecaso - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -- cgit v1.2.3 From 875adae40c669620f617307d0a7f9bb4241aaac5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Tue, 4 Mar 2014 23:14:52 +0100 Subject: Code cleaning in PgpDecryptVerify --- .../keychain/pgp/PgpDecryptVerify.java | 88 +++++++++++----------- 1 file changed, 46 insertions(+), 42 deletions(-) (limited to 'OpenPGP-Keychain/src/main') diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java index be80da4e3..345069d9d 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java @@ -440,12 +440,12 @@ public class PgpDecryptVerify { } int n; - // TODO: progressDialogUpdater calculation is broken here! Try to rework it based on commented code! -// int progressDialogUpdater = 0; + // TODO: progress calculation is broken here! Try to rework it based on commented code! +// int progress = 0; long startPos = data.getStreamPosition(); while ((n = dataIn.read(buffer)) > 0) { outStream.write(buffer, 0, n); -// progressDialogUpdater += n; +// progress += n; if (signature != null) { try { signature.update(buffer, 0, n); @@ -455,9 +455,9 @@ public class PgpDecryptVerify { } } // TODO: dead code?! - // unknown size, but try to at least have a moving, slowing down progressDialogUpdater bar -// currentProgress = startProgress + (endProgress - startProgress) * progressDialogUpdater -// / (progressDialogUpdater + 100000); + // unknown size, but try to at least have a moving, slowing down progress bar +// currentProgress = startProgress + (endProgress - startProgress) * progress +// / (progress + 100000); if (data.getSize() - startPos == 0) { currentProgress = endProgress; } else { @@ -478,11 +478,11 @@ public class PgpDecryptVerify { signatureResult.setSignatureOnly(false); //Now check binding signatures - boolean keyBinding_isok = verifyKeyBinding(context, messageSignature, signatureKey); - boolean sig_isok = signature.verify(messageSignature); + boolean validKeyBinding = verifyKeyBinding(context, messageSignature, signatureKey); + boolean validSignature = signature.verify(messageSignature); // TODO: implement CERTIFIED! - if (keyBinding_isok & sig_isok) { + if (validKeyBinding & validSignature) { signatureResult.setStatus(OpenPgpSignatureResult.SIGNATURE_SUCCESS_UNCERTIFIED); } } @@ -618,12 +618,11 @@ public class PgpDecryptVerify { } while (lookAhead != -1); } - boolean sig_isok = signature.verify(); - //Now check binding signatures - boolean keyBinding_isok = verifyKeyBinding(context, signature, signatureKey); + boolean validKeyBinding = verifyKeyBinding(context, signature, signatureKey); + boolean validSignature = signature.verify(); - if (sig_isok & keyBinding_isok) { + if (validSignature & validKeyBinding) { signatureResult.setStatus(OpenPgpSignatureResult.SIGNATURE_SUCCESS_UNCERTIFIED); } @@ -637,34 +636,34 @@ public class PgpDecryptVerify { private static boolean verifyKeyBinding(Context context, PGPSignature signature, PGPPublicKey signatureKey) { long signatureKeyId = signature.getKeyID(); - boolean keyBinding_isok = false; - String userId = null; + boolean validKeyBinding = false; + PGPPublicKeyRing signKeyRing = ProviderHelper.getPGPPublicKeyRingByKeyId(context, signatureKeyId); PGPPublicKey mKey = null; if (signKeyRing != null) { mKey = PgpKeyHelper.getMasterKey(signKeyRing); } + if (signature.getKeyID() != mKey.getKeyID()) { - keyBinding_isok = verifyKeyBinding(mKey, signatureKey); + validKeyBinding = verifyKeyBinding(mKey, signatureKey); } else { //if the key used to make the signature was the master key, no need to check binding sigs - keyBinding_isok = true; + validKeyBinding = true; } - return keyBinding_isok; + return validKeyBinding; } private static boolean verifyKeyBinding(PGPPublicKey masterPublicKey, PGPPublicKey signingPublicKey) { - boolean subkeyBinding_isok = false; - boolean tmp_subkeyBinding_isok = false; - boolean primkeyBinding_isok = false; - JcaPGPContentVerifierBuilderProvider contentVerifierBuilderProvider = new JcaPGPContentVerifierBuilderProvider() - .setProvider(Constants.BOUNCY_CASTLE_PROVIDER_NAME); + boolean validSubkeyBinding = false; + boolean validTempSubkeyBinding = false; + boolean validPrimaryKeyBinding = false; + + JcaPGPContentVerifierBuilderProvider contentVerifierBuilderProvider = + new JcaPGPContentVerifierBuilderProvider() + .setProvider(Constants.BOUNCY_CASTLE_PROVIDER_NAME); Iterator itr = signingPublicKey.getSignatures(); - subkeyBinding_isok = false; - tmp_subkeyBinding_isok = false; - primkeyBinding_isok = false; while (itr.hasNext()) { //what does gpg do if the subkey binding is wrong? //gpg has an invalid subkey binding error on key import I think, but doesn't shout //about keys without subkey signing. Can't get it to import a slightly broken one @@ -674,32 +673,36 @@ public class PgpDecryptVerify { //check and if ok, check primary key binding. try { sig.init(contentVerifierBuilderProvider, masterPublicKey); - tmp_subkeyBinding_isok = sig.verifyCertification(masterPublicKey, signingPublicKey); + validTempSubkeyBinding = sig.verifyCertification(masterPublicKey, signingPublicKey); } catch (PGPException e) { continue; } catch (SignatureException e) { continue; } - if (tmp_subkeyBinding_isok) - subkeyBinding_isok = true; - if (tmp_subkeyBinding_isok) { - primkeyBinding_isok = verifyPrimaryBinding(sig.getUnhashedSubPackets(), masterPublicKey, signingPublicKey); - if (primkeyBinding_isok) + if (validTempSubkeyBinding) + validSubkeyBinding = true; + if (validTempSubkeyBinding) { + validPrimaryKeyBinding = verifyPrimaryKeyBinding(sig.getUnhashedSubPackets(), + masterPublicKey, signingPublicKey); + if (validPrimaryKeyBinding) break; - primkeyBinding_isok = verifyPrimaryBinding(sig.getHashedSubPackets(), masterPublicKey, signingPublicKey); - if (primkeyBinding_isok) + validPrimaryKeyBinding = verifyPrimaryKeyBinding(sig.getHashedSubPackets(), + masterPublicKey, signingPublicKey); + if (validPrimaryKeyBinding) break; } } } - return (subkeyBinding_isok & primkeyBinding_isok); + return (validSubkeyBinding & validPrimaryKeyBinding); } - private static boolean verifyPrimaryBinding(PGPSignatureSubpacketVector Pkts, PGPPublicKey masterPublicKey, PGPPublicKey signingPublicKey) { - boolean primkeyBinding_isok = false; - JcaPGPContentVerifierBuilderProvider contentVerifierBuilderProvider = new JcaPGPContentVerifierBuilderProvider() - .setProvider(Constants.BOUNCY_CASTLE_PROVIDER_NAME); + private static boolean verifyPrimaryKeyBinding(PGPSignatureSubpacketVector Pkts, + PGPPublicKey masterPublicKey, PGPPublicKey signingPublicKey) { + boolean validPrimaryKeyBinding = false; + JcaPGPContentVerifierBuilderProvider contentVerifierBuilderProvider = + new JcaPGPContentVerifierBuilderProvider() + .setProvider(Constants.BOUNCY_CASTLE_PROVIDER_NAME); PGPSignatureList eSigList; if (Pkts.hasSubpacket(SignatureSubpacketTags.EMBEDDED_SIGNATURE)) { @@ -715,8 +718,8 @@ public class PgpDecryptVerify { if (emSig.getSignatureType() == PGPSignature.PRIMARYKEY_BINDING) { try { emSig.init(contentVerifierBuilderProvider, signingPublicKey); - primkeyBinding_isok = emSig.verifyCertification(masterPublicKey, signingPublicKey); - if (primkeyBinding_isok) + validPrimaryKeyBinding = emSig.verifyCertification(masterPublicKey, signingPublicKey); + if (validPrimaryKeyBinding) break; } catch (PGPException e) { continue; @@ -726,7 +729,8 @@ public class PgpDecryptVerify { } } } - return primkeyBinding_isok; + + return validPrimaryKeyBinding; } /** -- cgit v1.2.3 From a1230bbe53d279b44038268d05d85f86ae0ff840 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Wed, 5 Mar 2014 02:06:44 +0100 Subject: Fix passphrase retrieval --- .../keychain/pgp/PgpDecryptVerify.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'OpenPGP-Keychain/src/main') diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java index 345069d9d..c568f462a 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java @@ -310,16 +310,18 @@ public class PgpDecryptVerify { pbe = encData; - // passphrase handling... + // if no passphrase was explicitly set try to get it from the cache service if (passphrase == null) { - // try to get cached passphrase + // returns "" if key has no passphrase passphrase = PassphraseCacheService.getCachedPassphrase(context, encData.getKeyID()); + + // if passphrase was not cached, return here indicating that a passphrase is missing! + if (passphrase == null) { + returnData.setKeyPassphraseNeeded(true); + return returnData; + } } - // if passphrase was not cached, return here! - if (passphrase == null) { - returnData.setKeyPassphraseNeeded(true); - return returnData; - } + break; } @@ -644,7 +646,7 @@ public class PgpDecryptVerify { if (signKeyRing != null) { mKey = PgpKeyHelper.getMasterKey(signKeyRing); } - + if (signature.getKeyID() != mKey.getKeyID()) { validKeyBinding = verifyKeyBinding(mKey, signatureKey); } else { //if the key used to make the signature was the master key, no need to check binding sigs -- cgit v1.2.3 From 7a957840748766345f0180b2a3f8dee761161be4 Mon Sep 17 00:00:00 2001 From: Bhargav Golla Date: Tue, 4 Mar 2014 22:37:56 -0500 Subject: Adding a min date not to go below creation date --- .../java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'OpenPGP-Keychain/src/main') diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java index 6c265057e..b8bb547ee 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java @@ -106,7 +106,8 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener { mDeleteButton.setOnClickListener(this); setExpiryDate(null); - + String creationDate = mCreationDate.getText().toString(); + Date date = DateFormat.getDateInstance().parse(creationDate); mExpiryDateButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { GregorianCalendar date = mExpiryDate; @@ -129,6 +130,7 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener { } } }); + dialog.getDatePicker().setMinDate(date.getTime()); dialog.show(); } }); -- cgit v1.2.3 From e482fe18fe9f61575dae191aa3fc5d3819962786 Mon Sep 17 00:00:00 2001 From: Daniel Hammann Date: Wed, 5 Mar 2014 17:44:55 +0100 Subject: =?UTF-8?q?Lint=20Issue:=20TypographyEllipsis:=20Ellipsis=20string?= =?UTF-8?q?=20can=20be=20replaced=20with=20ellipsis=20character=20Replace?= =?UTF-8?q?=20"..."=20with=20ellipsis=20character=20(=E2=80=A6,=20…)?= =?UTF-8?q?=20...=20->=20=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/res/values-de/strings.xml | 58 ++++++++-------- .../src/main/res/values-es-rCO/strings.xml | 2 +- .../src/main/res/values-es/strings.xml | 74 ++++++++++---------- .../src/main/res/values-fr/strings.xml | 76 ++++++++++----------- .../src/main/res/values-it-rIT/strings.xml | 74 ++++++++++---------- .../src/main/res/values-ja/strings.xml | 72 ++++++++++---------- .../src/main/res/values-nl-rNL/strings.xml | 54 +++++++-------- .../src/main/res/values-ru/strings.xml | 78 +++++++++++----------- .../src/main/res/values-tr/strings.xml | 24 +++---- .../src/main/res/values-zh/strings.xml | 14 ++-- 10 files changed, 263 insertions(+), 263 deletions(-) (limited to 'OpenPGP-Keychain/src/main') diff --git a/OpenPGP-Keychain/src/main/res/values-de/strings.xml b/OpenPGP-Keychain/src/main/res/values-de/strings.xml index df76f4e52..493a3a9bb 100644 --- a/OpenPGP-Keychain/src/main/res/values-de/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-de/strings.xml @@ -15,7 +15,7 @@ Schlüsselserver Passwort ändern Passwort setzen - E-Mail senden... + E-Mail senden… In eine Datei verschlüsseln In eine Datei entschlüsseln Schlüssel importieren @@ -163,7 +163,7 @@ DSA ElGamal RSA - Öffnen... + Öffnen… Warnung Fehler Fehler: %s @@ -273,40 +273,40 @@ fertig. - speichern... - importieren... - exportieren... - erstelle Schlüssel, dies kann bis zu 3 Minuten dauern... - erstelle Schlüssel... - Hauptschlüssel wird vorbereitet... - Hauptschlüssel wird beglaubigt... - erstelle Hauptring... - füge Unterschlüssel hinzu... - Schlüssel wird gespeichert... + speichern… + importieren… + exportieren… + erstelle Schlüssel, dies kann bis zu 3 Minuten dauern… + erstelle Schlüssel… + Hauptschlüssel wird vorbereitet… + Hauptschlüssel wird beglaubigt… + erstelle Hauptring… + füge Unterschlüssel hinzu… + Schlüssel wird gespeichert… Schlüssel wird exportiert… Schlüssel werden exportiert… - extrahiere Signaturschlüssel... - extrahiere Schlüssel... - Datenstrom wird vorbereitet... - Daten werden verschlüsselt... - Daten werden entschlüsselt... - Signatur wird vorbereitet... - Signatur wird erstellt... - Signatur wird verarbeitet... - Signatur wird verifiziert... - signiere... - Daten werden gelesen... - Schlüssel wird gesucht... - Daten werden entpackt... - Integrität wird überprüft... - \'%s\' wird sicher gelöscht... - Anfrage wird gestellt... + extrahiere Signaturschlüssel… + extrahiere Schlüssel… + Datenstrom wird vorbereitet… + Daten werden verschlüsselt… + Daten werden entschlüsselt… + Signatur wird vorbereitet… + Signatur wird erstellt… + Signatur wird verarbeitet… + Signatur wird verifiziert… + signiere… + Daten werden gelesen… + Schlüssel wird gesucht… + Daten werden entpackt… + Integrität wird überprüft… + \'%s\' wird sicher gelöscht… + Anfrage wird gestellt… Öffentliche Schlüssel suchen Private Schlüssel suchen - Teile Schlüssel über... + Teile Schlüssel über… 512 1024 diff --git a/OpenPGP-Keychain/src/main/res/values-es-rCO/strings.xml b/OpenPGP-Keychain/src/main/res/values-es-rCO/strings.xml index 6efe9548d..e43cecc2c 100644 --- a/OpenPGP-Keychain/src/main/res/values-es-rCO/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-es-rCO/strings.xml @@ -12,7 +12,7 @@ Aplicaciones registradas Cambiar contraseña Establecer contraseña - Enviar correo electrónico... + Enviar correo electrónico… Cifrar a archivo Descifrar a archivo Importar claves diff --git a/OpenPGP-Keychain/src/main/res/values-es/strings.xml b/OpenPGP-Keychain/src/main/res/values-es/strings.xml index e07e049cd..edf190184 100644 --- a/OpenPGP-Keychain/src/main/res/values-es/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-es/strings.xml @@ -15,7 +15,7 @@ Prioridad del servidor de claves Cambiar la frase de contraseña Establecer frase de contraseña - Enviar email... + Enviar email… Cifrar hacia archivo Descifrar hacia archivo Importar claves @@ -61,7 +61,7 @@ Siguiente Volver Portapapeles - Compartir con... + Compartir con… Buscar clave Ajustes @@ -80,10 +80,10 @@ Actualizar desde servidor de claves Cargar al servidor de claves Compartir - Compartir la huella digital... - Compartir la clave completa... - con... - con... + Compartir la huella digital… + Compartir la clave completa… + con… + con… con código QR con código QR con NFC @@ -91,7 +91,7 @@ Clave de firma Ajustes de Beam Cancelar - Cifrar hacia... + Cifrar hacia… Firmar Mensaje @@ -163,7 +163,7 @@ DSA ElGamal RSA - Abrir... + Abrir… Advertencia Error Error: %s @@ -275,40 +275,40 @@ hecho. - guardando... - importando... - exportando... - generando la clave, esto puede tardar más de 3 minutos... - construyendo la clave... - preparando la clave maestra... - certificando la clave maestra... - construyendo el anillo maestro... - añadiendo las subclaves... - guardando claves... + guardando… + importando… + exportando… + generando la clave, esto puede tardar más de 3 minutos… + construyendo la clave… + preparando la clave maestra… + certificando la clave maestra… + construyendo el anillo maestro… + añadiendo las subclaves… + guardando claves… - exportando clave... - exportando claves... + exportando clave… + exportando claves… - extrayendo la clave de firma... - extrayendo la clave... - preparando las transmisiones... - cifrando los datos... - descifrando los datos... - preparando la firma... - generando la firma... - procesando la firma... - verificando la firma... - firmando... - leyendo los datos... - localizando la clave... - descomprimiendo los datos... - verificando la integridad... + extrayendo la clave de firma… + extrayendo la clave… + preparando las transmisiones… + cifrando los datos… + descifrando los datos… + preparando la firma… + generando la firma… + procesando la firma… + verificando la firma… + firmando… + leyendo los datos… + localizando la clave… + descomprimiendo los datos… + verificando la integridad… borrando \'%s\' de forma segura… - consultando... + consultando… Buscar claves públicas Buscar claves secretas - Compartir la clave con... + Compartir la clave con… 512 1024 @@ -374,7 +374,7 @@ 1 clave seleccionada. %d claves seleccionadas. - Aún no hay claves disponibles... + Aún no hay claves disponibles… Puedes empezar por o crear tu propia clave diff --git a/OpenPGP-Keychain/src/main/res/values-fr/strings.xml b/OpenPGP-Keychain/src/main/res/values-fr/strings.xml index 563ee636e..171ce1fa5 100644 --- a/OpenPGP-Keychain/src/main/res/values-fr/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-fr/strings.xml @@ -15,7 +15,7 @@ Préférences du serveur de clefs Changer la phrase de passe Définir la phrase de passe - Envoyer un courriel... + Envoyer un courriel… Chiffrer vers un fichier Déchiffrer vers un fichier importer des clefs @@ -61,7 +61,7 @@ Suivant Retour Presse-papiers - Partager avec... + Partager avec… Rechercher la clef Paramètres @@ -80,10 +80,10 @@ Mettre à jour depuis le serveur de clefs Téléverser vers le serveur de clefs Partager - Partager l\'empreinte... - Partager la clef entière... - avec... - avec... + Partager l\'empreinte… + Partager la clef entière… + avec… + avec… par un code QR par un code QR par la NFC @@ -91,7 +91,7 @@ Signer la clef Paramètres Beam Annuler - Chiffrer vers... + Chiffrer vers… Signer Message @@ -163,7 +163,7 @@ DSA ElGamal RSA - Ouvrir... + Ouvrir… Avertissement Erreur Erreur : %s @@ -275,40 +275,40 @@ fait. - sauvegarde... - importation... - exportation... - génération de la clef, ceci peut prendre jusqu\'à 3 minutes... - assemblage de la clef... - préparation de la clef maîtresse... - certification de la clef maîtresse... - assemblage du trousseau maître... - ajout des sous-clefs... - sauvegarde de la clef... + sauvegarde… + importation… + exportation… + génération de la clef, ceci peut prendre jusqu\'à 3 minutes… + assemblage de la clef… + préparation de la clef maîtresse… + certification de la clef maîtresse… + assemblage du trousseau maître… + ajout des sous-clefs… + sauvegarde de la clef… - exportation de la clef... - exportation des clefs... + exportation de la clef… + exportation des clefs… - extraction de la clef de signature... - extraction de la clef... - préparation des flux... - chiffrement des données... - déchiffrement des données... - préparation de la signature... - génération de la signature... - traitement de la signature... - vérification de la signature... - signature... - lecture des données... - recherche de la clef... - décompression des données... - vérification de l\'intégrité... - suppression sûre de « %s »... - interrogation... + extraction de la clef de signature… + extraction de la clef… + préparation des flux… + chiffrement des données… + déchiffrement des données… + préparation de la signature… + génération de la signature… + traitement de la signature… + vérification de la signature… + signature… + lecture des données… + recherche de la clef… + décompression des données… + vérification de l\'intégrité… + suppression sûre de « %s »… + interrogation… Rechercher des clefs publiques Rechercher des clefs secrètes - Partager la clef avec... + Partager la clef avec… 512 1024 @@ -374,7 +374,7 @@ 1 clef choisie %d clefs choisies - Aucune clef encore disponible... + Aucune clef encore disponible… Vous pouvez commencer par ou créer votre propre clef diff --git a/OpenPGP-Keychain/src/main/res/values-it-rIT/strings.xml b/OpenPGP-Keychain/src/main/res/values-it-rIT/strings.xml index 041a9d0f1..5ceb4f45b 100644 --- a/OpenPGP-Keychain/src/main/res/values-it-rIT/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-it-rIT/strings.xml @@ -15,7 +15,7 @@ Preferenze Server delle Chiavi Cambia Frase di Accesso Imposta Frase di Accesso - Invia Mail... + Invia Mail… Codifica File Decodifica File Importa Chiavi @@ -61,7 +61,7 @@ Prossimo Precedente Appunti - Condividi con... + Condividi con… Chiave di ricerca Impostazioni @@ -80,10 +80,10 @@ Aggiorna dal server delle chiavi Carica chiave nel server Condividi - Condivi impronta... - Condividi intera chiave... + Condivi impronta… + Condividi intera chiave… con.. - con... + con… con Codice QR con Codice QR con NFC @@ -91,7 +91,7 @@ Firma chiave Impostazioni Beam Annulla - Codifica su... + Codifica su… Firma Messaggio @@ -163,7 +163,7 @@ DSA ElGamal RSA - Apri... + Apri… Attenzione Errore Errore: %s @@ -275,40 +275,40 @@ fatto. - salvataggio... - importazione... - esportazione... - generazione chiave, richiede fino a 3 minuti... - fabbricazione chiave... - preparazione chiave principale... - certificazione chiave principale... - fabbricazione portachiavi principale... - aggiunta sottochiavi... - salvataggio chiavi... + salvataggio… + importazione… + esportazione… + generazione chiave, richiede fino a 3 minuti… + fabbricazione chiave… + preparazione chiave principale… + certificazione chiave principale… + fabbricazione portachiavi principale… + aggiunta sottochiavi… + salvataggio chiavi… - esportazione chiave... - esportazione chiavi... + esportazione chiave… + esportazione chiavi… - estrazione chiavi di firma... - estrazione chiave... - preparazione flussi... - codifica dati... - decodifica dati... - preparazione firma... - generazione firma... - elaborazione firma... - verifica firma... - firma... - lettura dati... - ricerca chiave... - decompressione dati... - verifica integrita\'... - eliminazione sicura di \'%s\'... - interrogazione... + estrazione chiavi di firma… + estrazione chiave… + preparazione flussi… + codifica dati… + decodifica dati… + preparazione firma… + generazione firma… + elaborazione firma… + verifica firma… + firma… + lettura dati… + ricerca chiave… + decompressione dati… + verifica integrita\'… + eliminazione sicura di \'%s\'… + interrogazione… Ricerca Chiavi Pubbliche Cerca Chiave Privata - Condividi chiave con... + Condividi chiave con… 512 1024 @@ -374,7 +374,7 @@ 1 chiave selezionata. %d chiavi selezionate. - Nessuna chiave disponibile... + Nessuna chiave disponibile… Puoi iniziare da o creazione della tua chiave diff --git a/OpenPGP-Keychain/src/main/res/values-ja/strings.xml b/OpenPGP-Keychain/src/main/res/values-ja/strings.xml index 0c80d4a2c..0ba511c1e 100644 --- a/OpenPGP-Keychain/src/main/res/values-ja/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-ja/strings.xml @@ -15,7 +15,7 @@ 鍵サーバ設定 パスフレーズの変更 パスフレーズの設定 - メールの送信... + メールの送信… 暗号化してファイルに 復号化してファイルに 鍵のインポート @@ -61,7 +61,7 @@ 戻る クリップボード - 共有... + 共有… 鍵検出 設定 @@ -80,10 +80,10 @@ 鍵サーバからの更新 鍵サーバへのアップロード 共有 - 指紋の共有... - すべての鍵の共有... - ...(指紋) - ...(鍵) + 指紋の共有… + すべての鍵の共有… + …(指紋) + …(鍵) QRコードで共有(鍵) QRコードで共有(指紋) NFCで共有 @@ -91,7 +91,7 @@ 鍵を署名 Beamの設定 キャンセル - 暗号化... + 暗号化… 署名 メッセージ @@ -161,7 +161,7 @@ DSA ElGamal RSA - 開く... + 開く… 注意 エラー エラー: %s @@ -266,39 +266,39 @@ 完了。 - 保存... - インポート... - エクスポート... - 鍵の生成、3分ほどかかります... - 鍵の構築中... - 主鍵の準備中... - 主鍵の検証中... - 主鍵輪の構築中... - 副鍵の追加中... - 鍵の保存... + 保存… + インポート… + エクスポート… + 鍵の生成、3分ほどかかります… + 鍵の構築中… + 主鍵の準備中… + 主鍵の検証中… + 主鍵輪の構築中… + 副鍵の追加中… + 鍵の保存… - 鍵のエクスポート... + 鍵のエクスポート… - 署名鍵の取り出し中... - 鍵の取り出し中... - ストリームの準備中... - データの暗号化中... - データの復号化中... - 署名の準備中... - 署名の生成中... - 署名処理中... - 署名の検証中... - 署名中... - データ読み込み中... - 鍵検索中... - データの展開中... - 完全性の検証中... + 署名鍵の取り出し中… + 鍵の取り出し中… + ストリームの準備中… + データの暗号化中… + データの復号化中… + 署名の準備中… + 署名の生成中… + 署名処理中… + 署名の検証中… + 署名中… + データ読み込み中… + 鍵検索中… + データの展開中… + 完全性の検証中… \'%s\' を完全に削除中… - 要求中... + 要求中… 公開鍵の検索 秘密鍵の検索 - 鍵の共有... + 鍵の共有… 512 1024 @@ -362,7 +362,7 @@ %d の鍵を選択。 - すでにその鍵は存在しません... + すでにその鍵は存在しません… で始める もしくは あなた所有の鍵を作る diff --git a/OpenPGP-Keychain/src/main/res/values-nl-rNL/strings.xml b/OpenPGP-Keychain/src/main/res/values-nl-rNL/strings.xml index 7d7efa616..35a0b5a03 100644 --- a/OpenPGP-Keychain/src/main/res/values-nl-rNL/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-nl-rNL/strings.xml @@ -12,7 +12,7 @@ Geregistreerde apps Wachtwoord wijzigen Wachtwoord instellen - E-mail verzenden... + E-mail verzenden… Versleutelen naar bestand Ontsleutelen naar bestand Sleutels importeren @@ -109,7 +109,7 @@ DSA ElGamal RSA - Openen... + Openen… Waarschuwing Fout Fout: %s @@ -172,34 +172,34 @@ Niets te importeren gereed. - opslaan... - importeren... - exporteren... - sleutel maken... - hoofdsleutel voorbereiden... - hoofdsleutel certificeren... - hoofdsleutelbos maken... - sub-sleutels toevoegen... - ondertekeningssleutel uitpakken... - sleutel uitpakken... - streams voorbereiden... - gegevens versleutelen... - gegevens ontsleutelen... - handtekening voorbereiden... - handtekening genereren... - handtekening verwerken... - handtekening verifiëren... - ondertekenen... - gegevens lezen... - sleutel opzoeken... - gegevens decomprimeren... - integriteit verifiëren... - \'%s\' veilig verwijderen... - opvragen... + opslaan… + importeren… + exporteren… + sleutel maken… + hoofdsleutel voorbereiden… + hoofdsleutel certificeren… + hoofdsleutelbos maken… + sub-sleutels toevoegen… + ondertekeningssleutel uitpakken… + sleutel uitpakken… + streams voorbereiden… + gegevens versleutelen… + gegevens ontsleutelen… + handtekening voorbereiden… + handtekening genereren… + handtekening verwerken… + handtekening verifiëren… + ondertekenen… + gegevens lezen… + sleutel opzoeken… + gegevens decomprimeren… + integriteit verifiëren… + \'%s\' veilig verwijderen… + opvragen… Publieke sleutels zoeken Privésleutels zoeken - Sleutel delen met... + Sleutel delen met… 512 1024 diff --git a/OpenPGP-Keychain/src/main/res/values-ru/strings.xml b/OpenPGP-Keychain/src/main/res/values-ru/strings.xml index 7d865cc23..c8aff125b 100644 --- a/OpenPGP-Keychain/src/main/res/values-ru/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-ru/strings.xml @@ -15,7 +15,7 @@ Настройки сервера ключей Изменить пароль Задать пароль - Отправить... + Отправить… Зашифровать в файл Расшифровать в файл Импорт ключей @@ -61,7 +61,7 @@ Далее Назад Буфер обмена - Поделиться... + Поделиться… Найти ключ Настройки @@ -79,9 +79,9 @@ Импорт с сервера ключей Обновить с сервера ключей Загрузить на сервер ключей - Отправить... - Отправить отпечаток... - Отправить ключ... + Отправить… + Отправить отпечаток… + Отправить ключ… Отправить Отправить QR код @@ -91,7 +91,7 @@ Подписать ключ Настройки Beam Отмена - Зашифровать.... + Зашифровать…. Подписать Сообщение @@ -115,7 +115,7 @@ Серверы ключей ID ключа Создан - Годен до... + Годен до… Применение Размер ключа Основной ID пользователя @@ -165,7 +165,7 @@ DSA ElGamal RSA - Открыть... + Открыть… Внимание Ошибка Ошибка: %s @@ -284,41 +284,41 @@ готово. - сохранение... - импорт... - экспорт... - создание ключа. это может занять до 3 минут... - создание ключа... - подготовка основного ключа... - сертификация основного ключа... - создание основной связки... - добавление доп. ключей... - сохранение ключа... + сохранение… + импорт… + экспорт… + создание ключа. это может занять до 3 минут… + создание ключа… + подготовка основного ключа… + сертификация основного ключа… + создание основной связки… + добавление доп. ключей… + сохранение ключа… - экспорт ключа... - экспорт ключей... - экспорт ключей... + экспорт ключа… + экспорт ключей… + экспорт ключей… - извлечение подписи ключа... - извлечение ключа... - подготовка к передаче... - шифрование данных... - расшифровка данных... - подготовка подписи... - формирование подписи... - обработка подписи... - проверка подписи... - подписание... - чтение данных... - поиск ключа... - распаковка данных... - проверка целостности... - безопасное удаление \'%s\'... - запрос... + извлечение подписи ключа… + извлечение ключа… + подготовка к передаче… + шифрование данных… + расшифровка данных… + подготовка подписи… + формирование подписи… + обработка подписи… + проверка подписи… + подписание… + чтение данных… + поиск ключа… + распаковка данных… + проверка целостности… + безопасное удаление \'%s\'… + запрос… Найти публичные ключи Найти секретные ключи - Отправить... + Отправить… 512 1024 @@ -386,7 +386,7 @@ %d ключей выбрано. %d ключей выбрано. - У вас пока нет ключей... + У вас пока нет ключей… Но Вы можете или создать свой ключ diff --git a/OpenPGP-Keychain/src/main/res/values-tr/strings.xml b/OpenPGP-Keychain/src/main/res/values-tr/strings.xml index 5bb5225b5..4f1becaa1 100644 --- a/OpenPGP-Keychain/src/main/res/values-tr/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-tr/strings.xml @@ -76,7 +76,7 @@ DSA ElGamal RSA - Aç... + Aç… Uyarı Hata Hata: %s @@ -96,17 +96,17 @@ bozuk veri bitti. - kaydediliyor... - alıyor... - veriyor... - anahtar oluşturuluyor... - imza hazırlanıyor... - imza oluşturuluyor... - imza işleniyor... - imza doğrulanıyor... - imzalanıyor... - veri okunuyor... - anahtar bulunuyor... + kaydediliyor… + alıyor… + veriyor… + anahtar oluşturuluyor… + imza hazırlanıyor… + imza oluşturuluyor… + imza işleniyor… + imza doğrulanıyor… + imzalanıyor… + veri okunuyor… + anahtar bulunuyor… 512 diff --git a/OpenPGP-Keychain/src/main/res/values-zh/strings.xml b/OpenPGP-Keychain/src/main/res/values-zh/strings.xml index f9422b64b..5848fb8db 100644 --- a/OpenPGP-Keychain/src/main/res/values-zh/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-zh/strings.xml @@ -24,7 +24,7 @@ 复制到剪贴板 签署密钥 取消 - 加密到... + 加密到… 签署 讯息 @@ -64,7 +64,7 @@ 4小时 8小时 永远 - 打开... + 打开… 警告 错误 @@ -106,13 +106,13 @@ 错误的密语 完成。 - 保存... - 导入中... - 导出中... + 保存… + 导入中… + 导出中… 建立密钥 正在准备主密钥 - 正在验证签名... - 正在签名... + 正在验证签名… + 正在签名… 正在读取数据 正在查找密钥 正在查询 -- cgit v1.2.3 From 92ba91de1483e64d173b135c73012851bd372cbe Mon Sep 17 00:00:00 2001 From: Bhargav Golla Date: Wed, 5 Mar 2014 12:48:24 -0500 Subject: Set min date to one day after Created Date. Works on Honeycomb and above --- .../keychain/ui/widget/KeyEditor.java | 29 +++++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'OpenPGP-Keychain/src/main') diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java index b8bb547ee..7344248f7 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java @@ -34,6 +34,7 @@ import android.app.DatePickerDialog; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; +import android.text.format.DateUtils; import android.util.AttributeSet; import android.view.View; import android.view.View.OnClickListener; @@ -58,6 +59,7 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener { Spinner mUsage; TextView mCreationDate; BootstrapButton mExpiryDateButton; + GregorianCalendar mCreatedDate; GregorianCalendar mExpiryDate; private int mDatePickerResultCount = 0; @@ -106,8 +108,7 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener { mDeleteButton.setOnClickListener(this); setExpiryDate(null); - String creationDate = mCreationDate.getText().toString(); - Date date = DateFormat.getDateInstance().parse(creationDate); + mExpiryDateButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { GregorianCalendar date = mExpiryDate; @@ -130,7 +131,18 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener { } } }); - dialog.getDatePicker().setMinDate(date.getTime()); + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) { + if ( dialog != null && mCreatedDate != null ) { + dialog.getDatePicker().setMinDate(mCreatedDate.getTime().getTime()+ DateUtils.DAY_IN_MILLIS); + android.util.Log.w("Date picker", "Date min set"); + } else { + //When created date isn't available + dialog.getDatePicker().setMinDate(date.getTime().getTime()+ DateUtils.DAY_IN_MILLIS); + android.util.Log.w("Date picker", "Date min set using current time"); + } + } else { + android.util.Log.w("Date picker", "API Level < 11 so not restricting date range..."); + } dialog.show(); } }); @@ -207,7 +219,7 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener { GregorianCalendar cal = new GregorianCalendar(TimeZone.getTimeZone("UTC")); cal.setTime(PgpKeyHelper.getCreationDate(key)); - mCreationDate.setText(DateFormat.getDateInstance().format(cal.getTime())); + setCreatedDate(cal); cal = new GregorianCalendar(TimeZone.getTimeZone("UTC")); Date expiryDate = PgpKeyHelper.getExpiryDate(key); if (expiryDate == null) { @@ -237,6 +249,15 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener { mEditorListener = listener; } + private void setCreatedDate(GregorianCalendar date) { + mCreatedDate = date; + if (date == null) { + mCreationDate.setText(getContext().getString(R.string.none)); + } else { + mCreationDate.setText(DateFormat.getDateInstance().format(date.getTime())); + } + } + private void setExpiryDate(GregorianCalendar date) { mExpiryDate = date; if (date == null) { -- cgit v1.2.3 From 2000959997249bf948d61717edab5df7080278cf Mon Sep 17 00:00:00 2001 From: uberspot Date: Wed, 5 Mar 2014 20:42:11 +0200 Subject: Put Preferences in subscreen --- OpenPGP-Keychain/src/main/AndroidManifest.xml | 11 +- .../keychain/ui/PreferencesActivity.java | 292 ++++++++++++++++----- .../src/main/res/xml/adv_preferences.xml | 48 ++++ .../src/main/res/xml/gen_preferences.xml | 32 +++ .../src/main/res/xml/preference_headers.xml | 25 ++ .../src/main/res/xml/preference_headers_legacy.xml | 29 ++ OpenPGP-Keychain/src/main/res/xml/preferences.xml | 63 ----- 7 files changed, 370 insertions(+), 130 deletions(-) create mode 100644 OpenPGP-Keychain/src/main/res/xml/adv_preferences.xml create mode 100644 OpenPGP-Keychain/src/main/res/xml/gen_preferences.xml create mode 100644 OpenPGP-Keychain/src/main/res/xml/preference_headers.xml create mode 100644 OpenPGP-Keychain/src/main/res/xml/preference_headers_legacy.xml delete mode 100644 OpenPGP-Keychain/src/main/res/xml/preferences.xml (limited to 'OpenPGP-Keychain/src/main') diff --git a/OpenPGP-Keychain/src/main/AndroidManifest.xml b/OpenPGP-Keychain/src/main/AndroidManifest.xml index 76c4c6a2e..10a307bfb 100644 --- a/OpenPGP-Keychain/src/main/AndroidManifest.xml +++ b/OpenPGP-Keychain/src/main/AndroidManifest.xml @@ -277,7 +277,16 @@ + android:label="@string/title_preferences" > + + + + + + + + + target) { + super.onBuildHeaders(target); + loadHeadersFromResource(R.xml.preference_headers, target); + } + + /** This fragment shows the general preferences in android 3.0+ */ + public static class GeneralPrefsFragment extends PreferenceFragment { + + private PreferenceScreen mKeyServerPreference = null; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + // Load the preferences from an XML resource + addPreferencesFromResource(R.xml.gen_preferences); + + initializePassPassPhraceCacheTtl( + (IntegerListPreference) findPreference(Constants.pref.PASS_PHRASE_CACHE_TTL)); + + mKeyServerPreference = (PreferenceScreen) findPreference(Constants.pref.KEY_SERVERS); + String servers[] = mPreferences.getKeyServers(); + mKeyServerPreference.setSummary(getResources().getQuantityString(R.plurals.n_key_servers, + servers.length, servers.length)); + mKeyServerPreference + .setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { + public boolean onPreferenceClick(Preference preference) { + Intent intent = new Intent(getActivity(), + PreferencesKeyServerActivity.class); + intent.putExtra(PreferencesKeyServerActivity.EXTRA_KEY_SERVERS, + mPreferences.getKeyServers()); + startActivityForResult(intent, Id.request.key_server_preference); + return false; + } + }); + } + + @Override + public void onActivityResult(int requestCode, int resultCode, Intent data) { + switch (requestCode) { + case Id.request.key_server_preference: { + if (resultCode == RESULT_CANCELED || data == null) { + return; + } + String servers[] = data + .getStringArrayExtra(PreferencesKeyServerActivity.EXTRA_KEY_SERVERS); + mPreferences.setKeyServers(servers); + mKeyServerPreference.setSummary(getResources().getQuantityString( + R.plurals.n_key_servers, servers.length, servers.length)); + break; + } + + default: { + super.onActivityResult(requestCode, resultCode, data); + break; + } + } + } + } + + /** This fragment shows the advanced preferences in android 3.0+ */ + public static class AdvancedPrefsFragment extends PreferenceFragment { + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + // Load the preferences from an XML resource + addPreferencesFromResource(R.xml.adv_preferences); + + initializeEncryptionAlgorithm( + (IntegerListPreference) findPreference(Constants.pref.DEFAULT_ENCRYPTION_ALGORITHM)); + + int[] valueIds = new int[] { Id.choice.compression.none, Id.choice.compression.zip, + Id.choice.compression.zlib, Id.choice.compression.bzip2, }; + String[] entries = new String[] { + getString(R.string.choice_none) + " (" + getString(R.string.compression_fast) + ")", + "ZIP (" + getString(R.string.compression_fast) + ")", + "ZLIB (" + getString(R.string.compression_fast) + ")", + "BZIP2 (" + getString(R.string.compression_very_slow) + ")", }; + String[] values = new String[valueIds.length]; + for (int i = 0; i < values.length; ++i) { + values[i] = "" + valueIds[i]; + } + + initializeHashAlgorithm( + (IntegerListPreference) findPreference(Constants.pref.DEFAULT_HASH_ALGORITHM), + valueIds, entries, values); + + initializeMessageCompression( + (IntegerListPreference) findPreference(Constants.pref.DEFAULT_MESSAGE_COMPRESSION), + valueIds, entries, values); + + initializeFileCompression( + (IntegerListPreference) findPreference(Constants.pref.DEFAULT_FILE_COMPRESSION), + entries, values); - mPassPhraseCacheTtl = (IntegerListPreference) findPreference(Constants.pref.PASS_PHRASE_CACHE_TTL); + initializeAsciiArmour((CheckBoxPreference) findPreference(Constants.pref.DEFAULT_ASCII_ARMOUR)); + + initializeForceV3Signatures((CheckBoxPreference) findPreference(Constants.pref.FORCE_V3_SIGNATURES)); + } + } + + protected boolean isValidFragment (String fragmentName) { + return AdvancedPrefsFragment.class.getName().equals(fragmentName) + || GeneralPrefsFragment.class.getName().equals(fragmentName) + || super.isValidFragment(fragmentName); + } + + private static void initializePassPassPhraceCacheTtl(final IntegerListPreference mPassPhraseCacheTtl) { mPassPhraseCacheTtl.setValue("" + mPreferences.getPassPhraseCacheTtl()); mPassPhraseCacheTtl.setSummary(mPassPhraseCacheTtl.getEntry()); mPassPhraseCacheTtl @@ -67,8 +267,9 @@ public class PreferencesActivity extends PreferenceActivity { return false; } }); + } - mEncryptionAlgorithm = (IntegerListPreference) findPreference(Constants.pref.DEFAULT_ENCRYPTION_ALGORITHM); + private static void initializeEncryptionAlgorithm(final IntegerListPreference mEncryptionAlgorithm) { int valueIds[] = { PGPEncryptedData.AES_128, PGPEncryptedData.AES_192, PGPEncryptedData.AES_256, PGPEncryptedData.BLOWFISH, PGPEncryptedData.TWOFISH, PGPEncryptedData.CAST5, PGPEncryptedData.DES, PGPEncryptedData.TRIPLE_DES, @@ -93,8 +294,10 @@ public class PreferencesActivity extends PreferenceActivity { return false; } }); + } - mHashAlgorithm = (IntegerListPreference) findPreference(Constants.pref.DEFAULT_HASH_ALGORITHM); + private static void initializeHashAlgorithm + (final IntegerListPreference mHashAlgorithm, int[] valueIds, String[] entries, String[] values) { valueIds = new int[] { HashAlgorithmTags.MD5, HashAlgorithmTags.RIPEMD160, HashAlgorithmTags.SHA1, HashAlgorithmTags.SHA224, HashAlgorithmTags.SHA256, HashAlgorithmTags.SHA384, HashAlgorithmTags.SHA512, }; @@ -116,19 +319,10 @@ public class PreferencesActivity extends PreferenceActivity { return false; } }); + } - mMessageCompression = (IntegerListPreference) findPreference(Constants.pref.DEFAULT_MESSAGE_COMPRESSION); - valueIds = new int[] { Id.choice.compression.none, Id.choice.compression.zip, - Id.choice.compression.zlib, Id.choice.compression.bzip2, }; - entries = new String[] { - getString(R.string.choice_none) + " (" + getString(R.string.compression_fast) + ")", - "ZIP (" + getString(R.string.compression_fast) + ")", - "ZLIB (" + getString(R.string.compression_fast) + ")", - "BZIP2 (" + getString(R.string.compression_very_slow) + ")", }; - values = new String[valueIds.length]; - for (int i = 0; i < values.length; ++i) { - values[i] = "" + valueIds[i]; - } + private static void initializeMessageCompression + (final IntegerListPreference mMessageCompression, int[] valueIds, String[] entries, String[] values) { mMessageCompression.setEntries(entries); mMessageCompression.setEntryValues(values); mMessageCompression.setValue("" + mPreferences.getDefaultMessageCompression()); @@ -143,8 +337,10 @@ public class PreferencesActivity extends PreferenceActivity { return false; } }); + } - mFileCompression = (IntegerListPreference) findPreference(Constants.pref.DEFAULT_FILE_COMPRESSION); + private static void initializeFileCompression + (final IntegerListPreference mFileCompression, String[] entries, String[] values) { mFileCompression.setEntries(entries); mFileCompression.setEntryValues(values); mFileCompression.setValue("" + mPreferences.getDefaultFileCompression()); @@ -157,8 +353,9 @@ public class PreferencesActivity extends PreferenceActivity { return false; } }); + } - mAsciiArmour = (CheckBoxPreference) findPreference(Constants.pref.DEFAULT_ASCII_ARMOUR); + private static void initializeAsciiArmour(final CheckBoxPreference mAsciiArmour) { mAsciiArmour.setChecked(mPreferences.getDefaultAsciiArmour()); mAsciiArmour.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { public boolean onPreferenceChange(Preference preference, Object newValue) { @@ -167,8 +364,9 @@ public class PreferencesActivity extends PreferenceActivity { return false; } }); + } - mForceV3Signatures = (CheckBoxPreference) findPreference(Constants.pref.FORCE_V3_SIGNATURES); + private static void initializeForceV3Signatures(final CheckBoxPreference mForceV3Signatures) { mForceV3Signatures.setChecked(mPreferences.getForceV3Signatures()); mForceV3Signatures .setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @@ -178,43 +376,5 @@ public class PreferencesActivity extends PreferenceActivity { return false; } }); - - mKeyServerPreference = (PreferenceScreen) findPreference(Constants.pref.KEY_SERVERS); - String servers[] = mPreferences.getKeyServers(); - mKeyServerPreference.setSummary(getResources().getQuantityString(R.plurals.n_key_servers, - servers.length, servers.length)); - mKeyServerPreference - .setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { - public boolean onPreferenceClick(Preference preference) { - Intent intent = new Intent(PreferencesActivity.this, - PreferencesKeyServerActivity.class); - intent.putExtra(PreferencesKeyServerActivity.EXTRA_KEY_SERVERS, - mPreferences.getKeyServers()); - startActivityForResult(intent, Id.request.key_server_preference); - return false; - } - }); - } - - @Override - protected void onActivityResult(int requestCode, int resultCode, Intent data) { - switch (requestCode) { - case Id.request.key_server_preference: { - if (resultCode == RESULT_CANCELED || data == null) { - return; - } - String servers[] = data - .getStringArrayExtra(PreferencesKeyServerActivity.EXTRA_KEY_SERVERS); - mPreferences.setKeyServers(servers); - mKeyServerPreference.setSummary(getResources().getQuantityString( - R.plurals.n_key_servers, servers.length, servers.length)); - break; - } - - default: { - super.onActivityResult(requestCode, resultCode, data); - break; - } - } } -} +} \ No newline at end of file diff --git a/OpenPGP-Keychain/src/main/res/xml/adv_preferences.xml b/OpenPGP-Keychain/src/main/res/xml/adv_preferences.xml new file mode 100644 index 000000000..2705bd22f --- /dev/null +++ b/OpenPGP-Keychain/src/main/res/xml/adv_preferences.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/OpenPGP-Keychain/src/main/res/xml/gen_preferences.xml b/OpenPGP-Keychain/src/main/res/xml/gen_preferences.xml new file mode 100644 index 000000000..f83fcb0f6 --- /dev/null +++ b/OpenPGP-Keychain/src/main/res/xml/gen_preferences.xml @@ -0,0 +1,32 @@ + + + + + + + + + + \ No newline at end of file diff --git a/OpenPGP-Keychain/src/main/res/xml/preference_headers.xml b/OpenPGP-Keychain/src/main/res/xml/preference_headers.xml new file mode 100644 index 000000000..3506ba322 --- /dev/null +++ b/OpenPGP-Keychain/src/main/res/xml/preference_headers.xml @@ -0,0 +1,25 @@ + + + + +
+
+ \ No newline at end of file diff --git a/OpenPGP-Keychain/src/main/res/xml/preference_headers_legacy.xml b/OpenPGP-Keychain/src/main/res/xml/preference_headers_legacy.xml new file mode 100644 index 000000000..141bf93e5 --- /dev/null +++ b/OpenPGP-Keychain/src/main/res/xml/preference_headers_legacy.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/OpenPGP-Keychain/src/main/res/xml/preferences.xml b/OpenPGP-Keychain/src/main/res/xml/preferences.xml deleted file mode 100644 index f5b46c232..000000000 --- a/OpenPGP-Keychain/src/main/res/xml/preferences.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file -- cgit v1.2.3 From 42fc15e66e3efbb98fa0587569dc8b1f426c0b8a Mon Sep 17 00:00:00 2001 From: Bhargav Golla Date: Wed, 5 Mar 2014 14:46:38 -0500 Subject: Removed log statements as per Dominik's suggestions --- .../java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java | 4 ---- 1 file changed, 4 deletions(-) (limited to 'OpenPGP-Keychain/src/main') diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java index 7344248f7..b9d8eb81c 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java @@ -134,14 +134,10 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener { if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) { if ( dialog != null && mCreatedDate != null ) { dialog.getDatePicker().setMinDate(mCreatedDate.getTime().getTime()+ DateUtils.DAY_IN_MILLIS); - android.util.Log.w("Date picker", "Date min set"); } else { //When created date isn't available dialog.getDatePicker().setMinDate(date.getTime().getTime()+ DateUtils.DAY_IN_MILLIS); - android.util.Log.w("Date picker", "Date min set using current time"); } - } else { - android.util.Log.w("Date picker", "API Level < 11 so not restricting date range..."); } dialog.show(); } -- cgit v1.2.3