@@ -32,13 +32,10 @@ import (
3232
3333func defaultProfileConfig () ProfileConfig {
3434 return ProfileConfig {
35- AllowCommonName : true ,
36- AllowCTPoison : true ,
37- AllowSCTList : true ,
38- AllowMustStaple : true ,
39- Policies : []PolicyConfig {
40- {OID : "1.2.3" },
41- },
35+ AllowCommonName : true ,
36+ AllowCTPoison : true ,
37+ AllowSCTList : true ,
38+ AllowMustStaple : true ,
4239 MaxValidityPeriod : config.Duration {Duration : time .Hour },
4340 MaxValidityBackdate : config.Duration {Duration : time .Hour },
4441 }
@@ -82,16 +79,6 @@ func TestMain(m *testing.M) {
8279 os .Exit (m .Run ())
8380}
8481
85- func TestNewProfilePolicies (t * testing.T ) {
86- config := defaultProfileConfig ()
87- config .Policies = append (config .Policies , PolicyConfig {
88- OID : "1.2.3.4" ,
89- })
90- profile , err := NewProfile (config , defaultIssuerConfig ())
91- test .AssertNotError (t , err , "NewProfile failed" )
92- test .AssertDeepEquals (t , profile .policies , []asn1.ObjectIdentifier {{1 , 2 , 3 }, {1 , 2 , 3 , 4 }})
93- }
94-
9582func TestNewProfileNoIssuerURL (t * testing.T ) {
9683 _ , err := NewProfile (ProfileConfig {}, IssuerConfig {})
9784 test .AssertError (t , err , "NewProfile didn't fail with no issuer URL" )
@@ -104,16 +91,6 @@ func TestNewProfileNoOCSPURL(t *testing.T) {
10491 test .AssertEquals (t , err .Error (), "OCSP URL is required" )
10592}
10693
107- func TestNewProfileInvalidOID (t * testing.T ) {
108- _ , err := NewProfile (ProfileConfig {
109- Policies : []PolicyConfig {{
110- OID : "a.b.c" ,
111- }},
112- }, defaultIssuerConfig ())
113- test .AssertError (t , err , "NewProfile didn't fail with malformed policy OID" )
114- test .AssertEquals (t , err .Error (), "failed parsing policy OID \" a.b.c\" : strconv.Atoi: parsing \" a\" : invalid syntax" )
115- }
116-
11794func TestRequestValid (t * testing.T ) {
11895 fc := clock .NewFake ()
11996 fc .Add (time .Hour * 24 )
@@ -343,21 +320,7 @@ func TestGenerateTemplate(t *testing.T) {
343320 IssuingCertificateURL : []string {"" },
344321 OCSPServer : []string {"" },
345322 CRLDistributionPoints : []string {"crl-url" },
346- },
347- },
348- {
349- name : "include policies" ,
350- profile : & Profile {
351- sigAlg : x509 .SHA256WithRSA ,
352- policies : []asn1.ObjectIdentifier {{4 , 5 , 6 }},
353- },
354- expectedTemplate : & x509.Certificate {
355- BasicConstraintsValid : true ,
356- SignatureAlgorithm : x509 .SHA256WithRSA ,
357- ExtKeyUsage : defaultEKU ,
358- IssuingCertificateURL : []string {"" },
359- OCSPServer : []string {"" },
360- PolicyIdentifiers : []asn1.ObjectIdentifier {{4 , 5 , 6 }},
323+ PolicyIdentifiers : []asn1.ObjectIdentifier {{2 , 23 , 140 , 1 , 2 , 1 }},
361324 },
362325 },
363326 }
@@ -943,7 +906,7 @@ func TestMismatchedProfiles(t *testing.T) {
943906 linter , err := linter .New (
944907 issuerCert .Certificate ,
945908 issuerSigner ,
946- []string {},
909+ []string {"n_subject_common_name_included" },
947910 )
948911 test .AssertNotError (t , err , "failed to create linter" )
949912
@@ -954,6 +917,7 @@ func TestMismatchedProfiles(t *testing.T) {
954917 _ , issuanceToken , err := issuer1 .Prepare (& IssuanceRequest {
955918 PublicKey : pk .Public (),
956919 Serial : []byte {1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 },
920+ CommonName : "example.com" ,
957921 DNSNames : []string {"example.com" },
958922 NotBefore : fc .Now (),
959923 NotAfter : fc .Now ().Add (time .Hour - time .Second ),
@@ -964,9 +928,9 @@ func TestMismatchedProfiles(t *testing.T) {
964928 precertDER , err := issuer1 .Issue (issuanceToken )
965929 test .AssertNotError (t , err , "signing precert" )
966930
967- // Create a new profile that differs slightly (one more PolicyInformation than the precert )
931+ // Create a new profile that differs slightly (no common name )
968932 profileConfig := defaultProfileConfig ()
969- profileConfig .Policies = append ( profileConfig . Policies , PolicyConfig { OID : "1.2.3.4" })
933+ profileConfig .AllowCommonName = false
970934 p , err := NewProfile (profileConfig , defaultIssuerConfig ())
971935 test .AssertNotError (t , err , "NewProfile failed" )
972936 issuer2 , err := NewIssuer (issuerCert , issuerSigner , p , linter , fc )
@@ -988,6 +952,7 @@ func TestMismatchedProfiles(t *testing.T) {
988952
989953 request2 , err := RequestFromPrecert (precert , sctList )
990954 test .AssertNotError (t , err , "RequestFromPrecert" )
955+ request2 .CommonName = ""
991956
992957 _ , _ , err = issuer2 .Prepare (request2 )
993958 test .AssertError (t , err , "preparing final cert issuance" )
0 commit comments