使用 .ca-bundle、.crt 和 .key 文件为 Akka 服务器设置 https 支持

Set https support for Akka server with .ca-bundle, .crt and .key files

我有一个简单的 Akka http 服务器,但我必须设置 https 支持。 我有三个证书文件:.crt、.key 和 .ca-bundle 在 Akka 文档中,只有 PKCS12 示例。 我该如何处理我拥有的文件?

def initializeWebServer(interface: String,
                          port: Int) = {

        val route : Route =
          pathPrefix("secured") {
            authenticateOAuth2(realm = "secure site", checkAuthentication){ token =>
            concat(
              get{
                path("hello"){
                  complete("hello world")
                }
              }
            )
          }
        }

    val bindingFuture = Http().bindAndHandle(route, interface, port.toInt)
    CoordinatedShutdown(system).addJvmShutdownHook({
      bindingFuture
        .flatMap(_.unbind())
    })
  }

  def myUserPassAuthenticator(credentials: Credentials): Option[String] =
    credentials match {
      case p@Credentials.Provided(id) if p.verify("secret") => Some(id)
      case _ => None
    }

  def checkAuthentication(credentials: Credentials): Option[String] = credentials match {
    case p @ Credentials.Provided(token) if p.verify("secret") => Some(token)
    case _ => None
  }

感谢@Leo C 的评论,