Skip to content

Commit c090626

Browse files
authored
Enable OpenSSL certificates (#36)
1 parent 8eec5cb commit c090626

File tree

2 files changed

+2
-12
lines changed

2 files changed

+2
-12
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "NetworkOptions"
22
uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908"
33
authors = ["Stefan Karpinski <stefan@karpinski.org> and contributors"]
4-
version = "1.2.0"
4+
version = "1.3.0"
55

66
[compat]
77
julia = "1"

src/ca_roots.jl

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -78,31 +78,21 @@ const SYSTEM_CA_ROOTS = Ref{Union{Nothing, String}}(nothing)
7878

7979
const BEGIN_CERT_REGULAR = "-----BEGIN CERTIFICATE-----"
8080
const BEGIN_CERT_OPENSSL = "-----BEGIN TRUSTED CERTIFICATE-----"
81-
const OPENSSL_WARNING = """
82-
NetworkOptions could only find OpenSSL-specific TLS certificates which cannot be used by MbedTLS. Please open an issue at https://github.com/JuliaLang/NetworkOptions.jl/issues with details about your system, especially where generic non-OpenSSL certificates can be found. See https://stackoverflow.com/questions/55447752/what-does-begin-trusted-certificate-in-a-certificate-mean for more details.
83-
""" |> split |> text -> join(text, " ")
8481

8582
function system_ca_roots()
8683
lock(SYSTEM_CA_ROOTS_LOCK) do
8784
SYSTEM_CA_ROOTS[] !== nothing && return # from lock()
8885
search_path = Sys.islinux() ? LINUX_CA_ROOTS :
8986
Sys.isbsd() && !Sys.isapple() ? BSD_CA_ROOTS : String[]
90-
openssl_only = false
9187
for path in search_path
9288
ispath(path) || continue
9389
for line in eachline(path)
94-
if line == BEGIN_CERT_REGULAR
90+
if line in [BEGIN_CERT_REGULAR, BEGIN_CERT_OPENSSL]
9591
SYSTEM_CA_ROOTS[] = path
9692
return # from lock()
97-
elseif line == BEGIN_CERT_OPENSSL
98-
openssl_only = true
9993
end
10094
end
10195
end
102-
# warn if we:
103-
# 1. did not find any regular certs
104-
# 2. did find OpenSSL-only certs
105-
openssl_only && @warn OPENSSL_WARNING
10696
# TODO: extract system certs on Windows & macOS
10797
SYSTEM_CA_ROOTS[] = bundled_ca_roots()
10898
end

0 commit comments

Comments
 (0)