On Sat, 2 May 2026 00:15:20 GMT, Weijun Wang <[email protected]> wrote:

>> If an EC key is decoded, it will return the underlying EC key implementation 
>> that implements the EC interface.
>
> Provider p11s = getPkcs11Provider();
>         PrivateKey sk = 
> KeyPairGenerator.getInstance("EC").generateKeyPair().getPrivate();
>         String pem = PEMEncoder.of().encodeToString(sk);
>         PrivateKey sk2 = (PrivateKey) 
> PEMDecoder.of().withFactoryFrom(p11s).decode(pem);
>         System.out.println(sk2 instanceof ECPrivateKey); // shows "false"

Yes, that's why it says "if supported".  With SunPKCS11, it would be 
P11PrivateKey.   I'll just remove the paragraph since it looks like it may be 
confusing.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/29640#discussion_r3182772384

Reply via email to