lints/lint_ct_sct_policy_count_unsatisfied.go
func appleCTPolicyExpectedSCTs(cert *x509.Certificate) int {
	// Lifetime is relative to the certificate's NotBefore date.
	start := cert.NotBefore

	// Thresholds is an ordered array of lifetime periods and their expected # of
	// SCTs. A lifetime period is defined by the cutoff date relative to the
	// start of the certificate's lifetime.
	thresholds := []struct {
		CutoffDate time.Time
		Expected   int
	}{
		// Start date ... 15 months
		{CutoffDate: start.AddDate(0, 15, 0), Expected: 2},
		// Start date ... 27 months
		{CutoffDate: start.AddDate(0, 27, 0), Expected: 3},
		// Start date ... 39 months
		{CutoffDate: start.AddDate(0, 39, 0), Expected: 4},
	}

	// If the certificate's lifetime falls into any of the cutoff date ranges then
	// we expect that range's expected # of SCTs for this certificate. This loop
	// assumes the `thresholds` list is sorted in ascending order.
	for _, threshold := range thresholds {
		if cert.NotAfter.Before(threshold.CutoffDate) {
			return threshold.Expected
		}
	}

	// The certificate had a validity > 39 months.
	return 5
}
func appleCTPolicyExpectedSCTs(cert *x509.Certificate) int {
	// Lifetime is relative to the certificate's NotBefore date.
	start := cert.NotBefore

	// Thresholds is an ordered array of lifetime periods and their expected # of
	// SCTs. A lifetime period is defined by the cutoff date relative to the
	// start of the certificate's lifetime.
	thresholds := []struct {
		CutoffDate time.Time
		Expected   int
	}{
		// Start date ... 15 months
		{CutoffDate: start.AddDate(0, 15, 0), Expected: 2},
		// Start date ... 27 months
		{CutoffDate: start.AddDate(0, 27, 0), Expected: 3},
		// Start date ... 39 months
		{CutoffDate: start.AddDate(0, 39, 0), Expected: 4},
	}

	// If the certificate's lifetime falls into any of the cutoff date ranges then
	// we expect that range's expected # of SCTs for this certificate. This loop
	// assumes the `thresholds` list is sorted in ascending order.
	for _, threshold := range thresholds {
		if cert.NotAfter.Before(threshold.CutoffDate) {
			return threshold.Expected
		}
	}

	// The certificate had a validity > 39 months.
	return 5
}
// appleCTPolicyExpectedSCTs returns a count of the number of SCTs expected to
// be embedded in the given certificate based on its lifetime.
//
// For this function the relevant portion of Apple's policy is the table
// "Number of embedded SCTs based on certificate lifetime" (Also reproduced in
// the `Execute` godoc comment).