diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/Constants.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/Constants.java index 05676c5d0..f240b5cc2 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/Constants.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/Constants.java @@ -67,7 +67,7 @@ public final class Constants { public static final String FORCE_V3_SIGNATURES = "forceV3Signatures"; public static final String KEY_SERVERS = "keyServers"; public static final String KEY_SERVERS_DEFAULT_VERSION = "keyServersDefaultVersion"; - public static final String CONCEAL_PGP_APPLICATION = "concealPgpApplication"; + public static final String WRITE_VERSION_HEADER = "writeVersionHeader"; public static final String FIRST_TIME = "firstTime"; } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/helper/Preferences.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/helper/Preferences.java index 00f6b6715..a0bac80aa 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/helper/Preferences.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/helper/Preferences.java @@ -205,13 +205,13 @@ public class Preferences { } } - public void setConcealPgpApplication(boolean conceal) { + public void setWriteVersionHeader(boolean conceal) { SharedPreferences.Editor editor = mSharedPreferences.edit(); - editor.putBoolean(Constants.Pref.CONCEAL_PGP_APPLICATION, conceal); + editor.putBoolean(Constants.Pref.WRITE_VERSION_HEADER, conceal); editor.commit(); } - public boolean getConcealPgpApplication() { - return mSharedPreferences.getBoolean(Constants.Pref.CONCEAL_PGP_APPLICATION, false); + public boolean getWriteVersionHeader() { + return mSharedPreferences.getBoolean(Constants.Pref.WRITE_VERSION_HEADER, false); } } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpHelper.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpHelper.java index 0ceefc4d9..1cf027721 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpHelper.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpHelper.java @@ -60,11 +60,11 @@ public class PgpHelper { } } - public static String getFullVersion(Context context) { - if(Preferences.getPreferences(context).getConcealPgpApplication()){ - return ""; - } else { + public static String getVersionForHeader(Context context) { + if(Preferences.getPreferences(context).getWriteVersionHeader()){ return "OpenKeychain v" + getVersion(context); + } else { + return null; } } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java index 846b00ef2..f14eacda2 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java @@ -230,7 +230,10 @@ public class PgpImportExport { progress++; // Create an output stream ArmoredOutputStream arOutStream = new ArmoredOutputStream(outStream); - arOutStream.setHeader("Version", PgpHelper.getFullVersion(mContext)); + String version = PgpHelper.getVersionForHeader(mContext); + if (version != null) { + arOutStream.setHeader("Version", version); + } updateProgress(progress * 100 / masterKeyIdsSize, 100); @@ -258,7 +261,10 @@ public class PgpImportExport { progress++; // Create an output stream ArmoredOutputStream arOutStream = new ArmoredOutputStream(outStream); - arOutStream.setHeader("Version", PgpHelper.getFullVersion(mContext)); + String version = PgpHelper.getVersionForHeader(mContext); + if (version != null) { + arOutStream.setHeader("Version", version); + } updateProgress(progress * 100 / masterKeyIdsSize, 100); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncrypt.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncrypt.java index 4973f64bb..b0e546662 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncrypt.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncrypt.java @@ -109,11 +109,11 @@ public class PgpSignEncrypt { public static class Builder { // mandatory parameter private ProviderHelper mProviderHelper; - private String mVersionHeader; private InputData mData; private OutputStream mOutStream; // optional + private String mVersionHeader = null; private Progressable mProgressable = null; private boolean mEnableAsciiArmorOutput = false; private int mCompressionId = CompressionAlgorithmTags.UNCOMPRESSED; @@ -128,13 +128,17 @@ public class PgpSignEncrypt { private boolean mCleartextInput = false; private String mOriginalFilename = ""; - public Builder(ProviderHelper providerHelper, String versionHeader, InputData data, OutputStream outStream) { + public Builder(ProviderHelper providerHelper, InputData data, OutputStream outStream) { mProviderHelper = providerHelper; - mVersionHeader = versionHeader; mData = data; mOutStream = outStream; } + public Builder setVersionHeader(String versionHeader) { + mVersionHeader = versionHeader; + return this; + } + public Builder setProgressable(Progressable progressable) { mProgressable = progressable; return this; @@ -271,7 +275,9 @@ public class PgpSignEncrypt { OutputStream out; if (mEnableAsciiArmorOutput) { armorOut = new ArmoredOutputStream(mOutStream); - armorOut.setHeader("Version", mVersionHeader); + if (mVersionHeader != null) { + armorOut.setHeader("Version", mVersionHeader); + } out = armorOut; } else { out = mOutStream; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/UncachedKeyRing.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/UncachedKeyRing.java index 18ddaa0ec..73a51942d 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/UncachedKeyRing.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/UncachedKeyRing.java @@ -204,7 +204,9 @@ public class UncachedKeyRing { public void encodeArmored(OutputStream out, String version) throws IOException { ArmoredOutputStream aos = new ArmoredOutputStream(out); - aos.setHeader("Version", version); + if (version != null) { + aos.setHeader("Version", version); + } aos.write(mRing.getEncoded()); aos.close(); } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java index 99b622f69..a13bb9c98 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java @@ -862,7 +862,10 @@ public class ProviderHelper { UncachedKeyRing keyRing = UncachedKeyRing.decodeFromData(data); ByteArrayOutputStream bos = new ByteArrayOutputStream(); - keyRing.encodeArmored(bos, PgpHelper.getFullVersion(mContext)); + String version = PgpHelper.getVersionForHeader(mContext); + if (version != null) { + keyRing.encodeArmored(bos, version); + } String armoredKey = bos.toString("UTF-8"); Log.d(Constants.TAG, "armoredKey:" + armoredKey); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java index 2f07f9785..3c2f7ebda 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java @@ -187,9 +187,9 @@ public class OpenPgpService extends RemoteService { // sign-only PgpSignEncrypt.Builder builder = new PgpSignEncrypt.Builder( new ProviderHelper(getContext()), - PgpHelper.getFullVersion(getContext()), inputData, os); builder.setEnableAsciiArmorOutput(asciiArmor) + .setVersionHeader(PgpHelper.getVersionForHeader(this)) .setSignatureHashAlgorithm(accSettings.getHashAlgorithm()) .setSignatureForceV3(false) .setSignatureMasterKeyId(accSettings.getKeyId()) @@ -276,9 +276,9 @@ public class OpenPgpService extends RemoteService { PgpSignEncrypt.Builder builder = new PgpSignEncrypt.Builder( new ProviderHelper(getContext()), - PgpHelper.getFullVersion(getContext()), inputData, os); builder.setEnableAsciiArmorOutput(asciiArmor) + .setVersionHeader(PgpHelper.getVersionForHeader(this)) .setCompressionId(accSettings.getCompression()) .setSymmetricEncryptionAlgorithm(accSettings.getEncryptionAlgorithm()) .setEncryptionMasterKeyIds(keyIds) diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java index 443f66d58..d1d848066 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java @@ -249,11 +249,11 @@ public class KeychainIntentService extends IntentService PgpSignEncrypt.Builder builder = new PgpSignEncrypt.Builder( new ProviderHelper(this), - PgpHelper.getFullVersion(this), inputData, outStream); builder.setProgressable(this); builder.setEnableAsciiArmorOutput(useAsciiArmor) + .setVersionHeader(PgpHelper.getVersionForHeader(this)) .setCompressionId(compressionId) .setSymmetricEncryptionAlgorithm( Preferences.getPreferences(this).getDefaultEncryptionAlgorithm()) diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/PreferencesActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/PreferencesActivity.java index e0261730d..5bef6cc9f 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/PreferencesActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/PreferencesActivity.java @@ -122,8 +122,8 @@ public class PreferencesActivity extends PreferenceActivity { initializeForceV3Signatures( (CheckBoxPreference) findPreference(Constants.Pref.FORCE_V3_SIGNATURES)); - initializeConcealPgpApplication( - (CheckBoxPreference) findPreference(Constants.Pref.CONCEAL_PGP_APPLICATION)); + initializeWriteVersionHeader( + (CheckBoxPreference) findPreference(Constants.Pref.WRITE_VERSION_HEADER)); } else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) { // Load the legacy preferences headers @@ -269,8 +269,8 @@ public class PreferencesActivity extends PreferenceActivity { initializeForceV3Signatures( (CheckBoxPreference) findPreference(Constants.Pref.FORCE_V3_SIGNATURES)); - initializeConcealPgpApplication( - (CheckBoxPreference) findPreference(Constants.Pref.CONCEAL_PGP_APPLICATION)); + initializeWriteVersionHeader( + (CheckBoxPreference) findPreference(Constants.Pref.WRITE_VERSION_HEADER)); } } @@ -404,12 +404,12 @@ public class PreferencesActivity extends PreferenceActivity { }); } - private static void initializeConcealPgpApplication(final CheckBoxPreference mConcealPgpApplication) { - mConcealPgpApplication.setChecked(sPreferences.getConcealPgpApplication()); - mConcealPgpApplication.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { + private static void initializeWriteVersionHeader(final CheckBoxPreference mWriteVersionHeader) { + mWriteVersionHeader.setChecked(sPreferences.getWriteVersionHeader()); + mWriteVersionHeader.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { public boolean onPreferenceChange(Preference preference, Object newValue) { - mConcealPgpApplication.setChecked((Boolean) newValue); - sPreferences.setConcealPgpApplication((Boolean) newValue); + mWriteVersionHeader.setChecked((Boolean) newValue); + sPreferences.setWriteVersionHeader((Boolean) newValue); return false; } }); diff --git a/OpenKeychain/src/main/res/values-de/strings.xml b/OpenKeychain/src/main/res/values-de/strings.xml index c563267cc..a843a154a 100644 --- a/OpenKeychain/src/main/res/values-de/strings.xml +++ b/OpenKeychain/src/main/res/values-de/strings.xml @@ -81,8 +81,8 @@ Passwort wiederholen Algorithmus Datei: ASCII Armor - Lass andere wissen dass du OpenKeychain nutzt - Fügt \'OpenKeychain v2.7\' zu OpenPGP Signaturen, Daten und exportierten Schlüsseln hinzu + Lass andere wissen dass du OpenKeychain nutzt + Fügt \'OpenKeychain v2.7\' zu OpenPGP Signaturen, Daten und exportierten Schlüsseln hinzu Von: An: Dateien: Nach Verschlüsselung löschen diff --git a/OpenKeychain/src/main/res/values-es/strings.xml b/OpenKeychain/src/main/res/values-es/strings.xml index eddfb4593..80c2060d1 100644 --- a/OpenKeychain/src/main/res/values-es/strings.xml +++ b/OpenKeychain/src/main/res/values-es/strings.xml @@ -84,8 +84,8 @@ Algoritmo Armadura ASCII del fichero Ficheros: Armadura ASCII - Permitir a otros saber que está usando OpenKeychain - Escribe \'OpenKeychain v2.7\' en las firmas OpenPGP, el texto cifrado, y las claves exportadas + Permitir a otros saber que está usando OpenKeychain + Escribe \'OpenKeychain v2.7\' en las firmas OpenPGP, el texto cifrado, y las claves exportadas Desde: Hacia: Ficheros: Borrar después del cifrado diff --git a/OpenKeychain/src/main/res/values-fr/strings.xml b/OpenKeychain/src/main/res/values-fr/strings.xml index d2a13ef2d..e30ebb883 100644 --- a/OpenKeychain/src/main/res/values-fr/strings.xml +++ b/OpenKeychain/src/main/res/values-fr/strings.xml @@ -84,8 +84,8 @@ Algorithme Fichier ASCII Armor Fichier : ASCII Armor - Informez les autres de votre utilisation d\'OpenKeychain - Ajoute « OpenKeychain v2.7 » aux signatures OpenPGP, aux cryptogrammes, et aux clefs exportées + Informez les autres de votre utilisation d\'OpenKeychain + Ajoute « OpenKeychain v2.7 » aux signatures OpenPGP, aux cryptogrammes, et aux clefs exportées De : À : Fichier : supprimer après chiffrement diff --git a/OpenKeychain/src/main/res/values-it/strings.xml b/OpenKeychain/src/main/res/values-it/strings.xml index a3941e147..89e09783b 100644 --- a/OpenKeychain/src/main/res/values-it/strings.xml +++ b/OpenKeychain/src/main/res/values-it/strings.xml @@ -69,8 +69,8 @@ Frase di Accesso Ripeti Frase di Accesso Algortimo - Fai sapere agli altri che utilizzi OpenKeychain - Scrive \'OpenKeychain v2.7\' nelle firme OpenPGP, testi cifrati e chiavi esportate + Fai sapere agli altri che utilizzi OpenKeychain + Scrive \'OpenKeychain v2.7\' nelle firme OpenPGP, testi cifrati e chiavi esportate Cancella Dopo Decodifica Algoritmo di Codifica Algoritmo di Hash diff --git a/OpenKeychain/src/main/res/values-ja/strings.xml b/OpenKeychain/src/main/res/values-ja/strings.xml index d4fc5f976..dbb52d208 100644 --- a/OpenKeychain/src/main/res/values-ja/strings.xml +++ b/OpenKeychain/src/main/res/values-ja/strings.xml @@ -84,8 +84,8 @@ アルゴリズム アスキー形式ファイル ファイル: アスキー形式 - 他の人にあなたがOpenKeychain使用していることを知ってもらいましょう - OpenPGPの 署名、暗号文、そしてエクスポートした鍵に \'OpenKeychain v2.7\' と書くようになりました + 他の人にあなたがOpenKeychain使用していることを知ってもらいましょう + OpenPGPの 署名、暗号文、そしてエクスポートした鍵に \'OpenKeychain v2.7\' と書くようになりました 差出人: 宛先 ファイル: 暗号化後に削除 diff --git a/OpenKeychain/src/main/res/values/strings.xml b/OpenKeychain/src/main/res/values/strings.xml index 352ca951c..8ccb92854 100644 --- a/OpenKeychain/src/main/res/values/strings.xml +++ b/OpenKeychain/src/main/res/values/strings.xml @@ -90,8 +90,8 @@ Algorithm File ASCII Armor Files: ASCII Armor - Let others know that you\'re using OpenKeychain - Writes \'OpenKeychain v2.7\' to OpenPGP signatures, ciphertext, and exported keys + Let others know that you\'re using OpenKeychain + Writes \'OpenKeychain v2.7\' to OpenPGP signatures, ciphertext, and exported keys From: To: Files: Delete After Encryption diff --git a/OpenKeychain/src/main/res/xml/adv_preferences.xml b/OpenKeychain/src/main/res/xml/adv_preferences.xml index a07ae06bb..588a6e62d 100644 --- a/OpenKeychain/src/main/res/xml/adv_preferences.xml +++ b/OpenKeychain/src/main/res/xml/adv_preferences.xml @@ -40,10 +40,10 @@ android:title="@string/label_ascii_armor" /> + android:title="@string/label_write_version_header" + android:summary="@string/label_write_version_header_summary" />