Installation of certificate for Java Runtime

מתוך ויקי נטפרי
גרסה מ־04:10, 17 באוגוסט 2023 מאת שלמה (שיחה | תרומות) (fix: use {{he}} for link to hebrew page instead of {{en}} (דרך WP:JWB))
(הבדל) → הגרסה הקודמת | הגרסה האחרונה (הבדל) | הגרסה הבאה ← (הבדל)
קפיצה לניווט קפיצה לחיפוש

לעברית לחצו כאן

To switch from edit view to read view

To search in the Wiki

Home page > Security certificate > Installation of certificate for Java Runtime ‎‎


Update: as of 3 May 2019, a new certificate installation software was released, the new software automatically installs the certificate also in Java Runtime Environment.

Java Runtime Environment

The Java Runtime does not use the OS certificate store, but instead maintains it's own trusted certificate store. In order for Java based programs (e. g. Eclipse IDE) to be able to access secure sites, It is necessary to install a security certificate for Java separately using the dedicated tool that comes as part of the JVM.

Download the NetFree Security certificate from. https://netfree.link/netfree-ca.crt

On windows systems, in case you have installed the security certificate installer, the certificate already exists in the following location:

%ProgramData%\NetFree\CA\netfree-ca-last.crt

Once you know the certificate location path, run a command line - CMD in the Command Prompt window run as an administrator, and move to the folder where the keytool software is located - the dedicated tool for adding a security certificate to the unique certificate database for JAVA.

"keytool" is located in the following location:

%JAVA_HOME%\bin

Or

C:\Program Files\Java\jdk<הגירסה המותקנת אצלכם>\bin

After navigating the command line to the keytool location and checking that it exists in that location (by running the keytool command and checking the output, or running directly at any location where you will be of the command "JAVA_HOME%\bin\keytool%")

Write the following command (the exact location of the security certificate file):

keytool -importcert -trustcacerts -alias netfree-ca -file %ProgramData%\NetFree\CA\netfree-ca-last.crt -keystore "%JAVA_HOME%/jre/lib/security/cacerts" -storepass changeit -noprompt

The command output should be like this:

certificate added to the keysotre.

In any case if the output is not like this, you should check the output that appears in depth and see which data is incorrect.

In order for the changes to take effect on software that has a security issue, the software must be restarted.

Command for Mac / Linux computers

KEYSTORE=/path/to/cacerts
curl -sL https://netfree.link/netfree-ca.crt |  keytool -importcert -trustcacerts -alias netfree-ca-$(date "+%m%d%H%M%S")  -keystore $KEYSTORE -storepass changeit -noprompt

Note: The above command downloads and also installs the certificate without leaving a trace in the file system. The certificate is given a unique name so that it can be installed again and again without any problems. This is useful in case of changing a supplier and needs to be installed again.


JAVA-based software

Sometimes JAVA-based software installs a private Java Runtime Environment in Program Files instead of using the globally installed environment (e.g., all intelij software (including android studio)). In this case it is necessary to import the NetFree certificate for each software separately.

To import the certificate, you must first locate the file that stores the certificates. Usually the JAVA environment is installed in program files in a subfolder named java or jre. Inside the subfolder there will be a path named: lib\security\ and inside it a file named cacerts.

You can search for files named cacerts at the command prompt using the following command:

dir c:\ /s /b | findstr -i cacerts

You can also search for the cacerts file that the software uses, with search software such as everything searching for the word cacerts and check the path of the file.

Solution 1 (recommended)

Find the path to the cacerts file in the specific software installation, and use this path with the command mentioned above.

Solution 2

The security certificate can be imported using graphical software called KeyStore Explorer, the software is downloadable from here.

Instructions for use of KeyStore Explorer software:

The software usually needs to be run as a administrator.

In the welcome window, click on the highlighted area:

KeyStore 1.png

In the window that opens, choose the cacerts file, which is in the location described above.

KeyStore 2.png

A password request will now appear:

KeyStore 3.png

The default password is changeit .

Now the file is open and we will see a list of existing certificates . Click "Import Trusted Certificates":

KeyStore 4.png

And select the NetFree certificate file. (can be downloaded from here).

In the next window, click "OK".

KeyStore 5.png

ctrl+s Or Clicking "Save" to save the changes
KeyStore 4.1.png