Make ECC 25519 the default generated key type

This commit is contained in:
segfault-bilibili
2023-03-18 10:47:31 +08:00
committed by Vincent Breitmoser
parent 5615197553
commit 0caeca0b66
2 changed files with 6 additions and 7 deletions

View File

@@ -180,13 +180,13 @@ public final class Constants {
}
/**
* Default key configuration: 3072 bit RSA (certify + sign, encrypt)
* Default key configuration: EDDSA (certify + sign), Curve25519 ECDH (encrypt)
*/
public static void addDefaultSubkeys(SaveKeyringParcel.Builder builder) {
builder.addSubkeyAdd(SubkeyAdd.createSubkeyAdd(SaveKeyringParcel.Algorithm.RSA,
3072, null, KeyFlags.CERTIFY_OTHER | KeyFlags.SIGN_DATA, 0L));
builder.addSubkeyAdd(SubkeyAdd.createSubkeyAdd(SaveKeyringParcel.Algorithm.RSA,
3072, null, KeyFlags.ENCRYPT_COMMS | KeyFlags.ENCRYPT_STORAGE, 0L));
builder.addSubkeyAdd(SubkeyAdd.createSubkeyAdd(SaveKeyringParcel.Algorithm.EDDSA,
null, null, KeyFlags.CERTIFY_OTHER | KeyFlags.SIGN_DATA, 0L));
builder.addSubkeyAdd(SubkeyAdd.createSubkeyAdd(SaveKeyringParcel.Algorithm.ECDH,
null, SaveKeyringParcel.Curve.CV25519, KeyFlags.ENCRYPT_COMMS | KeyFlags.ENCRYPT_STORAGE, 0L));
}
/**

View File

@@ -165,9 +165,8 @@ public class AddSubkeyDialogFragment extends DialogFragment {
TwoLineArrayAdapter adapter = new TwoLineArrayAdapter(context,
android.R.layout.simple_spinner_item, choices);
mKeyTypeSpinner.setAdapter(adapter);
// make RSA 3072 the default
for (int i = 0; i < choices.size(); ++i) {
if (choices.get(i).getId() == SupportedKeyType.RSA_3072) {
if (choices.get(i).getId() == SupportedKeyType.ECC_25519) {
mKeyTypeSpinner.setSelection(i);
break;
}