Hi all, I am getting this error when enabling the ...
# help
l
Hi all, I am getting this error when enabling the forward proxy on mac via java standalone on mac OS. The certificate looks installed and trusted on the keychain access, what might be the issue?
Copy code
Dynamic certificate generation is not supported because certificates cannot be generated; perhaps the sun internal classes are not available?
t
Hi Leonardo, you need 2 things to make this work: 1. Java 17+ 2.
--add-exports=java.base/sun.security.x509=ALL-UNNAMED
on JVM startup
l
thanks Tom, sorry you mean like this?
Copy code
java --add-exports=java.base/sun.security.x509=ALL-UNNAMED -jar wiremock-standalone-3.2.0.jar --enable-browser-proxying --port 9999 --trust-all-proxy-targets
I am getting the same error.. and I am running java 20.0.1
t
I would have expected that to work, although I’ve not tried it on Java 20
l
java 17 seems to work fine actually
t
OK, I guess there are different parameters that need to be set on Java 20. @Rob Elliot I don’t suppose you happen to know what this should be?
r
Just looked into it -
java.lang.NoSuchMethodError: 'void sun.security.x509.CertificateExtensions.set(java.lang.String, java.lang.Object)
Don't know if we can work round it, but it might be an indicator that we should abandon using the
sun.security.x509
package...
t
Hmmm…yeah, it’s looking like that might be necessary.
r
Looks like it has been replaced by
public void setExtension(String name, Extension ext)
t
Can we do something horrible with reflection in the interim?
Long term, I still quite like the idea of creating a separate certificate authority library with BouncyCastle, ProGuarding it down to a sensible size and then using that. But that sounds like quite a bit of work.
r
If we could persuade it to compile, this monstrosity would work:
Copy code
SubjectAlternativeNameExtension subjectAlternativeNameExtension = new SubjectAlternativeNameExtension(names);
try {
  extensions.set(SubjectAlternativeNameExtension.NAME, subjectAlternativeNameExtension);
} catch (NoSuchMethodError ignored) {
  extensions.setExtension(SubjectAlternativeNameExtension.NAME, subjectAlternativeNameExtension);
}
Would probably need reflection though
t
I was thinking that - not sure there’d be any way to get it to compile.
r
Ugh, there are more removed methods
t
😬
r
X509CertInfo.set(String name, Object val)
has become a whole bunch of named methods -
setVersion
,
setSubject
etc