mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-23 17:22:16 -05:00
Dont write version header by default
This commit is contained in:
parent
f941431d63
commit
d0987edab9
@ -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";
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
if (mVersionHeader != null) {
|
||||
armorOut.setHeader("Version", mVersionHeader);
|
||||
}
|
||||
out = armorOut;
|
||||
} else {
|
||||
out = mOutStream;
|
||||
|
@ -204,7 +204,9 @@ public class UncachedKeyRing {
|
||||
|
||||
public void encodeArmored(OutputStream out, String version) throws IOException {
|
||||
ArmoredOutputStream aos = new ArmoredOutputStream(out);
|
||||
if (version != null) {
|
||||
aos.setHeader("Version", version);
|
||||
}
|
||||
aos.write(mRing.getEncoded());
|
||||
aos.close();
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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())
|
||||
|
@ -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;
|
||||
}
|
||||
});
|
||||
|
@ -81,8 +81,8 @@
|
||||
<string name="label_passphrase_again">Passwort wiederholen</string>
|
||||
<string name="label_algorithm">Algorithmus</string>
|
||||
<string name="label_file_ascii_armor">Datei: ASCII Armor</string>
|
||||
<string name="label_conceal_pgp_application">Lass andere wissen dass du OpenKeychain nutzt</string>
|
||||
<string name="label_conceal_pgp_application_summary">Fügt \'OpenKeychain v2.7\' zu OpenPGP Signaturen, Daten und exportierten Schlüsseln hinzu</string>
|
||||
<string name="label_write_version_header">Lass andere wissen dass du OpenKeychain nutzt</string>
|
||||
<string name="label_write_version_header_summary">Fügt \'OpenKeychain v2.7\' zu OpenPGP Signaturen, Daten und exportierten Schlüsseln hinzu</string>
|
||||
<string name="label_asymmetric_from">Von:</string>
|
||||
<string name="label_to">An:</string>
|
||||
<string name="label_delete_after_encryption">Dateien: Nach Verschlüsselung löschen</string>
|
||||
|
@ -84,8 +84,8 @@
|
||||
<string name="label_algorithm">Algoritmo</string>
|
||||
<string name="label_ascii_armor">Armadura ASCII del fichero</string>
|
||||
<string name="label_file_ascii_armor">Ficheros: Armadura ASCII</string>
|
||||
<string name="label_conceal_pgp_application">Permitir a otros saber que está usando OpenKeychain</string>
|
||||
<string name="label_conceal_pgp_application_summary">Escribe \'OpenKeychain v2.7\' en las firmas OpenPGP, el texto cifrado, y las claves exportadas</string>
|
||||
<string name="label_write_version_header">Permitir a otros saber que está usando OpenKeychain</string>
|
||||
<string name="label_write_version_header_summary">Escribe \'OpenKeychain v2.7\' en las firmas OpenPGP, el texto cifrado, y las claves exportadas</string>
|
||||
<string name="label_asymmetric_from">Desde:</string>
|
||||
<string name="label_to">Hacia:</string>
|
||||
<string name="label_delete_after_encryption">Ficheros: Borrar después del cifrado</string>
|
||||
|
@ -84,8 +84,8 @@
|
||||
<string name="label_algorithm">Algorithme</string>
|
||||
<string name="label_ascii_armor">Fichier ASCII Armor</string>
|
||||
<string name="label_file_ascii_armor">Fichier : ASCII Armor</string>
|
||||
<string name="label_conceal_pgp_application">Informez les autres de votre utilisation d\'OpenKeychain</string>
|
||||
<string name="label_conceal_pgp_application_summary">Ajoute « OpenKeychain v2.7 » aux signatures OpenPGP, aux cryptogrammes, et aux clefs exportées</string>
|
||||
<string name="label_write_version_header">Informez les autres de votre utilisation d\'OpenKeychain</string>
|
||||
<string name="label_write_version_header_summary">Ajoute « OpenKeychain v2.7 » aux signatures OpenPGP, aux cryptogrammes, et aux clefs exportées</string>
|
||||
<string name="label_asymmetric_from">De :</string>
|
||||
<string name="label_to">À :</string>
|
||||
<string name="label_delete_after_encryption">Fichier : supprimer après chiffrement</string>
|
||||
|
@ -69,8 +69,8 @@
|
||||
<string name="label_passphrase">Frase di Accesso</string>
|
||||
<string name="label_passphrase_again">Ripeti Frase di Accesso</string>
|
||||
<string name="label_algorithm">Algortimo</string>
|
||||
<string name="label_conceal_pgp_application">Fai sapere agli altri che utilizzi OpenKeychain</string>
|
||||
<string name="label_conceal_pgp_application_summary">Scrive \'OpenKeychain v2.7\' nelle firme OpenPGP, testi cifrati e chiavi esportate</string>
|
||||
<string name="label_write_version_header">Fai sapere agli altri che utilizzi OpenKeychain</string>
|
||||
<string name="label_write_version_header_summary">Scrive \'OpenKeychain v2.7\' nelle firme OpenPGP, testi cifrati e chiavi esportate</string>
|
||||
<string name="label_delete_after_decryption">Cancella Dopo Decodifica</string>
|
||||
<string name="label_encryption_algorithm">Algoritmo di Codifica</string>
|
||||
<string name="label_hash_algorithm">Algoritmo di Hash</string>
|
||||
|
@ -84,8 +84,8 @@
|
||||
<string name="label_algorithm">アルゴリズム</string>
|
||||
<string name="label_ascii_armor">アスキー形式ファイル</string>
|
||||
<string name="label_file_ascii_armor">ファイル: アスキー形式</string>
|
||||
<string name="label_conceal_pgp_application">他の人にあなたがOpenKeychain使用していることを知ってもらいましょう</string>
|
||||
<string name="label_conceal_pgp_application_summary">OpenPGPの 署名、暗号文、そしてエクスポートした鍵に \'OpenKeychain v2.7\' と書くようになりました</string>
|
||||
<string name="label_write_version_header">他の人にあなたがOpenKeychain使用していることを知ってもらいましょう</string>
|
||||
<string name="label_write_version_header_summary">OpenPGPの 署名、暗号文、そしてエクスポートした鍵に \'OpenKeychain v2.7\' と書くようになりました</string>
|
||||
<string name="label_asymmetric_from">差出人:</string>
|
||||
<string name="label_to">宛先</string>
|
||||
<string name="label_delete_after_encryption">ファイル: 暗号化後に削除</string>
|
||||
|
@ -90,8 +90,8 @@
|
||||
<string name="label_algorithm">Algorithm</string>
|
||||
<string name="label_ascii_armor">File ASCII Armor</string>
|
||||
<string name="label_file_ascii_armor">Files: ASCII Armor</string>
|
||||
<string name="label_conceal_pgp_application">Let others know that you\'re using OpenKeychain</string>
|
||||
<string name="label_conceal_pgp_application_summary">Writes \'OpenKeychain v2.7\' to OpenPGP signatures, ciphertext, and exported keys</string>
|
||||
<string name="label_write_version_header">Let others know that you\'re using OpenKeychain</string>
|
||||
<string name="label_write_version_header_summary">Writes \'OpenKeychain v2.7\' to OpenPGP signatures, ciphertext, and exported keys</string>
|
||||
<string name="label_asymmetric_from">From:</string>
|
||||
<string name="label_to">To:</string>
|
||||
<string name="label_delete_after_encryption">Files: Delete After Encryption</string>
|
||||
|
@ -40,10 +40,10 @@
|
||||
android:title="@string/label_ascii_armor" />
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="concealPgpApplication"
|
||||
android:key="writeVersionHeader"
|
||||
android:persistent="false"
|
||||
android:title="@string/label_conceal_pgp_application"
|
||||
android:summary="@string/label_conceal_pgp_application_summary" />
|
||||
android:title="@string/label_write_version_header"
|
||||
android:summary="@string/label_write_version_header_summary" />
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:title="@string/section_advanced" >
|
||||
<CheckBoxPreference
|
||||
|
2
extern/spongycastle
vendored
2
extern/spongycastle
vendored
@ -1 +1 @@
|
||||
Subproject commit 9e4fb80c4f8efb8a0f8fd0c1cc1e74a421d1eb7e
|
||||
Subproject commit 918340cbc6d5396764bfe94fdba07aca11cd8168
|
Loading…
Reference in New Issue
Block a user