我过去遇到过同样的挑战,并在我的库中提供了这个选项,你可以在这里看到:GitHub - SSLKickstart - Kickstart我认为在这里分享它可能对其他开发人员有帮助。
用法
Map<String, List<Certificate>> certificates = CertificateUtils.getCertificate(
"https://github.com/",
"https://stackoverflow.com/",
"https://reddit.com/",
"https://youtube.com/");
// or get the server certificates as pem format
Map<String, List<String>> certificatesAsPem = CertificateUtils.getCertificateAsPem(
"https://github.com/",
"https://stackoverflow.com/",
"https://reddit.com/",
"https://youtube.com/");
使用 maven 安装库
<dependency>
<groupId>io.github.hakky54</groupId>
<artifactId>sslcontext-kickstart</artifactId>
<version>6.7.0</version>
</dependency>