@@ -4,6 +4,7 @@ using OpenSSL
44using OpenSSL_jll
55using Sockets
66using Test
7+ using TimeZones
78
89include (joinpath (dirname (pathof (OpenSSL)), " ../test/http_helpers.jl" ))
910
@@ -108,10 +109,20 @@ end
108109 cert = certs_pem[2 ]
109110
110111 x509_cert = X509Certificate (cert)
111- @test String (x509_cert. subject_name) == " /C=BE/O=GlobalSign nv-sa/OU=Root CA/CN=GlobalSign Root CA"
112- @test String (x509_cert. issuer_name) == " /C=BE/O=GlobalSign nv-sa/OU=Root CA/CN=GlobalSign Root CA"
113- @test String (x509_cert. time_not_before) == " Sep 1 12:00:00 1998 GMT"
114- @test String (x509_cert. time_not_after) == " Jan 28 12:00:00 2028 GMT"
112+
113+ @test occursin (" /C=" , String (x509_cert. subject_name))
114+ @test occursin (" /OU=" , String (x509_cert. subject_name))
115+ @test occursin (" /CN=" , String (x509_cert. subject_name))
116+
117+ @test occursin (" /C=" , String (x509_cert. issuer_name))
118+ @test occursin (" /OU=" , String (x509_cert. issuer_name))
119+ @test occursin (" /CN=" , String (x509_cert. issuer_name))
120+
121+ s_before_time = replace (String (x509_cert. time_not_before), r" +" => " " )
122+ @test DateTime (s_before_time, dateformat " u d HH:MM:SS yyyy Z" ) < today ()
123+
124+ s_after_time = replace (String (x509_cert. time_not_after), r" +" => " " )
125+ @test DateTime (s_after_time, dateformat " u d HH:MM:SS yyyy Z" ) > today ()
115126
116127 # finalizer will cleanup
117128 # finalize(x509_cert)
187198
188199 x509_server_cert = OpenSSL. get_peer_certificate (ssl)
189200
190- @test String (x509_server_cert . issuer_name) == " /C=US/O=Let's Encrypt/CN=R11 "
201+ @test occursin ( " /C=US/O=Let's Encrypt" , String (x509_server_cert . issuer_name))
191202 @test String (x509_server_cert. subject_name) == " /CN=httpbingo.julialang.org"
192203
193204 request_str = " GET /status/200 HTTP/1.1\r\n Host: httpbingo.julialang.org\r\n User-Agent: curl\r\n Accept: */*\r\n\r\n "
0 commit comments