首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >spring-cloud-config-server中的加密

spring-cloud-config-server中的加密
EN

Stack Overflow用户
提问于 2016-12-23 05:09:33
回答 2查看 3.1K关注 0票数 1

我正在尝试使用application.yml中的加密属性运行spring-cloud-config-server。

代码语言:javascript
运行
复制
---

server:
  port: 8888  

spring:
  cloud:
    config:
      server:
        git:
          uri: file:/Users/gadams/git/cs-config

encrypt:
  key-store:
    location: classpath:/config-server.jks
    password: password
    alias: alias
    secret: secret

security:
  user:
    password: '{cipher}encryptedPassword'

我在启动时得到以下错误:

代码语言:javascript
运行
复制
java.lang.IllegalStateException: Cannot decrypt: key=security.user.password
    at org.springframework.cloud.bootstrap.encrypt.EnvironmentDecryptApplicationInitializer.decrypt(EnvironmentDecryptApplicationInitializer.java:201) ~[spring-cloud-context-1.1.6.RELEASE.jar:1.1.6.RELEASE]
    at org.springframework.cloud.bootstrap.encrypt.EnvironmentDecryptApplicationInitializer.decrypt(EnvironmentDecryptApplicationInitializer.java:165) ~[spring-cloud-context-1.1.6.RELEASE.jar:1.1.6.RELEASE]
    at org.springframework.cloud.bootstrap.encrypt.EnvironmentDecryptApplicationInitializer.initialize(EnvironmentDecryptApplicationInitializer.java:95) ~[spring-cloud-context-1.1.6.RELEASE.jar:1.1.6.RELEASE]
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener$DelegatingEnvironmentDecryptApplicationInitializer.initialize(BootstrapApplicationListener.java:333) ~[spring-cloud-context-1.1.6.RELEASE.jar:1.1.6.RELEASE]
    at org.springframework.boot.SpringApplication.applyInitializers(SpringApplication.java:635) [spring-boot-1.4.2.RELEASE.jar:1.4.2.RELEASE]
    at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:349) [spring-boot-1.4.2.RELEASE.jar:1.4.2.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:313) [spring-boot-1.4.2.RELEASE.jar:1.4.2.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1186) [spring-boot-1.4.2.RELEASE.jar:1.4.2.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1175) [spring-boot-1.4.2.RELEASE.jar:1.4.2.RELEASE]
    at com.collegescheduler.ConfigServerApplication.main(ConfigServerApplication.java:12) [bin/:na]
Caused by: java.lang.UnsupportedOperationException: No decryption for FailsafeTextEncryptor. Did you configure the keystore correctly?
    at org.springframework.cloud.bootstrap.encrypt.EncryptionBootstrapConfiguration$FailsafeTextEncryptor.decrypt(EncryptionBootstrapConfiguration.java:152) ~[spring-cloud-context-1.1.6.RELEASE.jar:1.1.6.RELEASE]
    at org.springframework.cloud.bootstrap.encrypt.EnvironmentDecryptApplicationInitializer.decrypt(EnvironmentDecryptApplicationInitializer.java:193) ~[spring-cloud-context-1.1.6.RELEASE.jar:1.1.6.RELEASE]
    ... 9 common frames omitted

我正在使用org.springframework.cloud:spring-cloud-dependencies:Camden.SR3.应该如何加密配置服务器中的spring-security用户密码?

EN

回答 2

Stack Overflow用户

发布于 2016-12-23 12:55:42

日志中的密钥库配置有问题。

首先使用keytool验证密钥库的pass/secret/别名。

票数 0
EN

Stack Overflow用户

发布于 2017-08-24 23:54:00

你尊重prerequisites吗?

先决条件:要使用加密和解密特性,您需要在您的JVM中安装完整的JCE (缺省情况下不在中)。您可以从Oracle下载"Java加密扩展(JCE)无限强度权限策略文件“,并按照安装说明进行安装(实质上是将JRE lib/security目录中的两个策略文件替换为您下载的文件)。

你的pom.xml中也应该有

代码语言:javascript
运行
复制
<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-rsa</artifactId>
</dependency>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41291685

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档