Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrBundleNil indicates a nil bundle was supplied ErrBundleNil = errors.New("bundle is nil") // ErrBundleNoCertForHost indicates that there was no certificate for the given hostname ErrBundleNoCertForHost = errors.New("bundle has no certificate for supplied host") // ErrBundleNoCerts indicates that the supplied bundle contains no certificates ErrBundleNoCerts = errors.New("bundle has no certificates") // ErrBundleNoPrivKey indicates that the supplied bundle contains no private key ErrBundleNoPrivKey = errors.New("bundle has no private key") // ErrCertExpired indicates the supplied certificate is no longer valid ErrCertExpired = errors.New("certificate has expired") // ErrCertNotYetValid indicates that the valid data for the certificate has not been reached ErrCertNotYetValid = errors.New("certificate is not yet valid") // ErrFailedToParsePEM indicates the supplied data could not be parsed as valid PEM data ErrFailedToParsePEM = errors.New("failed to parse certificate PEM") // ErrMultiplePrivKeys indicates that more than one private key was found in the supplied PEM data ErrMultiplePrivKeys = errors.New("multiple private keys in PEM") // ErrOnlyRSA indicates a non-RSA private key was provided ErrOnlyRSA = errors.New("only RSA private keys are supported") // ErrUnsupportedPEMBlock indicates an unknown PEM block type was encountered in the supplied PEM data ErrUnsupportedPEMBlock = errors.New("unsupported PEM block") )
This are the errors that can be raised by certificate parsing and validation
Functions ¶
This section is empty.
Types ¶
type Bundle ¶
type Bundle struct { Certs []*x509.Certificate PrivKey *rsa.PrivateKey }
Bundle holds details of a key + its certificates
func Fetch ¶
Fetch connects to the remote host specification (hostname + TCP port) and retrieves the remote TLS certificate, returning it as a Bundle.
func Parse ¶
Parse parses the supplied byte array to check it is a valid x509 PEM file. If this is successful the certificate bundle (key + any certs) is returned. If not an error is returned.
func (*Bundle) Equals ¶
Equals compares two bundles and returns true if they both contain exactly the same certificates.
Click to show internal directories.
Click to hide internal directories.