spyhunter99 / installcert

fork of http://s-n-ushakov.blogspot.com/2013/11/yet-another-installcert-for-java-now.html to use as a library
BSD 3-Clause "New" or "Revised" License
18 stars 11 forks source link

Unable to save certificate with special characters in host name? #13

Closed AndriyKalashnykov closed 6 years ago

AndriyKalashnykov commented 6 years ago

java -jar install-cert-1.0.4-jar-with-dependencies.jar -host self-signed.badssl.com:443 -noimport -file

java -jar install-cert-1.0.4-jar-with-dependencies.jar -host self-signed.badssl.com:443 -noimport -file

... loading system truststore from 'C:\Program Files (x86)\Java\jre1.8.0_181\lib\security\cacerts' ... ... loading system truststore from 'C:\opt\jdk\jdk1.8.0_92\jre\lib\security\cacerts' ... Opening connection to self-signed.badssl.com:443... ... opening connection to self-signed.badssl.com:443 ... ... starting SSL handshake ... javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

Server sent 1 certificate(s):

Subject CN=.badssl.com, O=BadSSL, L=San Francisco, ST=California, C=US Issuer CN=.badssl.com, O=BadSSL, L=San Francisco, ST=California, C=US CN *.badssl.com From Wed Aug 15 11:21:53 EDT 2018 Util Fri Aug 14 11:21:53 EDT 2020 Serial 17969515223390352629 SHA1 7a 57 d3 24 3e 9d 37 e9 c7 43 62 68 eb 03 eb 2e d8 f0 52 96 MD5 f6 f1 84 25 b5 b4 db df 75 1b fa c2 e5 e2 dd 95

Do you want to trust this certifcate (y/n)? > y Exception in thread "main" java.io.FileNotFoundException: self-signed.badssl.com - *.badssl.com.crt (The filename, directory name, or volume label syntax is incorrect) at java.io.FileOutputStream.open0(Native Method) at java.io.FileOutputStream.open(FileOutputStream.java:270) at java.io.FileOutputStream.(FileOutputStream.java:213) at java.io.FileOutputStream.(FileOutputStream.java:162) at java.io.FileWriter.(FileWriter.java:90) at usn.net.ssl.util.InstallCert.saveCerts(InstallCert.java:175) at usn.net.ssl.util.InstallCert.main(InstallCert.java:749)

spyhunter99 commented 6 years ago

thanks for the report. probably needs to whitelist the characters based on the cert name.

spyhunter99 commented 6 years ago

fixed and release via central, should be available globally shortly