-
Notifications
You must be signed in to change notification settings - Fork 19
Description
I did a simple test
public static void main(String[] args) throws Exception {
KeyPairGenerator kpg = KeyPairGenerator.getInstance("EC");
kpg.initialize(new ECGenParameterSpec("secp224r1"));
}
and simply add a printout command to print the ecPubKeyNamedCurve.getName() in my recent PR #826 in the ECDHKeyAgreement class to see what it will return for various EC curve including secp224r1, secp256r1, secp384r1 and secp521r1.
ECNamedCurve ecPubKeyNamedCurve = ECParameters.getNamedCurve(this.ecPublicKey.getParams());
ECNamedCurve ecPriKeyNamedCurve = ECParameters.getNamedCurve(this.ecPrivateKey.getParams());
ObjectIdentifier oidPubKey = ECNamedCurve.getOIDFromName(ecPubKeyNamedCurve.getName());
ObjectIdentifier oidPriKey = ECNamedCurve.getOIDFromName(ecPriKeyNamedCurve.getName());
System.out.println("Public key is: " + ecPubKeyNamedCurve.getName());
System.out.println("Private key is: " + ecPriKeyNamedCurve.getName());
However,
I got different name:
-
by passing
secp224r1inkpg.initialize(new ECGenParameterSpec("secp224r1"));I got the print out value isPublic key is: secp224r1 Private key is: secp224r1 -
by passing
secp256r1inkpg.initialize(new ECGenParameterSpec("secp256r1"));I got the print out value isPublic key is: NIST P-256 Private key is: NIST P-256 -
by passing
secp384r1inkpg.initialize(new ECGenParameterSpec("secp384r1"));I got the print out value isPublic key is: NIST P-384 Private key is: NIST P-384 -
by passing
secp521r1inkpg.initialize(new ECGenParameterSpec("secp521r1"));I got the print out value isPublic key is: NIST P-521 Private key is: NIST P-521
As you can see the name is different there