fix cv25519 encryption key generation
This commit is contained in:
committed by
Vincent Breitmoser
parent
3288adf5b2
commit
5f0646b7e9
@@ -269,9 +269,14 @@ public class PgpKeyOperation {
|
||||
return null;
|
||||
}
|
||||
progress(R.string.progress_generating_ecdh, 30);
|
||||
if (add.getCurve() == Curve.CV25519) {
|
||||
keyGen = KeyPairGenerator.getInstance("X25519");
|
||||
keyGen.initialize(255);
|
||||
} else {
|
||||
ECGenParameterSpec ecParamSpec = getEccParameterSpec(add.getCurve());
|
||||
keyGen = KeyPairGenerator.getInstance("ECDH", Constants.BOUNCY_CASTLE_PROVIDER_NAME);
|
||||
keyGen.initialize(ecParamSpec, new SecureRandom());
|
||||
}
|
||||
|
||||
algorithm = PGPPublicKey.ECDH;
|
||||
break;
|
||||
|
||||
@@ -324,7 +324,7 @@ public abstract class SaveKeyringParcel implements Parcelable {
|
||||
// All curves defined in the standard
|
||||
// http://www.bouncycastle.org/wiki/pages/viewpage.action?pageId=362269
|
||||
public enum Curve {
|
||||
NIST_P256, NIST_P384, NIST_P521,
|
||||
NIST_P256, NIST_P384, NIST_P521, CV25519
|
||||
|
||||
// these are supported by gpg, but they are not in rfc6637 and not supported by BouncyCastle yet
|
||||
// (adding support would be trivial though -> JcaPGPKeyConverter.java:190)
|
||||
|
||||
@@ -262,6 +262,10 @@ public class AddSubkeyDialogFragment extends DialogFragment {
|
||||
curve = Curve.NIST_P521;
|
||||
break;
|
||||
}
|
||||
case EDDSA: {
|
||||
curve = Curve.CV25519;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// set algorithm
|
||||
@@ -283,9 +287,13 @@ public class AddSubkeyDialogFragment extends DialogFragment {
|
||||
break;
|
||||
}
|
||||
case EDDSA: {
|
||||
if(mUsageEncrypt.isChecked()) {
|
||||
algorithm = Algorithm.ECDH;
|
||||
} else {
|
||||
algorithm = Algorithm.EDDSA;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// set flags
|
||||
int flags = 0;
|
||||
|
||||
@@ -188,6 +188,8 @@ public class KeyFormattingUtils {
|
||||
return "NIST P-384";
|
||||
case NIST_P521:
|
||||
return "NIST P-521";
|
||||
case CV25519:
|
||||
return "Curve25519";
|
||||
|
||||
/* see SaveKeyringParcel
|
||||
case BRAINPOOL_P256:
|
||||
|
||||
Reference in New Issue
Block a user