Alex Styl
11/27/2023, 7:32 AMval keyStore = KeyStore.getInstance(KeyStore.getDefaultType())
keyStore.load(null, null)
and this to setup the server:
val environment = applicationEngineEnvironment {
sslConnector(
keyStore = keyStore,
keyAlias = "",
keyStorePassword = { "".toCharArray() },
privateKeyPassword = { "".toCharArray() }
) {
port = SERVER_HTTPS_PORT
}
module {
routing {
// ...
however, when I run the app i get
java.lang.NullPointerException: connector.keyStore.getCe…Chain(connector.keyAlias) must not be null
at io.ktor.server.netty.NettyChannelInitializer.<init>(NettyChannelInitializer.kt:54)
at io.ktor.server.netty.NettyApplicationEngine.createBootstrap(NettyApplicationEngine.kt:182)
at io.ktor.server.netty.NettyApplicationEngine.access$createBootstrap(NettyApplicationEngine.kt:30)
at io.ktor.server.netty.NettyApplicationEngine$bootstraps$2.invoke(NettyApplicationEngine.kt:163)
at io.ktor.server.netty.NettyApplicationEngine$bootstraps$2.invoke(NettyApplicationEngine.kt:162)
The error seems to be that ktor expects to have some key alias, however the Android Keystore afaik has none. Was anyone able to get this working?Aleksei Tirman [JB]
11/27/2023, 11:07 AMAlex Styl
11/27/2023, 11:25 AMAlex Styl
11/27/2023, 11:27 AMAlex Styl
11/27/2023, 11:28 AMAleksei Tirman [JB]
11/27/2023, 11:30 AMAlex Styl
11/27/2023, 11:33 AMAlex Styl
11/27/2023, 11:55 AMAlex Styl
11/27/2023, 11:59 AMAleksei Tirman [JB]
11/27/2023, 12:01 PMAlex Styl
11/27/2023, 12:10 PMval store = KeyStore.getInstance("JKS")!!
see the build() part of buildKeyStore{}
at that line, Android throw a:
Caused by: java.security.KeyStoreException: JKS not found
if you replace that with val store = KeyStore.getInstance(KeyStore.getDefaultType())!!
it work on AndroidAlex Styl
11/27/2023, 12:11 PMAlex Styl
12/02/2023, 10:48 AMKivia Brito
08/21/2024, 9:32 PMAleksei Tirman [JB]
08/22/2024, 7:48 AMKivia Brito
08/22/2024, 4:19 PM