Search code examples
javadeploymentcryptographyjavafx-2self-contained

JavaFX self-contained apps are missing the Cipher cryptographic service?


For some reason, JavaFX does not seem to currently support any algorithms for the Cipher cryptographic service when the application is executed after the self-contained deployment, as described here.

Given this code:

import java.security.Security;
import java.util.Iterator;
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.Scene;
import javafx.scene.control.ListView;
import javafx.stage.Stage;



public final class Main extends Application
{
    @Override
    public void start(final Stage stage)
    {
        final ObservableList<String> ol = FXCollections.observableArrayList();
        final ListView<String> lv = new ListView(ol);

        for (final Iterator<String> iter = Security.getAlgorithms("Cipher").iterator(); iter.hasNext();)
            ol.add(iter.next());

        final Scene s = new Scene(lv, 500, 400);

        stage.setScene(s);
        stage.sizeToScene();
        stage.show();
    }
}

There is no problem getting populated output with various algorithms if this code is ran locally through the java launcher, but gives an empty list if the application has been packaged as self-contained.

However, I have also stumbled upon this:

Only a subset of Java Runtime is included by default. Some optional and rarely used files are excluded to reduce the package size, such as all executables. If you need something that is not included by default, then you need to copy it in as a post-processing step. For installable packages, you can do this from the config script that is executed after populating the self-contained application folder. See Section 6.3.3, "Customization Using Drop-In Resources."

Could the quoted paragraph be the probable cause? What kind of workaround would be needed in order to get this functionality included into the self-contained runtime?

Thank you.


Solution

  • Looking at this link the bundled JCE isn't packaged by default.