Author Topic: Unable to activate a valid license in MATLAB R2017a and prior  (Read 816 times)

Developer Team

  • Staff
  • *
  • Posts: 6
    • View Profile
The issue:
Although after entering the license information the license is considered valid, the license cannot be activated in MATLAB R2017a or earlier. Note that Code Checker for MATLAB release 2.5.0 and releases after it do not support MATLAB releases before R2017b. Even after fixing the issue described here, you will not be able to use those versions of Code Checker for MATLAB on MATLAB releases older than R2017b.

After attempting activation the license status in the dialog shows:

The cause
This behavior may be related to the fact that the License Activation Server for Code Checker for MATLAB uses LetsEncrypt certificates.

Per LetsEncrypt root certificates are not included in Java 7 < 7u111 and Java 8 < 8u101.

MATLAB R2017a and earlier ship with Java Runtime Environments that do not include the LetsEncrypt root certificates
To still use Code Checker for MATLAB with these MATLAB versins, the Let's Encrypt certificates  must be included in the MATLABs Java keystore.

The solution
Option 1
Code Checker for MATLAB comes with a utility and the certificates to update the MATLAB Java keystore.
It is necessary to have write access to the keystore, therefore run MATLAB as administrator and run:

Code: [Select]
Certficates may be removed of "forcefully" reinstalled by running:

Code: [Select]

Code: [Select]

Option 2
Alternatively you may install the certificates manually (it is necessary to have write access to the keystore).

1. Find the LetsEncrypt certificates here:

    Our utility installs:
  • ISRG Root X1 (self-signed)
  • Let’s Encrypt Authority X3 (IdenTrust cross-signed)
  • Let’s Encrypt Authority X3 (Signed by ISRG Root X1)
  • Let’s Encrypt Authority X4 (IdenTrust cross-signed)
  • Let’s Encrypt Authority X4 (Signed by ISRG Root X1)

2. MATLAB code to compose the system commands that add the certificates to the keystore (replace "letsEncryptCertAlias" and "letsEncryptCertFile" with the appropriate alias and file).
Code: [Select]
myKeystore = fullfile(matlabroot, 'sys', 'java', 'jre', computer('arch'), 'jre', 'lib', 'security', 'cacerts');
myKeytool  = fullfile(matlabroot, 'sys', 'java', 'jre', computer('arch'), 'jre', 'bin', 'keytool');
systemAddTrustCACertCommand = [...
            '"', myKeytool, '" -trustcacerts ', ...
            '-keystore "', myKeystore, '" ', ...
            '-alias ', 'letsEncryptCertAlias', ' ', ...
            '-storepass changeit ', ...
            '-noprompt ', ...
            '-importcert ', ...
            '-file "', 'letsEncryptCertFile', '"'];
« Last Edit: 28 October, 2020, 15:46:00 by Developer Team »