@@ -4035,3 +4035,28 @@ func TestRejectCriticalAIA(t *testing.T) {
4035
4035
t .Fatalf ("ParseCertificate() unexpected error: %v, want: %s" , err , expectedErr )
4036
4036
}
4037
4037
}
4038
+
4039
+ func TestRejectCriticalSKI (t * testing.T ) {
4040
+ template := Certificate {
4041
+ SerialNumber : big .NewInt (1 ),
4042
+ Subject : pkix.Name {CommonName : "Cert" },
4043
+ NotBefore : time .Unix (1000 , 0 ),
4044
+ NotAfter : time .Unix (100000 , 0 ),
4045
+ ExtraExtensions : []pkix.Extension {
4046
+ {
4047
+ Id : asn1.ObjectIdentifier {2 , 5 , 29 , 14 },
4048
+ Critical : true ,
4049
+ Value : []byte {1 , 2 , 3 },
4050
+ },
4051
+ },
4052
+ }
4053
+ certDER , err := CreateCertificate (rand .Reader , & template , & template , rsaPrivateKey .Public (), rsaPrivateKey )
4054
+ if err != nil {
4055
+ t .Fatalf ("CreateCertificate() unexpected error: %v" , err )
4056
+ }
4057
+ expectedErr := "x509: subject key identifier incorrectly marked critical"
4058
+ _ , err = ParseCertificate (certDER )
4059
+ if err == nil || err .Error () != expectedErr {
4060
+ t .Fatalf ("ParseCertificate() unexpected error: %v, want: %s" , err , expectedErr )
4061
+ }
4062
+ }
0 commit comments