Skip to content

Commit a4babae

Browse files
refactor: minor adjustments
1 parent b06c256 commit a4babae

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

protocol/utils.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ func parseX5C(x5c []any) (x5cs []*x509.Certificate, err error) {
6767
return x5cs, nil
6868
}
6969

70+
// attStatementCertChainVerify allows verifying an attestation statement certificate chain and optionally allows
71+
// mangling the not after value for purpose of just validating the attestation lineage. If you set mangleNotAfter to
72+
// true this function should only be considered safe for determining lineage, and not hte validity of a chain in
73+
// general.
7074
func attStatementCertChainVerify(certs []*x509.Certificate, roots *x509.CertPool, mangleNotAfter bool, mangleNotAfterSafeTime time.Time) (chains [][]*x509.Certificate, err error) {
7175
if len(certs) == 0 {
7276
return nil, errors.New("empty chain")
@@ -139,6 +143,9 @@ func certsInsecureNotAfterMangle(certs []*x509.Certificate) (out []*x509.Certifi
139143
return out
140144
}
141145

146+
// This function is used to intentionally but conditionally mangle the certificate not after value to exclude it from
147+
// the verification process. This should only be used in instances where all you care about is which certificates
148+
// performed the signing.
142149
func certInsecureConditionalNotAfterMangle(cert *x509.Certificate, mangle bool, safe time.Time) (out *x509.Certificate) {
143150
if !mangle || cert.NotAfter.After(safe) {
144151
return cert

0 commit comments

Comments
 (0)