"Pluggable" key serialization in JCE/JCA

Michael StJohns mstjohns at comcast.net
Fri Mar 25 16:13:01 UTC 2022


On 3/25/2022 12:07 PM, Michael StJohns wrote:
>> AFAIK, there is still no support for using named curves to construct 
>> an EC key. Names curves are MANDATORY in JOSE/CODE.
>
> Use AlgorithmParameterGenerator with ECGenParameterSpec.  Works like a 
> charm. 


Sorry - Got that slightly wrong.  Use this instead:

> AlgorithmParameters parameters = AlgorithmParameters.getInstance("EC", 
> "SunEC"); parameters.init(newECGenParameterSpec 
> <https://www.tabnine.com/code/java/methods/java.security.spec.ECGenParameterSpec/%3Cinit%3E>("secp128r1")); 
> ECParameterSpec ecParameters = 
> parameters.getParameterSpec(ECParameterSpec.class); ECPublicKeySpec 
> pubKeySpec = newECPublicKeySpec(point, ecParameters); PublicKey key = 
> KeyFactory.getInstance("EC", "SunEC").generatePublic(pubKeySpec);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/security-dev/attachments/20220325/7fa305c6/attachment.htm>


More information about the security-dev mailing list