@ -6,6 +6,7 @@ import (
"crypto/x509/pkix"
"encoding/json"
"net"
"net/url"
"reflect"
"testing"
"time"
@ -1280,6 +1281,39 @@ func TestOrder_sans(t *testing.T) {
} ,
err : nil ,
} ,
{
name : "fail/invalid-alternative-name-email" ,
fields : fields {
Identifiers : [ ] Identifier { } ,
} ,
csr : & x509 . CertificateRequest {
Subject : pkix . Name {
CommonName : "foo.internal" ,
} ,
EmailAddresses : [ ] string { "test@example.com" } ,
} ,
want : [ ] x509util . SubjectAlternativeName { } ,
err : NewError ( ErrorBadCSRType , "Only DNS names and IP addresses are allowed" ) ,
} ,
{
name : "fail/invalid-alternative-name-uri" ,
fields : fields {
Identifiers : [ ] Identifier { } ,
} ,
csr : & x509 . CertificateRequest {
Subject : pkix . Name {
CommonName : "foo.internal" ,
} ,
URIs : [ ] * url . URL {
{
Scheme : "https://" ,
Host : "smallstep.com" ,
} ,
} ,
} ,
want : [ ] x509util . SubjectAlternativeName { } ,
err : NewError ( ErrorBadCSRType , "Only DNS names and IP addresses are allowed" ) ,
} ,
{
name : "fail/error-names-length-mismatch" ,
fields : fields {