@@ -673,7 +673,6 @@ func TestCreateSelfSignedCertificate(t *testing.T) {
673
673
IPAddresses : []net.IP {net .IPv4 (127 , 0 , 0 , 1 ).To4 (), net .ParseIP ("2001:4860:0:2001::68" )},
674
674
URIs : []* url.URL {parseURI ("https://foo.com/wibble#foo" )},
675
675
676
- PolicyIdentifiers : []asn1.ObjectIdentifier {[]int {1 , 2 , 3 }},
677
676
Policies : []OID {mustNewOIDFromInts ([]uint64 {1 , 2 , 3 , math .MaxUint32 , math .MaxUint64 })},
678
677
PermittedDNSDomains : []string {".example.com" , "example.com" },
679
678
ExcludedDNSDomains : []string {"bar.example.com" },
@@ -712,8 +711,8 @@ func TestCreateSelfSignedCertificate(t *testing.T) {
712
711
continue
713
712
}
714
713
715
- if len (cert .PolicyIdentifiers ) != 1 || ! cert .PolicyIdentifiers [0 ].Equal (template .PolicyIdentifiers [0 ]) {
716
- t .Errorf ("%s: failed to parse policy identifiers: got:%#v want:%#v" , test .name , cert .PolicyIdentifiers , template .PolicyIdentifiers )
714
+ if len (cert .Policies ) != 1 || ! cert .Policies [0 ].Equal (template .Policies [0 ]) {
715
+ t .Errorf ("%s: failed to parse policy identifiers: got:%#v want:%#v" , test .name , cert .PolicyIdentifiers , template .Policies )
717
716
}
718
717
719
718
if len (cert .PermittedDNSDomains ) != 2 || cert .PermittedDNSDomains [0 ] != ".example.com" || cert .PermittedDNSDomains [1 ] != "example.com" {
@@ -3916,7 +3915,9 @@ func TestDuplicateAttributesCSR(t *testing.T) {
3916
3915
}
3917
3916
}
3918
3917
3919
- func TestCertificateOIDPolicies (t * testing.T ) {
3918
+ func TestCertificateOIDPoliciesGODEBUG (t * testing.T ) {
3919
+ t .Setenv ("GODEBUG" , "x509usepolicies=0" )
3920
+
3920
3921
template := Certificate {
3921
3922
SerialNumber : big .NewInt (1 ),
3922
3923
Subject : pkix.Name {CommonName : "Cert" },
@@ -3952,7 +3953,11 @@ func TestCertificateOIDPolicies(t *testing.T) {
3952
3953
}
3953
3954
}
3954
3955
3955
- func TestCertificatePoliciesGODEBUG (t * testing.T ) {
3956
+ func TestCertificatePolicies (t * testing.T ) {
3957
+ if x509usepolicies .Value () == "0" {
3958
+ t .Skip ("test relies on default x509usepolicies GODEBUG" )
3959
+ }
3960
+
3956
3961
template := Certificate {
3957
3962
SerialNumber : big .NewInt (1 ),
3958
3963
Subject : pkix.Name {CommonName : "Cert" },
@@ -3962,7 +3967,7 @@ func TestCertificatePoliciesGODEBUG(t *testing.T) {
3962
3967
Policies : []OID {mustNewOIDFromInts ([]uint64 {1 , 2 , math .MaxUint32 + 1 })},
3963
3968
}
3964
3969
3965
- expectPolicies := []OID {mustNewOIDFromInts ([]uint64 {1 , 2 , 3 })}
3970
+ expectPolicies := []OID {mustNewOIDFromInts ([]uint64 {1 , 2 , math . MaxUint32 + 1 })}
3966
3971
certDER , err := CreateCertificate (rand .Reader , & template , & template , rsaPrivateKey .Public (), rsaPrivateKey )
3967
3972
if err != nil {
3968
3973
t .Fatalf ("CreateCertificate() unexpected error: %v" , err )
0 commit comments