Using TLSv1.2 with webread

11 views (last 30 days)
Andrew Stamps
Andrew Stamps on 17 May 2018
Edited: Rylan Dmello on 28 Jul 2022
I have been consuming a RESTful API for a secure web service my company supports using webread. However, they recently disabled TLSv1 connections for security reasons, and they now require TLSv1.1 or TLSv1.2. This seems to have broken my code. Is anyone aware of a way to change settings such that TLSv1.1 or TLSv1.2 would be used with webread or am I looking at trying to replicate this functionality using .NET?
  1 Comment
Paolo
Paolo on 18 May 2018
weboptions allows you to add HTTP headers. You can add the HTTP header you require to weboptions with the 'KeyName' and 'KeyValue' pairs.
Alternatively, you can use 'curl' which allows you to specify directly the tls version.

Sign in to comment.

Accepted Answer

Rylan Dmello
Rylan Dmello on 21 May 2018
Edited: Rylan Dmello on 28 Jul 2022
Update for MATLAB R2019b and newer:
webread natively supports TLS 1.2 in MATLAB R2019b and newer.
MATLAB R2019a and older:
TLS 1.2 support can be enabled in MATLAB versions which use Java 1.7 by adding the following Java startup option:
-Dhttps.protocols=TLSv1.2
to a java.opts file and then restarting MATLAB.
Please refer to the following documentation page for more information on creating a java.opts file and specifying MATLAB's JVM startup options:
  2 Comments
Ricardo MF
Ricardo MF on 19 Aug 2021
Problem solved. Matlab incorporated the TLS instruction as suggested and solved the problem with urlread/urlwrite. Tks a lot. Best regards.

Sign in to comment.

More Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Products


Release

R2016b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by