【问题标题】:Spring Cloud Config server showing invalidPrivateKeySpring Cloud Config 服务器显示 invalidPrivateKey
【发布时间】:2018-10-31 22:42:18
【问题描述】:

我正在尝试创建 spring 云配置服务器以使用 SSH URI 连接到 git 存储库(bitbucket)。我正在关注 Spring Cloud Config

我使用 ssh-keygen 实用程序生成了密钥对,并将 .pub 文件内容粘贴到了我的 bitbucket 帐户的 ssh 部分,但是当我运行作为 Spring Boot 应用程序的服务器时,我得到了无效的 privateKey 异常。

我也使用了this堆栈溢出帖子中提供的建议,但没有运气,仍然得到同样的错误。

  1. 是否有任何特定格式需要我们将私钥文件放入 application.yml 或 .properties 文件中?

  2. 如果我想使用 .properties 而不是 .yml 那么如何将 privateKey 属性值放在一行中,因为生成的私钥文件文本包含换行符?

【问题讨论】:

  • 对于仍然遇到此问题的任何人,请使用 newline characters 表示 .properties 文件,使用文字运算符(管道 |)字符表示 .yaml 文件。

标签: java spring-boot ssh bitbucket spring-cloud-config


【解决方案1】:

.pub 似乎是公钥,您需要提供私钥。 无论如何,我有类似的问题,从 yaml 解析密钥时发生 Base64 编码错误:

Caused by: java.lang.IllegalArgumentException: Bad Base64 input character at 4 : 45 (decimal)

【讨论】:

    猜你喜欢
    • 2018-11-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-02-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多