Unable to get wiremock working on https/ssl/443 with self signed certificates

1,713 views
Skip to first unread message

Vipul Popat

unread,
Oct 12, 2020, 5:07:26 AM10/12/20
to wiremock-user
I am using
java -jar wiremock-standalone-2.27.2.jar 00keystore-type JKS -https-keystore mock.jks --keystore-password xxxxx -https-port 8443

When i access wiremock using the browser i get

ERR_CONNECTION_CLOSED

Can someone help plz - am struggling with this for last 2 weeks

Tom Akehurst

unread,
Oct 12, 2020, 5:42:36 AM10/12/20
to wiremock-user
Firstly, I'd suggest using the jre8 JAR. This has more up-to-date TLS support so may solve the issue.

Failing that, I'd look at how you've built your keystore file and check whether something has gone wrong there. If you post all the steps you took to build it we might be able help figure out what's happened.

Vipul Popat

unread,
Oct 12, 2020, 5:57:47 AM10/12/20
to Tom Akehurst, wiremock-user
Can you send across the url to download that jar?

--
You received this message because you are subscribed to a topic in the Google Groups "wiremock-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/wiremock-user/MnMGnIJd0-U/unsubscribe.
To unsubscribe from this group and all its topics, send an email to wiremock-use...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/wiremock-user/0a956428-f06b-4621-b4f3-b46289cbb323n%40googlegroups.com.

Tom Akehurst

unread,
Oct 12, 2020, 6:16:58 AM10/12/20
to wiremock-user

Vipul Popat

unread,
Oct 14, 2020, 9:29:40 AM10/14/20
to wiremock-user
(base) vipulpopat@vipulpopat-XPS-13-9370:~/Documents/wiremock$ sudo java -jar wiremock-jre8-standalone-2.27.2.jar --https-port 443 --port 80 --https-keystore baeldung.p12 --keystore-type PKCS12 --keystore-password abcd@1234
[sudo] password for vipulpopat: 
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
java.lang.RuntimeException: java.security.UnrecoverableKeyException: Get Key failed: Given final block not properly padded. Such issues can arise if a bad key is used during decryption.
(base) vipulpopat@vipulpopat-XPS-13-9370:~/Documents/wiremock$ 
baeldung.p12

Vipul Popat

unread,
Oct 14, 2020, 9:30:17 AM10/14/20
to wiremock-user
Cant still get it to work

Generated the p12 certs using 

keytool -genkeypair -alias baeldung -keyalg RSA -keysize 2048 -storetype PKCS12 -keystore baeldung.p12 -validity 3650

Vipul Popat

unread,
Oct 15, 2020, 6:21:28 AM10/15/20
to wiremock-user
Would appreciate if someone could help out
Thanks

Vipul Popat

unread,
Oct 15, 2020, 6:03:53 PM10/15/20
to wiremock-user
Can you have a look plz

Tom Akehurst

unread,
Oct 16, 2020, 4:10:02 PM10/16/20
to wiremock-user
I can't see anything wrong with what you've tried.

I generated a keystore the same way using OpenJDK 1.8.0_252 and it worked just fine.

Which Java version are you using?

Vipul Popat

unread,
Oct 16, 2020, 4:49:17 PM10/16/20
to Tom Akehurst, wiremock-user
(base) vipulpopat@vipulpopat-XPS-13-9370:~$ java -version
openjdk version "11.0.8" 2020-07-14
OpenJDK Runtime Environment (build 11.0.8+10-post-Ubuntu-0ubuntu120.04)
OpenJDK 64-Bit Server VM (build 11.0.8+10-post-Ubuntu-0ubuntu120.04, mixed mode, sharing)

--
You received this message because you are subscribed to a topic in the Google Groups "wiremock-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/wiremock-user/MnMGnIJd0-U/unsubscribe.
To unsubscribe from this group and all its topics, send an email to wiremock-use...@googlegroups.com.


--


Regards

_______________________________

Vipul Popat
Email: vipul...@gmail.com
Mobile: +353 87052 5564
_______________________________

Tom Akehurst

unread,
Oct 16, 2020, 4:55:34 PM10/16/20
to wiremock-user
Works for me with OpenJDK 11.0.8 too.

Any chance you've got the keystore password wrong?

Vipul Popat

unread,
Oct 16, 2020, 7:18:18 PM10/16/20
to Tom Akehurst, wiremock-user
Have uploaded the keystore as well as the password.
Can you give it a try if you dont mind?

Tom Akehurst

unread,
Oct 17, 2020, 5:04:52 AM10/17/20
to wiremock-user
I can't see it anywhere. Are you sure you attached it?

Vipul Popat

unread,
Oct 17, 2020, 9:47:21 AM10/17/20
to wiremock-user
I had enclosed this in one of my earlier posts...
Enclosing again anyways
and thanks in advance for helping out
baeldung.p12

Tom Akehurst

unread,
Oct 17, 2020, 11:02:13 AM10/17/20
to wiremock-user
I think the problem is the @ in the password you've set. I tried it with "password" as the password and it works, but generating a keystore with "abcd@1234" as the password I end up seeing the same error you do.

Vipul Popat

unread,
Oct 19, 2020, 6:25:55 AM10/19/20
to wiremock-user
still fails
(base) vipulpopat@vipulpopat-XPS-13-9370:~/Documents/wiremock$ keytool -genkeypair -alias baeldung -keyalg RSA -keysize 2048 -storetype PKCS12 -keystore baeldung.p12 -validity 3650
Enter keystore password:  
Re-enter new password: 
What is your first and last name?
  [Unknown]:  
What is the name of your organizational unit?
  [Unknown]:  
What is the name of your organization?
  [Unknown]:  
What is the name of your City or Locality?
  [Unknown]:  
What is the name of your State or Province?
  [Unknown]:  
What is the two-letter country code for this unit?
  [Unknown]:  
Is CN=Unknown, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown correct?
  [no]:  yes

(base) vipulpopat@vipulpopat-XPS-13-9370:~/Documents/wiremock$ sudo java -jar wiremock-jre8-standalone-2.27.2.jar --https-port 443 --port 80 --https-keystore baeldung.p12 --keystore-type PKCS12 --keystore-password pass1234
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
java.lang.RuntimeException: java.security.UnrecoverableKeyException: Get Key failed: Given final block not properly padded. Such issues can arise if a bad key is used during decryption.


Reply all
Reply to author
Forward
0 new messages