【发布时间】:2021-10-27 00:16:57
【问题描述】:
我刚刚尝试使用此页面中的方法从 DigiCert 安装我的证书以在 SpringBootApplication 上激活 SSL:https://www.thomasvitale.com/https-spring-boot-ssl-certificate/。我是一步一步做的,但我以编程方式设置配置,而不是使用属性文件。
SpringApplication springApplication = new SpringApplication(PosDetailServer.class);
Map<String, Object> defaults = new HashMap<>();
if(args[0].equalsIgnoreCase("https")) {
defaults.put("server.ssl.key-store", args[1]);
defaults.put("server.ssl.key-store-password", "password");
defaults.put("server.ssl.key-store-type", "PKCS12");
defaults.put("server.ssl.key-alias", "tomcat");
defaults.put("server.ssl.key-password", "password");
}
defaults.put("server.port", "8181");
springApplication.setDefaultProperties(defaults);
springApplication.run(args);
当我尝试运行它时,我得到了错误:
IllegalArgumentException:DerInputStream.getLength():lengthTag=109,太大。
步骤有什么问题?我该如何解决?
【问题讨论】:
标签: java spring spring-boot tomcat