ocsptools

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: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrintCert

func PrintCert(cert *x509.Certificate) error

PrintCert prints the given certificate using the external library github.com/grantae/certinfo

Types

type Tools

type Tools struct{}

Tools is an exportable struct of type ToolsInterface

func (Tools) FetchOCSPResp

func (t Tools) FetchOCSPResp(h helpers.HelpersInterface, ocspURL string, dir string, leafCert *x509.Certificate, issuerCert *x509.Certificate, reqMethod string, hash crypto.Hash) (*ocsp.Response, error)

FetchOCSPResp uses the functions above to create and send an OCSP Request and then parse the returned OCSP response If dir is specified, it will also write the OCSP Response to dir

func (Tools) GetCertChainAndStapledResp

func (t Tools) GetCertChainAndStapledResp(serverURL string) ([]*x509.Certificate, []byte, error)

GetCertChainAndStapledResp takes in a serverURL, attempts to build a tls connection to it and returns the resulting certificate chain and stapled OCSP Response

func (Tools) GetIssuerCertFromLeafCert

func (t Tools) GetIssuerCertFromLeafCert(h helpers.HelpersInterface, leafCert *x509.Certificate) (*x509.Certificate, error)

GetIssuerCertFromLeafCert takes in a leaf certificate, reads its issuing certificate url field and then calls GetCertFromIssuerURL to return the issuer certificate

func (Tools) ParseCertificateFile

func (t Tools) ParseCertificateFile(certFile string) (*x509.Certificate, error)

ParseCertificateFile takes a path to a certificate and returns a parsed certificate

func (Tools) ReadOCSPResp

func (t Tools) ReadOCSPResp(ocspRespFile string) (*ocsp.Response, error)

ReadOCSPResp takes a path to an OCSP response file and reads and parses it

type ToolsInterface

type ToolsInterface interface {
	ReadOCSPResp(string) (*ocsp.Response, error)
	ParseCertificateFile(string) (*x509.Certificate, error)
	GetIssuerCertFromLeafCert(helpers.HelpersInterface, *x509.Certificate) (*x509.Certificate, error)
	FetchOCSPResp(helpers.HelpersInterface, string, string, *x509.Certificate, *x509.Certificate, string, crypto.Hash) (*ocsp.Response, error)
	GetCertChainAndStapledResp(string) ([]*x509.Certificate, []byte, error)
}

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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