Menu
Who Do Is
  • Home
  • What
  • How
  • Is
  • Can
  • Are
  • Does
  • Do
  • Why
  • Who
  • Where
  • Which
  • Which
  • Should
  • Will
  • When
  • What’s
  • Did
Who Do Is

[ANSWERED] java – Does Spark server running secure on Android work?

Posted on November 14, 2022

Solution 1 :

Since JEP-229, which shipped with Java 8, the default keystore type of the Java runtime is PKCS12.

I guess it would make sense if the secure(...) method of Spark also accepted a parameter for the type of keystore. Maybe you should check in their issue tracker if they’d be interested in a contribution for this.

Problem :

I am trying to run a Spark (sparkjava.com) server application that runs on Android. This server requires support for HTTPS. I am using Spark 2.9.2.

Here is the secure call to support HTTPS in Spark.

secure(“/sdcard/oursecurity/keystore.bks”, “mypassword”, null, null);

When the application is started, it crashes with a java.security.KeyStoreException: JKS not found.
I have seen in various posts that Android does not support the JKS keystore type.

While debugging, I noticed that the Jetty server has a setKeyStoreType call that allows the user to change the keystore type from Jetty’s default of JKS to some other type.

My plan is to do the following:

  1. Download the Spark 2.9.2 source code.
  2. In the createSecureSocketConnector method of the Spark file /src/main/java/spark/embeddedserver/jetty/SocketConnectorFactory.java, call sslContextFactory.setKeyStoreType(AndroidSupportKeystoreType) to switch the keystore type to a keystore type supported by Android.
  3. Rebuild the class and create a new modified Spark jar.
  4. Rebuild my application with this new modified Spark jar.

I am thinking of using BKS or PKCS12 as the keystore type.

Has anyone else run the Spark server successfully on Android with support for HTTPS requests? If so, any suggestions would be appreciated.

Comments

Comment posted by this question

Did you see

Comment posted by paul

@mthmulders No, I had not seen that question. Thanks for pointing it out. Unfortunately, my issue is different. I am able to run Spark in Android successfully. However, I am not able to run Spark in Android when supporting the “secure” call which is needed to support HTTPS requests. Hopefully I can help the other person with their question.

READ  [ANSWERED] android - Floating toolbar for text selection Jetpack Compose
Powered by Inline Related Posts

Comment posted by paul

Thanks for the info on the default keystore type and the issue tracker. I can take a look at the tracker.

Recent Posts

  • How can I play with my cat without toys?
  • What is a bag pipe band called?
  • Are Honda Civics actually fast?
  • Are Yankee candles toxic?
  • How do I pair my Michael Kors smartwatch with my Android?

Recent Comments

No comments to show.

Archives

  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022

Categories

  • ¿Cómo
  • ¿Cuál
  • ¿Cuántas
  • ¿Cuánto
  • ¿Que
  • ¿Quién
  • 90” and 108” so you may have to round up to the nearest size.
  • and delete any Spotify folders from it. Once this is done
  • Android
  • Are
  • At
  • Bei
  • blink
  • C'est
  • Can
  • carbs
  • Comment
  • Did
  • Do
  • Does
  • During
  • For
  • Has
  • How
  • In
  • Is
  • Ist
  • Kann
  • Können
  • nouveau
  • On
  • or 108 inches.2020-08-03
  • Où
  • owning
  • Pourquoi
  • Puis-je
  • Quand
  • Quante
  • Quel
  • Quelle
  • Quelles
  • Quels
  • Qui
  • Should
  • Sind
  • Sollte
  • spiritual
  • tap the downward-facing arrow on the top left. A downward-facing arrow will appear underneath each song in the album; they'll turn green as the download completes.2020-07-28
  • Uncategorized
  • Wann
  • Warum
  • Was
  • Welche
  • Welcher
  • Welches
  • Welke
  • Wer
  • Were
  • What
  • What's
  • When
  • Where
  • Which
  • Who
  • Whose
  • Why
  • Wie
  • Will
  • Wo
  • Woher
  • you will receive two curtains each with the same measurements of width 66"" (168cm) x drop 54""(137cm).
  • you'll see a green downward-facing arrow next to each song.2021-02-26
©2023 Who Do Is | Powered by SuperbThemes & WordPress