Documentation ¶
Overview ¶
Package certio provides all operations against certificate.
Package certio provides all operations against certificate.
Package certio provides all operations against certificate.
Index ¶
- Constants
- func BuildTLSConfig(certs CertFilePaths, level string) *tls.Config
- func CreateWebCertificate(cfg CertificateConfiguration) error
- func InitCACertificate(cfg CertificateConfiguration) error
- func InitCaContainer()
- func IssueCertificate(csrString string) (certPem, caPem string)
- func LoadCertificates(c CertFilePaths) ([]byte, tls.Certificate)
- func ParseClientCertOU(r *http.Request) (string, bool)
- type CA
- func (ca CA) CreateTemplate(config settings.CaCertConfig) *x509.Certificate
- func (ca CA) Issue(cacert *x509.Certificate, cert *x509.Certificate, pub interface{}, ...) ([]byte, error)
- func (ca *CA) Load(certPath, privkeyPath string) (*x509.Certificate, *rsa.PrivateKey)
- func (ca *CA) Read(f string) string
- func (ca CA) Save(f string, content []byte) error
- type CertFilePaths
- type CertIO
- type CertificateAuthority
- type CertificateConfiguration
- type CertificateRequest
- type CertificateResponse
- type CertificateSigningRequest
- type PrivateKey
- type WebCertificate
Constants ¶
const ( // PrivateKeyType represents the "RSA Private key" String PrivateKeyType = "RSA PRIVATE KEY" // CertificateType represents the "Certificate" String CertificateType = "CERTIFICATE" )
Variables ¶
This section is empty.
Functions ¶
func BuildTLSConfig ¶
func BuildTLSConfig(certs CertFilePaths, level string) *tls.Config
func CreateWebCertificate ¶
func CreateWebCertificate(cfg CertificateConfiguration) error
func InitCACertificate ¶
func InitCACertificate(cfg CertificateConfiguration) error
func InitCaContainer ¶
func InitCaContainer()
func IssueCertificate ¶
func LoadCertificates ¶
func LoadCertificates(c CertFilePaths) ([]byte, tls.Certificate)
Types ¶
type CA ¶
type CA struct { Bytes []byte // CA cert in []byte String string //CA Cert in string // contains filtered or unexported fields }
func (CA) CreateTemplate ¶
func (ca CA) CreateTemplate(config settings.CaCertConfig) *x509.Certificate
func (CA) Issue ¶
func (ca CA) Issue(cacert *x509.Certificate, cert *x509.Certificate, pub interface{}, priv interface{}) ([]byte, error)
func (*CA) Load ¶
func (ca *CA) Load(certPath, privkeyPath string) (*x509.Certificate, *rsa.PrivateKey)
Load reads certificate and private key from file specified in certPath and privkeyPath, then returns *x509.Certificate and *rsa.PrivateKey of CA
type CertFilePaths ¶
type CertFilePaths struct { CaCertPath string CaPrivKeyPath string WebCertPath string WebPrivKeyPath string }
CertFilePaths is a collection of certificate related file paths
type CertificateAuthority ¶
type CertificateAuthority struct { Certificate *x509.Certificate String string PrivateKey *rsa.PrivateKey // contains filtered or unexported fields }
var CaContainer CertificateAuthority
func (*CertificateAuthority) Cache ¶
func (c *CertificateAuthority) Cache(cert *x509.Certificate, s string, p *rsa.PrivateKey)
Cache saves CA cert and CA private key in memory, and keeps CA cert in PEM encoded string in CertificateAuthority.String
func (CertificateAuthority) IsSet ¶
func (c CertificateAuthority) IsSet() bool
IsSet returns true if certificate and private key are already cached
type CertificateConfiguration ¶
type CertificateConfiguration struct { Paths CertFilePaths Dir string File string // the JSON config file // contains filtered or unexported fields }
CertificateConfiguration has all parameters of certio configuration
var Cfg CertificateConfiguration
func (*CertificateConfiguration) Parse ¶
func (config *CertificateConfiguration) Parse()
Parse initializes the parameters from settings.Settings
type CertificateRequest ¶
type CertificateRequest struct { Request string `json:"csr"` // contains filtered or unexported fields }
func (CertificateRequest) CreateTemplate ¶
func (c CertificateRequest) CreateTemplate(csr *x509.CertificateRequest) *x509.Certificate
func (CertificateRequest) ParsePEMString ¶
func (c CertificateRequest) ParsePEMString(pem string) (*x509.CertificateRequest, error)
type CertificateResponse ¶
type CertificateSigningRequest ¶
type CertificateSigningRequest struct {
Request string `json:"csr"`
}
type PrivateKey ¶
type PrivateKey struct {
// contains filtered or unexported fields
}
func (PrivateKey) Generate ¶
func (p PrivateKey) Generate(keyLen int) (*rsa.PrivateKey, error)
func (PrivateKey) Save ¶
func (p PrivateKey) Save(f string, key *rsa.PrivateKey) error
type WebCertificate ¶
type WebCertificate struct { PrivKey PrivateKey // contains filtered or unexported fields }
func (WebCertificate) CreateTemplate ¶
func (c WebCertificate) CreateTemplate(config settings.WebCertConfig) *x509.Certificate
func (WebCertificate) Read ¶
func (c WebCertificate) Read(f string) string