Documentation ¶
Index ¶
- type Certificate
- type CertificateHosts
- type CertificateKeyRequest
- type CertificateKeyUsages
- type CertificateName
- type CertificatePackage
- type CertificatePath
- type CertificateProvider
- type CertificateProviderOption
- type CertificateRequest
- type CertificateRequests
- type DistinguishedName
- type Key
- type KeyAlgorithm
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Certificate ¶
type Certificate interface { Encoded() []byte Certificate() *x509.Certificate PrivateKey() Key CA() bool Subject() DistinguishedName Hosts() CertificateHosts Expires() time.Time Usage() CertificateKeyUsages SerialNumber() *big.Int SelfSign() (Certificate, error) Sign(Certificate) (Certificate, error) }
Certificate represents a generic certificate interface
type CertificateHosts ¶
type CertificateHosts interface { DNSNames() []string EmailAddresses() []string IPAddresses() []net.IP URIs() []*url.URL }
CertificateHosts is a generic interface for hosts
type CertificateKeyRequest ¶
type CertificateKeyRequest struct { Algorithm KeyAlgorithm `yaml:"algorithm"` // Algorithm Size int `yaml:"size"` // Size }
CertificateKeyRequest represents a certificate key
type CertificateKeyUsages ¶
type CertificateKeyUsages interface { Standard() x509.KeyUsage Extended() []x509.ExtKeyUsage }
CertificateKeyUsages is an interface for a set of certificate key usages
type CertificateName ¶
type CertificateName struct { C string `yaml:"C"` // Country ST string `yaml:"ST"` // Province L string `yaml:"L"` // Locality O string `yaml:"O"` // OrganizationName OU string `yaml:"OU,omitempty"` // OrganizationalUnitName SerialNumber string `yaml:"serialNumber,omitempty"` // SerialNumber }
CertificateName contains subject fields
type CertificatePackage ¶
type CertificatePackage struct { CertificateAuthorityRequest *CertificateRequest `yaml:"caRequest,omitempty"` // CertificateAuthorityRequest is the certificate authority request CertificateAuthority string `yaml:"ca,omitempty"` // CertificateAuthority is the pem encoded certificate authority CertificateAuthorityKey string `yaml:"caKey,omitempty"` // CertificateAuthorityKey is the pem encoded private key of the certificate authority Requests CertificateRequests `yaml:"requests,omitempty"` // Requests is a list of certificates to use the CA }
CertificatePackage represents a package of certificates
type CertificatePath ¶
type CertificatePath struct { Certificate string `yaml:"cert"` // Certificate is full path of the certificate Key string `yaml:"key"` // Key is full path of the private key }
CertificatePath represents the the full paths for the requested certificate
type CertificateProvider ¶
type CertificateProvider interface { Initialize(options ...CertificateProviderOption) error ParseEncoded(certificate, privateKey []byte) (Certificate, error) Generate(request *CertificateRequest) (Certificate, error) }
CertificateProvider is a generic interface to a provider capable of generate certificates
type CertificateProviderOption ¶
type CertificateProviderOption interface {
Apply(CertificateProvider) error
}
CertificateProviderOption is an option when initalizing a CertificateProvider
type CertificateRequest ¶
type CertificateRequest struct { Key CertificateKeyRequest `yaml:"key"` // Key CommonName string `yaml:"commonName,omitempty"` // CommonName Names []CertificateName `yaml:"names,omitempty"` // Names Hosts []string `yaml:"hosts,omitempty"` // Hosts SerialNumber string `yaml:"serialNumber,omitempty"` // SerialNumber Usage []string `yaml:"usage,omitempty"` // Usage Expires time.Duration `yaml:"expires,omitempty"` // Expires IsCA bool `yaml:"ca,omitempty"` // Certificate Authority Path CertificatePath `yaml:"path"` // Path }
CertificateRequest represents a certificate request
type CertificateRequests ¶
type CertificateRequests []*CertificateKeyRequest
CertificateRequests is a list of certificate requests
type DistinguishedName ¶
type DistinguishedName interface { CommonName() string Countries() []string Provinces() []string States() []string Localities() []string Organizations() []string OrganizationalUnits() []string SerialNumber() *big.Int }
DistinguishedName represents certificate subject information
type Key ¶
type Key interface { Algorithm() KeyAlgorithm Size() int Encoded() []byte PrivateKey() crypto.PrivateKey PublicKeyAlgorithm() x509.PublicKeyAlgorithm PublicKey() crypto.PublicKey SignatureAlgorithm() x509.SignatureAlgorithm }
Key represents a key
type KeyAlgorithm ¶
type KeyAlgorithm int
KeyAlgorithm specifies the type of key algorithm to use
const ( // ECDSAKey specifies the ecdsa algorithm ECDSAKey KeyAlgorithm // RSAKey specifies an RSA key RSAKey )
func ParseKeyAlgorithm ¶
func ParseKeyAlgorithm(in string) (KeyAlgorithm, error)
ParseKeyAlgorithm parses a key algorithm
func (KeyAlgorithm) DefaultSize ¶
func (a KeyAlgorithm) DefaultSize() int
DefaultSize returns the default key size for the specified algorithm
func (KeyAlgorithm) MarshalYAML ¶
func (a KeyAlgorithm) MarshalYAML() (interface{}, error)
MarshalYAML implements custom marshalling for KeyAlgorithm
func (KeyAlgorithm) String ¶
func (a KeyAlgorithm) String() string
func (*KeyAlgorithm) UnmarshalYAML ¶
func (a *KeyAlgorithm) UnmarshalYAML(unmarshal func(interface{}) error) (err error)
UnmarshalYAML implements custom unmarshal for KeyAlgorithm
func (KeyAlgorithm) ValidKeySize ¶
func (a KeyAlgorithm) ValidKeySize(size int) error
ValidKeySize checks if the supplied key size is valid for the KeyAlgorithm