Documentation ¶
Index ¶
- func PrintCert(cert *x509.Certificate) error
- type Tools
- func (t Tools) FetchOCSPResp(h helpers.HelpersInterface, ocspURL string, dir string, ...) (*ocsp.Response, error)
- func (t Tools) GetCertChainAndStapledResp(serverURL string) ([]*x509.Certificate, []byte, error)
- func (t Tools) GetIssuerCertFromLeafCert(h helpers.HelpersInterface, leafCert *x509.Certificate) (*x509.Certificate, error)
- func (t Tools) ParseCertificateFile(certFile string) (*x509.Certificate, error)
- func (t Tools) ReadOCSPResp(ocspRespFile string) (*ocsp.Response, error)
- type ToolsInterface
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 ¶
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
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