Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SslHttpServerContextFactory does not support private key only PEM content #1298

Closed
tazmaniax opened this issue Mar 10, 2019 · 0 comments · Fixed by #1299
Closed

SslHttpServerContextFactory does not support private key only PEM content #1298

tazmaniax opened this issue Mar 10, 2019 · 0 comments · Fixed by #1299
Milestone

Comments

@tazmaniax
Copy link
Collaborator

When trying use the private key generated by LetsEncrypt the following exception occurs java.lang.ClassCastException: class org.bouncycastle.asn1.pkcs.PrivateKeyInfo cannot be cast to class org.bouncycastle.openssl.PEMKeyPair

~        _            _ 
~  _ __ | | __ _ _  _| |
~ | '_ \| |/ _' | || |_|
~ |  __/|_|\____|\__ (_)
~ |_|            |__/   
~
~ play! 1.5.x-1.5.2-19-ga67b35e9, https://www.playframework.com
~ framework ID is devdb
~
~ Ctrl+C to stop
~ 
~ using java version "11.0.2"
Listening for transport dt_socket at address: 8000
00:52:14,175 [main] WARN  ~ You're running Play! in DEV mode
00:52:14,284 [main] INFO  ~ Listening for HTTP on port 9000 (Waiting a first request to start) ...
00:52:14,291 [main] INFO  ~ Listening for HTTPS on port 9443 (Waiting a first request to start) ...
~ Server is up and running
00:54:08,547 [New I/O server boss #34] ERROR ~ Failed to initialize PEMKeyManager from file conf/privkey.pem
java.lang.ClassCastException: class org.bouncycastle.asn1.pkcs.PrivateKeyInfo cannot be cast to class org.bouncycastle.openssl.PEMKeyPair (org.bouncycastle.asn1.pkcs.PrivateKeyInfo and org.bouncycastle.openssl.PEMKeyPair are in unnamed module of loader 'app')
	at play.server.ssl.SslHttpServerContextFactory$PEMKeyManager.<init>(SslHttpServerContextFactory.java:101)
	at play.server.ssl.SslHttpServerContextFactory$PEMKeyManager.<clinit>(SslHttpServerContextFactory.java:84)
	at play.server.ssl.SslHttpServerContextFactory.<clinit>(SslHttpServerContextFactory.java:52)
	at play.server.ssl.SslHttpServerPipelineFactory.getPipeline(SslHttpServerPipelineFactory.java:30)
	at org.jboss.netty.channel.socket.nio.NioServerBoss.registerAcceptedChannel(NioServerBoss.java:134)
	at org.jboss.netty.channel.socket.nio.NioServerBoss.process(NioServerBoss.java:104)
	at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:337)
	at org.jboss.netty.channel.socket.nio.NioServerBoss.run(NioServerBoss.java:42)
	at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
	at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)

Play Version (1.5.x / etc)

1.5.x-1.5.2-19-ga67b35e9

Operating System (Ubuntu 15.10 / MacOS 10.10 / Windows 10)

macOS 10.14.4 Beta (18E205e)

JDK (Oracle 1.8.0_72, OpenJDK 1.8.x, Azul Zing)

11.0.2

Reproducible Test Case

Would have but didn't have another LetsEncrypt private key apart from my own that I can't give out.

tazmaniax added a commit to tazmaniax/play1 that referenced this issue Mar 10, 2019
tazmaniax added a commit to tazmaniax/play1 that referenced this issue Mar 10, 2019
@tazmaniax tazmaniax changed the title SslHttpServerContextFactory does not support PrivateKeyInfo SslHttpServerContextFactory does not support only private key Mar 11, 2019
@tazmaniax tazmaniax changed the title SslHttpServerContextFactory does not support only private key SslHttpServerContextFactory does not support private key only PEM content Mar 11, 2019
xael-fry pushed a commit that referenced this issue Apr 8, 2019
* #1298: Added handler for just ASN1 private key info
* #1298: Unified the private key fetching
Task-Url: #1298
@xael-fry xael-fry added this to the 1.5.3 milestone Apr 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants