Hi,
I am trying to implement TLS with temporal. I ran the generate-test-certs.sh and got the certificates generated in certs folder. Now I am using the client.pem and client.key certificates inside samples-java/SslEnabledWorker.java at main · temporalio/samples-java · GitHub
Facing issue as below :
Exception in thread "main" java.lang.IllegalArgumentException: Input stream does not contain valid private key.
at io.grpc.netty.shaded.io.netty.handler.ssl.SslContextBuilder.keyManager(SslContextBuilder.java:416)
at io.temporal.serviceclient.SimpleSslContextBuilder.configure(SimpleSslContextBuilder.java:116)
at io.temporal.serviceclient.SimpleSslContextBuilder.build(SimpleSslContextBuilder.java:141)
at io.temporal.samples.ssl.SslEnabledWorker.main(SslEnabledWorker.java:52)
Caused by: java.security.spec.InvalidKeySpecException: Neither RSA, DSA nor EC worked
at io.grpc.netty.shaded.io.netty.handler.ssl.SslContext.getPrivateKeyFromByteBuffer(SslContext.java:1155)
at io.grpc.netty.shaded.io.netty.handler.ssl.SslContext.toPrivateKey(SslContext.java:1134)
at io.grpc.netty.shaded.io.netty.handler.ssl.SslContextBuilder.keyManager(SslContextBuilder.java:414)
... 3 more
Caused by: java.security.spec.InvalidKeySpecException: java.security.InvalidKeyException: IOException : algid parse error, not a sequence
at jdk.crypto.ec/sun.security.ec.ECKeyFactory.engineGeneratePrivate(ECKeyFactory.java:169)
at java.base/java.security.KeyFactory.generatePrivate(KeyFactory.java:390)
at io.grpc.netty.shaded.io.netty.handler.ssl.SslContext.getPrivateKeyFromByteBuffer(SslContext.java:1153)
... 5 more
Caused by: java.security.InvalidKeyException: IOException : algid parse error, not a sequence
at java.base/sun.security.pkcs.PKCS8Key.decode(PKCS8Key.java:350)
at java.base/sun.security.pkcs.PKCS8Key.decode(PKCS8Key.java:355)
at jdk.crypto.ec/sun.security.ec.ECPrivateKeyImpl.<init>(ECPrivateKeyImpl.java:77)
at jdk.crypto.ec/sun.security.ec.ECKeyFactory.implGeneratePrivate(ECKeyFactory.java:237)
at jdk.crypto.ec/sun.security.ec.ECKeyFactory.engineGeneratePrivate(ECKeyFactory.java:165)
... 7 more
Caused by: java.security.spec.InvalidKeySpecException: Neither RSA, DSA nor EC worked
Caused by: java.security.spec.InvalidKeySpecException: java.security.InvalidKeyException: IOException : algid parse error, not a sequence
Caused by: java.security.InvalidKeyException: IOException : algid parse error, not a sequence
Below is the code reference:
I feel issue is with the private key generation. Please guide.