grpc-spring icon indicating copy to clipboard operation
grpc-spring copied to clipboard

About java pkcs8 and the OpenSSL pkcs1*

Open f1024557668 opened this issue 3 years ago • 2 comments

I used the openssl to generate the server and client file,when I used them in my project.It throw an exception about this: java.security.InvalidKeyException: IOException : algid parse error, not a sequence at sun.security.pkcs.PKCS8Key.decode(PKCS8Key.java:351) ~[na:1.8.0_77] at sun.security.pkcs.PKCS8Key.decode(PKCS8Key.java:356) ~[na:1.8.0_77] at sun.security.ec.ECPrivateKeyImpl.(ECPrivateKeyImpl.java:73) ~[sunec.jar:1.8.0_60] at sun.security.ec.ECKeyFactory.implGeneratePrivate(ECKeyFactory.java:237) ~[sunec.jar:1.8.0_60] at sun.security.ec.ECKeyFactory.engineGeneratePrivate(ECKeyFactory.java:165) ~[sunec.jar:1.8.0_60] ... 28 common frames omitted If I import the thrid jar like the bcprov-jdk15on-164.jar and bcpkix-jdk15on-164.jar,it would be OK?

f1024557668 avatar Sep 14 '22 09:09 f1024557668

I've transformed the .key file,but when run the program it throw Port xxxx was already in use.I'm sure there is no program used.

f1024557668 avatar Sep 14 '22 09:09 f1024557668

If you post an error like this please also include at least the relevant parts of your configuration, such as cert file names.


As for the original error. This sounds like an error where you use Java11/17 to create the keystore but use J8 to load it. Some algorithms have been added in the later Java versions that fail on J8. Adding bcprov/bcpkix might help to solve the issue, but that I'm not sure. Another potential solution is to change the keystore extension as the default keystore type might not fit.


As for the later error:

Please post the error message/logs and relevant configuration.

ST-DDT avatar Sep 14 '22 17:09 ST-DDT

No feedback/information provided.

ST-DDT avatar May 26 '23 20:05 ST-DDT