Webwrite with SSL Certification

29 views (last 30 days)
Simon Ward
Simon Ward on 13 Oct 2023
Commented: Joey on 10 Oct 2024
Hi folks
I've used webwrite for a bunch of calls to various APIs, but I'm lost with this one...
I am connecting to a web service that requires SSL verification. I can connect with SOAPUi without trouble, so I'm hoping to roll out a similar solution in Matlab. I have a .pem file for both the cert and the key, however weboptions makes reference to CertificateFileName but not any accompanying key or password. It's also not clear what kind of certificates can be handled by Matlab for this purpose (.pem / .p12 etc).
I'm sure there is a Java workaround, but it would be great if this type of query could be handled in the Matlab environment.
Any hint would be really appreciated.
Thanks
Simon
  1 Comment
Joey
Joey on 10 Oct 2024
Did you ever figure this out by chance? Simply combining the .crt and .pem into a single .pem and trying to pass it through CertificateFileName attitrubte in weboptions did not work for me

Sign in to comment.

Answers (1)

Dheeraj
Dheeraj on 26 Oct 2023
Hi,
I understand you want to connect to a web service that require SSL certification. MATLAB “weboptions” object supports “.pem” certificates for “CertificateFileName” attribute however regarding the key for the SSL certificate, SSL has its public key already embedded into the certificate and the private key is in the web server of the page you would like to access, and the private key is used to decrypt the certificate to validate it.
So, you could use HTTPS built in classes in MATLAB to connect to a web service by creating and configuring the “weboptions” object.
You could go through the link below to get better insights about how to use HTTPS and “weboptions”.
Hope this helps!

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!