Documentation ¶
Index ¶
- type Certificate
- type Option
- func WithCAType() Option
- func WithCN(cn string) Option
- func WithClientType() Option
- func WithDNSNames(dns ...string) Option
- func WithExtKeyUsages(extKeyUsage ...x509.ExtKeyUsage) Option
- func WithIPs(ip ...net.IP) Option
- func WithKeyUsage(keyUsage ...x509.KeyUsage) Option
- func WithOrganizations(org ...string) Option
- func WithServerType() Option
- func WithValidity(validity time.Duration) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Certificate ¶
type Certificate struct {
// contains filtered or unexported fields
}
Certificate is the main structure of a Certificate.
func NewClientCert ¶
func NewClientCert(opts ...Option) *Certificate
NewClientCert create a new Client Certificate.
func NewServerCert ¶
func NewServerCert(opts ...Option) *Certificate
NewServerCert create a new Server Certificate.
func (*Certificate) Gen ¶
func (c *Certificate) Gen() *x509.Certificate
Gen generates a new x509.Certificate.
func (*Certificate) IsCA ¶
func (c *Certificate) IsCA() bool
IsCA return whether the certificate is a CA certificate.
func (*Certificate) IsClientCert ¶
func (c *Certificate) IsClientCert() bool
IsClientCert return whether the certificate is a Client certificate.
func (*Certificate) IsServerCert ¶
func (c *Certificate) IsServerCert() bool
IsServerCert return whether the certificate is a Server certificate.
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option defines optional parameters for initializing the certificate structure.
func WithClientType ¶
func WithClientType() Option
WithClientType is used to set the Client certificate type.
func WithDNSNames ¶
WithDNSNames is used to set the DNS Name values of the certificate.
func WithExtKeyUsages ¶
func WithExtKeyUsages(extKeyUsage ...x509.ExtKeyUsage) Option
WithExtKeyUsages is used to set the x509.ExtKeyUsage values of the certificate.
func WithKeyUsage ¶
WithKeyUsage is used to set the x509.KeyUsage of the certificate.
func WithOrganizations ¶ added in v0.1.6
WithOrganizations is used to set the Organization values of the certificate.
func WithServerType ¶
func WithServerType() Option
WithServerType is used to set the Server certificate type.
func WithValidity ¶
WithValidity is used to set the validity of the certificate.