mirror of https://github.com/M66B/FairEmail.git
Show max AES key size
This commit is contained in:
parent
cb0db5de3e
commit
ab0ad41d89
|
@ -55,6 +55,7 @@ import androidx.preference.PreferenceManager;
|
||||||
|
|
||||||
import org.openintents.openpgp.util.OpenPgpApi;
|
import org.openintents.openpgp.util.OpenPgpApi;
|
||||||
|
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -70,6 +71,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
|
||||||
private Button btnPin;
|
private Button btnPin;
|
||||||
private Spinner spBiometricsTimeout;
|
private Spinner spBiometricsTimeout;
|
||||||
private Button btnImportKey;
|
private Button btnImportKey;
|
||||||
|
private TextView tvKeySize;
|
||||||
|
|
||||||
private List<String> openPgpProvider = new ArrayList<>();
|
private List<String> openPgpProvider = new ArrayList<>();
|
||||||
|
|
||||||
|
@ -101,6 +103,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
|
||||||
btnPin = view.findViewById(R.id.btnPin);
|
btnPin = view.findViewById(R.id.btnPin);
|
||||||
spBiometricsTimeout = view.findViewById(R.id.spBiometricsTimeout);
|
spBiometricsTimeout = view.findViewById(R.id.spBiometricsTimeout);
|
||||||
btnImportKey = view.findViewById(R.id.btnImportKey);
|
btnImportKey = view.findViewById(R.id.btnImportKey);
|
||||||
|
tvKeySize = view.findViewById(R.id.tvKeySize);
|
||||||
|
|
||||||
Intent intent = new Intent(OpenPgpApi.SERVICE_INTENT_2);
|
Intent intent = new Intent(OpenPgpApi.SERVICE_INTENT_2);
|
||||||
List<ResolveInfo> ris = getContext().getPackageManager().queryIntentServices(intent, 0);
|
List<ResolveInfo> ris = getContext().getPackageManager().queryIntentServices(intent, 0);
|
||||||
|
@ -232,6 +235,14 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
try {
|
||||||
|
int maxKeySize = javax.crypto.Cipher.getMaxAllowedKeyLength("AES");
|
||||||
|
tvKeySize.setText(getString(R.string.title_aes_key_size, maxKeySize));
|
||||||
|
} catch (NoSuchAlgorithmException ex) {
|
||||||
|
tvKeySize.setText(Helper.formatThrowable(ex));
|
||||||
|
}
|
||||||
|
tvKeySize.setVisibility(BuildConfig.DEBUG ? View.VISIBLE : View.GONE);
|
||||||
|
|
||||||
PreferenceManager.getDefaultSharedPreferences(getContext()).registerOnSharedPreferenceChangeListener(this);
|
PreferenceManager.getDefaultSharedPreferences(getContext()).registerOnSharedPreferenceChangeListener(this);
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
|
|
|
@ -218,5 +218,15 @@
|
||||||
android:text="@string/title_import_encrypt_key"
|
android:text="@string/title_import_encrypt_key"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/spBiometricsTimeout" />
|
app:layout_constraintTop_toBottomOf="@id/spBiometricsTimeout" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tvKeySize"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/title_aes_key_size"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/btnImportKey" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
|
@ -699,6 +699,7 @@
|
||||||
<string name="title_not_encrypted">Message is not signed or encrypted</string>
|
<string name="title_not_encrypted">Message is not signed or encrypted</string>
|
||||||
<string name="title_reset_sign_key">Reset sign key</string>
|
<string name="title_reset_sign_key">Reset sign key</string>
|
||||||
<string name="title_import_encrypt_key">Import encryption key</string>
|
<string name="title_import_encrypt_key">Import encryption key</string>
|
||||||
|
<string name="title_aes_key_size" translatable="false">Max AES key size: %1$d</string>
|
||||||
|
|
||||||
<string name="title_signature_none">Message not signed</string>
|
<string name="title_signature_none">Message not signed</string>
|
||||||
<string name="title_signature_valid">Message signature valid</string>
|
<string name="title_signature_valid">Message signature valid</string>
|
||||||
|
|
Loading…
Reference in New Issue