Debian Codegraph @

v3/lints/rfc/lint_ext_ian_critical.go

raw symbols SCIP
1 package rfc
2
3 /*
4 * ZLint Copyright 2024 Regents of the University of Michigan
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
7 * use this file except in compliance with the License. You may obtain a copy
8 * of the License at http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13 * implied. See the License for the specific language governing
14 * permissions and limitations under the License.
15 */
16
17 import (
18 "github.com/zmap/zcrypto/x509"
19 "github.com/zmap/zlint/v3/lint"
20 "github.com/zmap/zlint/v3/util"
21 )
22
23 type ExtIANCritical struct{}
24
25 /************************************************
26 Issuer Alternative Name
27 As with Section 4.2.1.6, this extension is used to associate Internet style identities with the certificate issuer. Issuer alternative name MUST be encoded as in 4.2.1.6. Issuer alternative names are not processed as part of the certification path validation algorithm in Section 6. (That is, issuer alternative names are not used in name chaining and name constraints are not enforced.)
28 Where present, conforming CAs SHOULD mark this extension as non-critical.
29 ************************************************/
30
31 func init() {
32 lint.RegisterCertificateLint(&lint.CertificateLint{
33 LintMetadata: lint.LintMetadata{
34 Name: "w_ext_ian_critical",
35 Description: "Issuer alternate name should be marked as non-critical",
36 Citation: "RFC 5280: 4.2.1.7",
37 Source: lint.RFC5280,
38 EffectiveDate: util.RFC2459Date,
39 },
40 Lint: NewExtIANCritical,
41 })
42 }
43
44 func NewExtIANCritical() lint.LintInterface {
45 return &ExtIANCritical{}
46 }
47
48 func (l *ExtIANCritical) CheckApplies(cert *x509.Certificate) bool {
49 return util.IsExtInCert(cert, util.IssuerAlternateNameOID)
50 }
51
52 func (l *ExtIANCritical) Execute(cert *x509.Certificate) *lint.LintResult {
53 if util.GetExtFromCert(cert, util.IssuerAlternateNameOID).Critical {
54 return &lint.LintResult{Status: lint.Warn}
55 } else {
56 return &lint.LintResult{Status: lint.Pass}
57 }
58 }