Install SSL/TLS Libraries in Julia?

using HTTP

using JSON

function getIPInfo()
    url = "https://ipapi.co/json"
    response = HTTP.get(url)
    if response.status == 200
        data = JSON.parse(String(response.body))
        println("IP Information:")
        println("Country: $(data["country"])")
        println("Region: $(data["region"])")
        # Add more fields as needed
    else
        println("Failed to retrieve IP information. Status code: $(response.status)")
    end
end

# Call the function to get IP information
getIPInfo()

I’m learning to use Julia’s HTTP and JSON pkgs. The above code works fine but I have a question. The API accessed here is an https//: address and yet it works. I imagine that some sites or API’s may not allow access without an SSL key or further steps. In one tutorial, I heard a reference to SSL/TLS libraries in Julia. Is this something I’d want to install globally in Julia? I’ve installed packages in Julia - how are libraries installed?

You have mbedTLS by default in Julia, but you may want OpenSSL.

1 Like

Currently, HTTP comes with OpenSSL (or MbedTLS) dependency, which allows one to make handshakes and establish signatures. Certificates are retrieved from a MozillaCACeerts_jll artifact ensuring the endpoint you are talking to corresponds to the domain address you are connecting.

1 Like

To answer your question about installing libraries: Libraries are functional units of reusable code and are contained within Julia packages. So, they’re not really separate - you install packages based on the functions you need and the packages contain the libraries.

1 Like

I had to look up MozillaCACeerts.jll on Bard A. I. to understand your response - it’s now clear.

In case others want to know:

  1. Provides Certificates: The package includes a collection of root certificates that are widely trusted by browsers and other software. These certificates are used to establish a chain of trust between your application and the server it’s communicating with.
  • Integration with HTTP Libraries: It integrates with Julia’s HTTP libraries, such as HTTP.jl and Requests.jl, to provide them with the necessary set of certificates. This means you don’t need to manually manage certificates when making HTTPS requests.
  • Automatic Updates: The package can be configured to automatically update the certificates from Mozilla’s repository. This ensures that your applications are always using the most up-to-date and trusted certificates.

Key points:

  • It doesn’t directly enable HTTP or HTTPS access itself. It’s a supporting package for HTTP libraries.
  • It’s crucial for secure HTTPS connections, ensuring trust and encryption.
  • It’s often a dependency for other packages that perform HTTPS requests.

Benefits of using MozillaCACerts.jl:

  • Security: Helps prevent man-in-the-middle attacks and other security vulnerabilities.
  • Convenience: Automates certificate management and simplifies HTTPS communication.
  • Trust: Provides access to a widely trusted set of certificates.
  • Maintainability: Automatic updates ensure you’re always using the latest secure certificates.
1 Like