github.com/zmap/zlint@v1.1.0/lints/lint_tbs_signature_rsa_encryption_parameter_not_null_test.go (about) 1 package lints 2 3 import ( 4 "fmt" 5 "testing" 6 ) 7 8 func TestSigRSAAlgIDNullParams(t *testing.T) { 9 10 testCases := []struct { 11 name string 12 filepath string 13 expectedStatus LintStatus 14 details string 15 }{ 16 { 17 name: "pass cert with NULL params", 18 filepath: "rsawithsha1after2016.pem", 19 expectedStatus: Pass, 20 }, 21 { 22 name: "error cert with missing NULL params", 23 filepath: "rsaSigAlgoNoNULLParam.pem", 24 expectedStatus: Error, 25 details: "certificate tbsCertificate.signature RSA algorithm identifier missing required NULL parameter", 26 }, 27 } 28 29 for _, tc := range testCases { 30 t.Run(tc.name, func(t *testing.T) { 31 inputPath := fmt.Sprintf("%s%s", testCaseDir, tc.filepath) 32 result := Lints["e_tbs_signature_rsa_encryption_parameter_not_null"].Execute(ReadCertificate(inputPath)) 33 if result.Status != tc.expectedStatus { 34 t.Errorf("expected result %v was %v", tc.expectedStatus, result.Status) 35 } 36 37 if result.Details != tc.details { 38 t.Errorf("expected error details %q was %q", tc.details, result.Details) 39 } 40 }) 41 } 42 }