@@ -243,6 +243,7 @@ func TestSubjectAlternativeName_Set(t *testing.T) {
243243 {"AutoIPAdd" , fields {"" , "::1" }, args {& x509.Certificate {IPAddresses : []net.IP {net .ParseIP ("127.0.0.1" )}}}, & x509.Certificate {IPAddresses : []net.IP {net .ParseIP ("127.0.0.1" ), net .ParseIP ("::1" )}}},
244244 {"AutoURI" , fields {"Auto" , "https://foo.com" }, args {& x509.Certificate {}}, & x509.Certificate {URIs : []* url.URL {{Scheme : "https" , Host : "foo.com" }}}},
245245 {"AutoURIAdd" , fields {"" , "uri:foo:bar" }, args {& x509.Certificate {URIs : []* url.URL {{Scheme : "https" , Host : "foo.com" }}}}, & x509.Certificate {URIs : []* url.URL {{Scheme : "https" , Host : "foo.com" }, {Scheme : "uri" , Opaque : "foo:bar" }}}},
246+ {"skipEmpty" , fields {"auto" , "" }, args {& x509.Certificate {}}, & x509.Certificate {}},
246247 {"panic" , fields {"panic" , "foo.com" }, args {& x509.Certificate {}}, & x509.Certificate {DNSNames : []string {"foo.com" }}},
247248 {"panicAdd" , fields {"panic" , "bar.com" }, args {& x509.Certificate {DNSNames : []string {"foo.com" }}}, & x509.Certificate {DNSNames : []string {"foo.com" }}},
248249 }
@@ -1249,7 +1250,7 @@ func Test_createSubjectAltNameExtension(t *testing.T) {
12491250 wantErr bool
12501251 }{
12511252 {"ok dns" , args {Certificate {
1252- DNSNames : []string {"foo.com" },
1253+ DNSNames : []string {"foo.com" , "" },
12531254 }, false }, Extension {
12541255 ID : oidExtensionSubjectAltName ,
12551256 Critical : false ,
@@ -1263,21 +1264,21 @@ func Test_createSubjectAltNameExtension(t *testing.T) {
12631264 Value : append ([]byte {0x30 , 9 , 0x80 | nameTypeDNS , 7 }, []byte ("foo.com" )... ),
12641265 }, false },
12651266 {"ok email" , args {Certificate {
1266- EmailAddresses : []
string {
"[email protected] " },
1267+ EmailAddresses : []
string {
"[email protected] " , "" },
12671268 }, false }, Extension {
12681269 ID : oidExtensionSubjectAltName ,
12691270 Critical : false ,
12701271 Value :
append ([]
byte {
0x30 ,
13 ,
0x80 | nameTypeEmail ,
11 }, []
byte (
"[email protected] " )
... ),
12711272 }, false },
12721273 {"ok uri" , args {Certificate {
1273- URIs : []* url.URL {{Scheme : "urn" , Opaque : "foo:bar" }},
1274+ URIs : []* url.URL {{Scheme : "urn" , Opaque : "foo:bar" }, {} },
12741275 }, false }, Extension {
12751276 ID : oidExtensionSubjectAltName ,
12761277 Critical : false ,
12771278 Value : append ([]byte {0x30 , 13 , 0x80 | nameTypeURI , 11 }, []byte ("urn:foo:bar" )... ),
12781279 }, false },
12791280 {"ok ip" , args {Certificate {
1280- IPAddresses : []net.IP {net .ParseIP ("1.2.3.4" )},
1281+ IPAddresses : []net.IP {net .ParseIP ("1.2.3.4" ), {} },
12811282 }, false }, Extension {
12821283 ID : oidExtensionSubjectAltName ,
12831284 Critical : false ,
@@ -1289,6 +1290,7 @@ func Test_createSubjectAltNameExtension(t *testing.T) {
12891290 {
Type :
"email" ,
Value :
"[email protected] " },
12901291 {Type : "uri" , Value : "urn:foo:bar" },
12911292 {Type : "ip" , Value : "1.2.3.4" },
1293+ {Type : "auto" , Value : "" },
12921294 },
12931295 }, false }, Extension {
12941296 ID : oidExtensionSubjectAltName ,
@@ -1322,7 +1324,7 @@ func Test_createSubjectAltNameExtension(t *testing.T) {
13221324 }, nil ),
13231325 }, false },
13241326 {"fail dns" , args {Certificate {
1325- DNSNames : []string {"" },
1327+ DNSNames : []string {"xn--bücher.example.com " },
13261328 }, false }, Extension {}, true },
13271329 {"fail email" , args {Certificate {
13281330 EmailAddresses : []
string {
"nö[email protected] " },
0 commit comments