Documentation ¶
Index ¶
- type ResponseCache
- func (r *ResponseCache) Entry() db.CertificateEntry
- func (r *ResponseCache) Response() []byte
- func (r *ResponseCache) SHA1Hash() []byte
- func (r *ResponseCache) SHA1HashHexString() string
- func (r *ResponseCache) SetCertToTemplate(cert *x509.Certificate)
- func (r *ResponseCache) SetResponse(response []byte) (*ResponseCache, error)
- func (r *ResponseCache) Template() ocsp.Response
- func (r *ResponseCache) Write(w http.ResponseWriter) (int, error)
- type ResponseCacheNotCreatedError
- type ResponseCacheStore
- type ResponseCacheStoreRO
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ResponseCache ¶
type ResponseCache struct {
// contains filtered or unexported fields
}
ResponseCache represents pre-produced OCSP response. (https://www.rfc-editor.org/rfc/rfc5019)
func CreatePreSignedResponseCache ¶
func CreatePreSignedResponseCache( entry db.CertificateEntry, thisUpdate time.Time, interval time.Duration, ) (ResponseCache, error)
CreatePreSignedResponseCache verifies the CertificateEntry and creates a new instance of ResponseCache. The new instance of ResponseCache contains an ocsp.Response, which is a signed response template.
func (*ResponseCache) Entry ¶ added in v0.1.2
func (r *ResponseCache) Entry() db.CertificateEntry
Entry returns a CertificateEntry object.
func (*ResponseCache) Response ¶ added in v0.1.2
func (r *ResponseCache) Response() []byte
Response returns a copy of the signed response cache.
func (*ResponseCache) SHA1Hash ¶ added in v0.1.2
func (r *ResponseCache) SHA1Hash() []byte
SHA1Hash returns the copy of the SHA1 hash of the OCSP response.
func (*ResponseCache) SHA1HashHexString ¶
func (r *ResponseCache) SHA1HashHexString() string
SHA1HashHexString is a helper method for http.Handler that allows direct formatting of the response bytes to a string without copying them.
func (*ResponseCache) SetCertToTemplate ¶
func (r *ResponseCache) SetCertToTemplate(cert *x509.Certificate)
SetCertToTemplate sets the provided x509.Certificate as the value of the ocsp.Response template member.
func (*ResponseCache) SetResponse ¶
func (r *ResponseCache) SetResponse(response []byte) (*ResponseCache, error)
SetResponse calculates and sets the SHA-1 hash of the provided signed OCSP.
func (*ResponseCache) Template ¶ added in v0.1.2
func (r *ResponseCache) Template() ocsp.Response
Template returns the ocsp.Response as template of signed response.
func (*ResponseCache) Write ¶
func (r *ResponseCache) Write(w http.ResponseWriter) (int, error)
Write is a helper method for http.Handler that allows direct writing of response bytes without copying them.
type ResponseCacheNotCreatedError ¶
type ResponseCacheNotCreatedError struct {
// contains filtered or unexported fields
}
ResponseCacheNotCreatedError is used when the creation of a pre-signed response cache from a CertificateEntry fails with errors.
func (ResponseCacheNotCreatedError) Error ¶
func (e ResponseCacheNotCreatedError) Error() string
type ResponseCacheStore ¶
ResponseCacheStore uses a built-in map in Go to store ResponseCache instances. The store is primarily used by the OCSP responder application, which makes use of methods such as get, update, and truncate. However, it does not have explicit add or delete methods to modify individual items in the cache. Instead, it focuses on updating the entire cache as a whole, and includes functionality to update the cache's update time.
func NewResponseCacheStore ¶
func NewResponseCacheStore() *ResponseCacheStore
NewResponseCacheStore creates and retruns new instance of ResponseCacheStore.
func (*ResponseCacheStore) Get ¶
func (r *ResponseCacheStore) Get(serialNumber *big.Int) (*ResponseCache, bool)
Get retrieves and returns the ocsp.ResponseCache with the provided serial number. If no cache is found matching the key, it returns an empty ocsp.ResponseCache and false.
func (*ResponseCacheStore) NewReadOnlyCacheStore ¶
func (r *ResponseCacheStore) NewReadOnlyCacheStore() *ResponseCacheStoreRO
NewReadOnlyCacheStore creates and returns new ResponseCacheStoreRO instance. ResponseCacheStoreRO is a wrapper around the ResponseCacheStore object, providing only read APIs.
func (*ResponseCacheStore) Truncate ¶
func (r *ResponseCacheStore) Truncate() error
Truncate resets/deletes all caches.
func (*ResponseCacheStore) Update ¶
func (r *ResponseCacheStore) Update(caches []ResponseCache) []ResponseCache
Update the response cache's override hashmap with the provided caches. Additionally, update the update date after the update is performed. This method returns nil when there are no duplicated serial numbers in the ocsp response and returns the duplicated serial numbers when they exist.
type ResponseCacheStoreRO ¶
type ResponseCacheStoreRO struct {
// contains filtered or unexported fields
}
ResponseCacheStoreRO is read-only ResponseCacheStore. It should have only read method of the ResponseCacheStore.
func (*ResponseCacheStoreRO) Get ¶
func (r *ResponseCacheStoreRO) Get(serialNumber *big.Int) (*ResponseCache, bool)
Get is a simple wrapper the Get method of the ResponseCacheStore.