Documentation ¶
Index ¶
- Constants
- func LoadCertificate(certificate string) ([]byte, error)
- func LoadPrivateKey(privateKey string) ([]byte, error)
- type Certificate
- func (c *Certificate) AsTLSConfig() *tls.Config
- func (c *Certificate) AsTLSSecret() map[string][]byte
- func (c Certificate) EncodedCertificate() []byte
- func (c Certificate) EncodedPrivateKey() []byte
- func (c Certificate) EncodedPublicKey() []byte
- func (c Certificate) GetHash() (string, error)
- func (c Certificate) GetPublicChain() []*Certificate
- func (c *Certificate) IsLazyLoaded() bool
- func (c *Certificate) Load() (*Certificate, error)
- func (c Certificate) MarshalYAML() (interface{}, error)
- func (ca *Certificate) Sign(cert *x509.Certificate, expiry time.Duration) (*x509.Certificate, error)
- func (ca *Certificate) SignCertificate(cert *Certificate, expiryYears int) (*Certificate, error)
- func (c *Certificate) UnmarshalYAML(unmarshal func(interface{}) error) error
- type CertificateAuthority
- type CertificateBuilder
- func (b *CertificateBuilder) AltName(names ...string) *CertificateBuilder
- func (b *CertificateBuilder) CA() *CertificateBuilder
- func (b *CertificateBuilder) Client() *CertificateBuilder
- func (b *CertificateBuilder) Organization(org string) *CertificateBuilder
- func (b *CertificateBuilder) OrganizationUnit(ou string) *CertificateBuilder
- func (b *CertificateBuilder) Server() *CertificateBuilder
- func (b *CertificateBuilder) ValidYears(years int) *CertificateBuilder
- type CertificateMarshaller
Constants ¶
View Source
const ( // CertificateHeader is the first line of a certificate file CertificateHeader = "-----BEGIN CERTIFICATE-----" // PrivateKeyHeader is the first line of a private key file PrivateKeyHeader = "-----BEGIN RSA PRIVATE KEY-----" )
Variables ¶
This section is empty.
Functions ¶
func LoadCertificate ¶ added in v1.1.2
func LoadPrivateKey ¶ added in v1.1.2
Types ¶
type Certificate ¶
type Certificate struct { X509 *x509.Certificate PrivateKey *rsa.PrivateKey Chain []*Certificate // contains filtered or unexported fields }
Certificate is a X509 certifcate / private key pair
func DecodeCertificate ¶
func DecodeCertificate(cert []byte, privateKey []byte) (*Certificate, error)
DecodeCertificate decodes a certificate / private key pair and returns a Certificate
func DecryptCertificate ¶
func DecryptCertificate(cert []byte, privateKey []byte, password []byte) (*Certificate, error)
DecryptCertificate decrypts a certificate / private key pair and returns a Certificate
func (*Certificate) AsTLSConfig ¶ added in v1.3.6
func (c *Certificate) AsTLSConfig() *tls.Config
func (*Certificate) AsTLSSecret ¶
func (c *Certificate) AsTLSSecret() map[string][]byte
func (Certificate) EncodedCertificate ¶
func (c Certificate) EncodedCertificate() []byte
EncodedCertificate returns PEM-endcoded certificate data.
func (Certificate) EncodedPrivateKey ¶
func (c Certificate) EncodedPrivateKey() []byte
EncodedPrivateKey returns PEM-encoded private key data.
func (Certificate) EncodedPublicKey ¶
func (c Certificate) EncodedPublicKey() []byte
EncodedPublicKey returns PEM-encoded public key data.
func (Certificate) GetHash ¶
func (c Certificate) GetHash() (string, error)
GetHash returns the encoded sha256 hash for the certificate
func (Certificate) GetPublicChain ¶
func (c Certificate) GetPublicChain() []*Certificate
func (*Certificate) IsLazyLoaded ¶ added in v1.3.6
func (c *Certificate) IsLazyLoaded() bool
func (*Certificate) Load ¶ added in v1.3.6
func (c *Certificate) Load() (*Certificate, error)
func (Certificate) MarshalYAML ¶ added in v1.1.4
func (c Certificate) MarshalYAML() (interface{}, error)
func (*Certificate) Sign ¶
func (ca *Certificate) Sign(cert *x509.Certificate, expiry time.Duration) (*x509.Certificate, error)
func (*Certificate) SignCertificate ¶
func (ca *Certificate) SignCertificate(cert *Certificate, expiryYears int) (*Certificate, error)
func (*Certificate) UnmarshalYAML ¶ added in v1.1.2
func (c *Certificate) UnmarshalYAML(unmarshal func(interface{}) error) error
type CertificateAuthority ¶
type CertificateAuthority interface { SignCertificate(cert *Certificate, expiryYears int) (*Certificate, error) Sign(cert *x509.Certificate, expiry time.Duration) (*x509.Certificate, error) GetPublicChain() []*Certificate }
type CertificateBuilder ¶
type CertificateBuilder struct {
*Certificate
}
func NewCertificateBuilder ¶
func NewCertificateBuilder(commonName string) *CertificateBuilder
func (*CertificateBuilder) AltName ¶
func (b *CertificateBuilder) AltName(names ...string) *CertificateBuilder
func (*CertificateBuilder) CA ¶
func (b *CertificateBuilder) CA() *CertificateBuilder
func (*CertificateBuilder) Client ¶
func (b *CertificateBuilder) Client() *CertificateBuilder
func (*CertificateBuilder) Organization ¶
func (b *CertificateBuilder) Organization(org string) *CertificateBuilder
func (*CertificateBuilder) OrganizationUnit ¶
func (b *CertificateBuilder) OrganizationUnit(ou string) *CertificateBuilder
func (*CertificateBuilder) Server ¶
func (b *CertificateBuilder) Server() *CertificateBuilder
func (*CertificateBuilder) ValidYears ¶
func (b *CertificateBuilder) ValidYears(years int) *CertificateBuilder
type CertificateMarshaller ¶ added in v1.1.2
Click to show internal directories.
Click to hide internal directories.