1

I cannot get Jarsigner to use HTTPS Proxy. For my system I have configured the http & https proxy in /etc/sysconfig/proxy. I have even added proxy in Java Control.

Checking with wget and the proxy does work:

user@machineLinx:~/workspace/myApp> wget     https://timestamp.geotrust.com/tsa
--2015-10-05 16:06:30--  https://timestamp.geotrust.com/tsa
Resolving proxy.spacetec.no... 100.11.4.6
Connecting to proxy.spacetec.no|100.11.4.6|:3128... connected.
Proxy request sent, awaiting response... 404 Not Found
2015-10-05 16:06:31 ERROR 404: Not Found.

Using Jarsigner does not use the provided Proxy:

/usr/java/jdk1.7.0_80/bin/jarsigner -J-Dhttps.proxyHost=http://proxy.company.com -J-Dhttps.proxyPort=3128 -keystore /home/user/keystore.p12 -storepass myStorePass -storetype pkcs12 -tsa https://timestamp.geotrust.com/tsa workspace/myApp/target/myApp-1.0.0-SNAPSHOT.jar alias

jarsigner: unable to sign jar: no response from the Timestamping Authority. When connecting from behind a firewall an HTTP or HTTPS proxy may need to be specified. Supply the following options to jarsigner:
  -J-Dhttp.proxyHost=<hostname>
  -J-Dhttp.proxyPort=<portnumber>
or
  -J-Dhttps.proxyHost=<hostname> 
  -J-Dhttps.proxyPort=<portnumber> 

So why is the proxy working on my system, but not with Java? I have tried with both jdk1.7.0_80 and jdk1.8.0_60

jarsigner communicates with the TSA using the Time-Stamp Protocol (TSP) defined in RFC 3161. The protocol basically assumes a listener process on a TSA that can accept TSA messages on a well-defined port (IP port number 318).

Could it be that my Proxy does not communicate with this port for TSP?

DJViking
  • 832
  • 1
  • 12
  • 29
  • Delete `-J-Dhttps.proxyHost=http://proxy.company.com -J-Dhttps.proxyPort=3128` and try again. – Afsin Buyuksarac Oct 05 '15 at 14:28
  • Maybe it's because the URL `https://timestamp.geotrust.com/tsa` returns a `404` error. – SubOptimal Oct 05 '15 at 14:42
  • I have tried with and without without -J-Dhttps.proxy* and still Jarsigner tells my to use these settings because it cannot get a respons from the TSA. Still you can see that wget is using the proxy, regardless of the result. The URL to the TSA does return a HTTP 404 error, but behind the jarsigner is using the TimeStamp Protocol against this URL on port 318 – DJViking Oct 06 '15 at 06:53

1 Answers1

3

Removed http:// from proxy host fixes this problem

-J-Dhttps.proxyHost=proxy.company.com -J-Dhttps.proxyPort=3128
DJViking
  • 832
  • 1
  • 12
  • 29
  • 2
    Additionally, if your proxy requires authentication, pls also add: `-J-Dhttp.proxyUser= -J-Dhttp.proxyPassword=` – sujit Dec 22 '15 at 08:12