helpers

package
v0.0.0-...-60446d7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RespTimeLimit    = "10s" // Time limit for OCSP response to be served
	TimeoutInSeconds = 20    // Time limit for http response before timeout
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Helpers

type Helpers struct{}

Helpers is an exported struct of type HelpersInterface

func (Helpers) CreateOCSPReq

func (h Helpers) CreateOCSPReq(ocspURL string, leafCert *x509.Certificate, issuerCert *x509.Certificate, reqMethod string, hash crypto.Hash) (*http.Request, error)

CreateOCSPReq creates an OCSP request using either GET or POST (see IETF RFC 6960) leafCert is the root certificate (first certificate in the chain) issuerCert is the certificate of the issuer of the leafCert reqMethod is either GET or POST hash is the hash to use to encode the request (either SHA1 or SHA256 right now)

func (Helpers) GetCertFromIssuerURL

func (h Helpers) GetCertFromIssuerURL(issuerURL string) (*x509.Certificate, error)

GetCertFromIssuerURL takes an issuerURL and sends a GET request to the URL to retrieve its certificate Assumes that sending a GET request to the provided URL will return its certificate

func (Helpers) GetOCSPResp

func (h Helpers) GetOCSPResp(ocspReq *http.Request) ([]byte, error)

GetOCSPResp takes an OCSP request in the form of an HTTP request sends it and returns the response It also times the response time, and if it's over 10 seconds, then it has failed a verification

type HelpersInterface

type HelpersInterface interface {
	GetCertFromIssuerURL(string) (*x509.Certificate, error)
	CreateOCSPReq(string, *x509.Certificate, *x509.Certificate, string, crypto.Hash) (*http.Request, error)
	GetOCSPResp(*http.Request) ([]byte, error)
}

HelpersInterface is an interface for the functions that can be used from this file

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL