Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Managing Public Key Certificates in Matlab

Asked by Jim Hokanson on 27 May 2012

Hi all,

I recently tried to request a secure web page via https and got a Java error when trying to validate a certificate, something about not being able to find a trusted chain. I already have a hard time understanding certificates and now I have to deal with them in Matlab. I think I found a solution to my problem but I have a very minimal idea as to what I did and would love to have someone offer a solution that was nice and simple as opposed to my somewhat kludgy solution that makes me want to throw things.

Formally speaking, the question is how to handle non-trusted certificates in Matlab. This includes everything from my long standing question of, how do I know I can trust them to making it so that Matlab trusts them as well.

Thanks,

Jim

0 Comments

Jim Hokanson

Products

No products are associated with this question.

1 Answer

Answer by Jim Hokanson on 27 May 2012

I ended up entering the url being requested in Chrome. On the left side of the address there is a lock indicating the presence of a secure site. I clicked on it and chose to view certificate information. Under the details tab I was able to copy the certificate to a file. I chose the bottom (most specific certificate) to export and chose the default export options.

Next I found a lot of online discussion about a keystore. Disliking command line options, especially when it comes to long paths and debugging I found an application that seems to work well: http://portecle.sourceforge.net/

Of note, I also tried the Java window in the control panel (Windows 7) and this didn't work for me. I am guessing this is because it is tied to the main JRE on my computer, not the Mathworks JRE.

Apparently, for maximum awesomeness, Matlab ships with its own JRE, except for Macs where it uses the system's JRE. This seems like a bad design decision to me ... See: http://www.mathworks.com/support/solutions/en/data/1-1812J/

Specifically, I think you need to update the cacerts file of the jre, which for me was located at: $Matlab/sys/java/jre/win64/jre/lib/security/cacerts

Using Portecle I opened this file and added the exported certificate. After importing I believe it also gave me a chain error (presumably since I hadn't exported the other certificates), but Portecle asked me if I wanted to trust it anyway, to which I replied yes.

Anyway, I really dislike any solution that requires me to do anything with the installation and operating system instead of from a function directly in Matlab. Any better solution?

0 Comments

Jim Hokanson

Contact us