Documentation ¶
Index ¶
- Constants
- func CreateClientCertificate(domain string, org []string, size int, cb, kb []byte) (cert bytes.Buffer, key bytes.Buffer, err error)
- func CreateRootCA(domain string, org []string, size int) (cert bytes.Buffer, key bytes.Buffer, err error)
- func CreateSelfSigned(domain string, org []string, size int) (cert bytes.Buffer, key bytes.Buffer, err error)
- func CreateServerCertificate(domain string, org []string, size int, cb, kb []byte) (cert bytes.Buffer, key bytes.Buffer, err error)
- func ParseCertificate(cb, kb []byte) (*x509.Certificate, *rsa.PrivateKey, error)
- func VerifyClientCert(ca []byte, ckp *KeyPair) (*tls.Certificate, error)
- type CertParseError
- type CertVerifyError
- type CreateCAPoolError
- type KeyPair
- func (kp *KeyPair) Certificate() (*tls.Certificate, error)
- func (kp *KeyPair) CreateClientCertificate(domain string, org []string, size int, ca *KeyPair) error
- func (kp *KeyPair) CreateRootCA(domain string, org []string, size int) error
- func (kp *KeyPair) CreateSelfSigned(domain string, org []string, size int) error
- func (kp *KeyPair) CreateServerCertificate(domain string, org []string, size int, ca *KeyPair) error
- func (kp *KeyPair) LoadCertificate() error
- func (kp *KeyPair) SaveCertificate() error
Constants ¶
View Source
const ( ClientCert = "cert.pem" ClientKey = "key.pem" ServerCert = "server-cert.pem" ServerKey = "server-key.pem" CACert = "ca.pem" CAKey = "ca-key.pem" )
Default certificate file names
Variables ¶
This section is empty.
Functions ¶
func CreateClientCertificate ¶
func CreateRootCA ¶
func CreateSelfSigned ¶
func CreateServerCertificate ¶
func ParseCertificate ¶
func ParseCertificate(cb, kb []byte) (*x509.Certificate, *rsa.PrivateKey, error)
func VerifyClientCert ¶
func VerifyClientCert(ca []byte, ckp *KeyPair) (*tls.Certificate, error)
VerifyClientCert verifies the loaded client cert keypair against the input CA and returns the certificate on success.
Types ¶
type CertParseError ¶
type CertParseError struct {
// contains filtered or unexported fields
}
CertParseError is returned when there's an error parsing a cert.
func (CertParseError) Error ¶
func (e CertParseError) Error() string
type CertVerifyError ¶
type CertVerifyError struct{}
CertVerifyError is returned when the client cert cannot be validated against the CA.
func (CertVerifyError) Error ¶
func (e CertVerifyError) Error() string
type CreateCAPoolError ¶
type CreateCAPoolError struct{}
CreateCAPoolError is returned when there's an error creating a CA cert pool.
func (CreateCAPoolError) Error ¶
func (e CreateCAPoolError) Error() string
type KeyPair ¶
func NewKeyPair ¶
func (*KeyPair) Certificate ¶
func (kp *KeyPair) Certificate() (*tls.Certificate, error)
Certificate turns the KeyPair back into useful TLS constructs This attempts to populate the certificate.Leaf field with the x509 certificate for convenience
func (*KeyPair) CreateClientCertificate ¶
func (*KeyPair) CreateRootCA ¶
func (*KeyPair) CreateSelfSigned ¶
func (*KeyPair) CreateServerCertificate ¶
func (*KeyPair) LoadCertificate ¶
func (*KeyPair) SaveCertificate ¶
Click to show internal directories.
Click to hide internal directories.