Open rogermap opened 5 months ago
Yes, it appears the default implementation checks the format before it checks the key class, returning true if it matches. I don't think it makes sense for the JVM to be doing a format check here, all PrivateKeys will have the format PKCS#8, it should only be checking the key class.
In JDK 21
java.security.Signature
method the provider chooser algorithm contains this code:org.bouncycastle.jcajce.provider.asymmetric.rsa.DigestSignatureSpi$SHA1
returns true for PKCS#8 encodedECPrivateKey
The algorithm choose that provider and in the provider
init
method throws an exception because it is not aRSAPrivateKey
Edited for formatting by @cipherboy.