Comparison

util/x509.lua @ 12106:c0cb8e86ad21

util.x509: Fix to include wildcard identity
author Kim Alvefur <zash@zash.se>
date Wed, 22 Dec 2021 15:32:04 +0100
parent 10494:69e55b03d5cf
child 12604:bd9e006a7a74
comparison
equal deleted inserted replaced
12105:47c9a76cce7d 12106:c0cb8e86ad21
230 local ext = cert:extensions(); 230 local ext = cert:extensions();
231 local sans = ext[oid_subjectaltname]; 231 local sans = ext[oid_subjectaltname];
232 if sans then 232 if sans then
233 if sans["dNSName"] then -- Valid for any service 233 if sans["dNSName"] then -- Valid for any service
234 for _, name in ipairs(sans["dNSName"]) do 234 for _, name in ipairs(sans["dNSName"]) do
235 local is_wildcard = name:sub(1, 2) == "*.";
236 if is_wildcard then name = name:sub(3); end
235 name = idna_to_unicode(nameprep(name)); 237 name = idna_to_unicode(nameprep(name));
236 if name then 238 if name then
239 if is_wildcard then name = "*." .. name; end
237 names:set(name, "*", true); 240 names:set(name, "*", true);
238 end 241 end
239 end 242 end
240 end 243 end
241 if sans[oid_xmppaddr] then 244 if sans[oid_xmppaddr] then