diff --git a/ca/ca.go b/ca/ca.go index e9e39c0a..c16d7f4a 100644 --- a/ca/ca.go +++ b/ca/ca.go @@ -380,6 +380,17 @@ var ocspMustStapleExt = pkix.Extension{ Value: []byte{0x30, 0x03, 0x02, 0x01, 0x05}, } +// Returns whether the given extensions array contains an OCSP Must-Staple +// extension. +func extensionsContainsOCSPMustStaple(extensions []pkix.Extension) bool { + for _, ext := range extensions { + if ext.Id.Equal(ocspMustStapleExt.Id) && bytes.Equal(ext.Value, ocspMustStapleExt.Value) { + return true + } + } + return false +} + func (ca *CAImpl) CompleteOrder(order *core.Order) { // Lock the order for reading order.RLock() @@ -427,15 +438,6 @@ func (ca *CAImpl) CompleteOrder(order *core.Order) { order.Unlock() } -func extensionsContainsOCSPMustStaple(extensions []pkix.Extension) bool { - for _, ext := range extensions { - if ext.Id.Equal(ocspMustStapleExt.Id) && bytes.Equal(ext.Value, ocspMustStapleExt.Value) { - return true - } - } - return false -} - func (ca *CAImpl) GetNumberOfRootCerts() int { return len(ca.chains) } diff --git a/ca/ca_test.go b/ca/ca_test.go index 61046ed9..a5efe91b 100644 --- a/ca/ca_test.go +++ b/ca/ca_test.go @@ -109,7 +109,7 @@ func TestSettingOCSPMustStapleExtension(t *testing.T) { t.Error("Expected foundOCSPExtension.Critical to be false, but it was true") } - // Test w/ several extensions + // Test w/ duplicate extensions ca = makeCa() order = makeCertOrderWithExtensions([]pkix.Extension{ {