Documentation
¶
Index ¶
- Constants
- Variables
- func Encode(b CertBundle) ([]byte, error)
- func GetExtensionValue(cert *x509.Certificate, oid string) (string, error)
- func LoadCert(CaPath, CertPath, KeyPath string) (*tls.Config, error)
- func NewCertPool(certs ...*x509.Certificate) *x509.CertPool
- func ParseDERCert(b []byte) (*x509.Certificate, error)
- func ParseDERKey(der []byte, password string) (crypto.PrivateKey, error)
- func ParsePEM(certBytes, caBytes, keyBytes []byte, password string) (*x509.Certificate, []*x509.Certificate, crypto.PrivateKey, error)
- func ParsePEMCert(b []byte) (*x509.Certificate, []*x509.Certificate, error)
- func ParsePEMKey(b []byte, password string) (crypto.PrivateKey, error)
- func ParsePKCS12(pfxBytes []byte, password string) (*x509.Certificate, []*x509.Certificate, crypto.PrivateKey, error)
- type CABundle
- type CARequest
- type CertBundle
- func Decode(bundleData []byte) (CertBundle, error)
- func MustCertFromFile(certFile, caFile, keyFile string) CertBundle
- func NewCABundleWithoutKey(caBytes []byte) (CertBundle, error)
- func NewCert(cert *x509.Certificate, pool []*x509.Certificate, key crypto.PrivateKey) (CertBundle, error)
- func NewCertBundle(certBytes, keyBytes []byte) (CertBundle, error)
- func NewCertBundleWithoutKey(certBytes []byte) (CertBundle, error)
- type ClientRequest
- type Manager
- type Option
- type ServerRequest
Constants ¶
View Source
const (
Bits2048 = 2048
)
Variables ¶
View Source
var (
DefaultCommonName = "default"
)
View Source
var OIDStringToNameMap = map[string]string{
"2.5.29.14": "Subject Key Identifier",
"2.5.29.15": "Key Usage",
"2.5.29.37": "Extended Key Usage",
"2.5.29.35": "Authority Key Identifier",
"2.5.29.19": "Basic Constraints",
"2.5.29.17": "Subject Alt Name",
"2.5.29.32": "Certificate Policies",
"2.5.29.30": "Name Constraints",
"2.5.29.31": "CRL Distribution Points",
"1.3.6.1.5.5.7.1.1": "Authority Info Access",
"2.5.29.20": "CRL Number",
}
Functions ¶
func Encode ¶
func Encode(b CertBundle) ([]byte, error)
func GetExtensionValue ¶
func GetExtensionValue(cert *x509.Certificate, oid string) (string, error)
Get extension value from certificate with gvien oid
func NewCertPool ¶
func NewCertPool(certs ...*x509.Certificate) *x509.CertPool
func ParseDERCert ¶
func ParseDERCert(b []byte) (*x509.Certificate, error)
func ParseDERKey ¶
func ParseDERKey(der []byte, password string) (crypto.PrivateKey, error)
func ParsePEM ¶
func ParsePEM(certBytes, caBytes, keyBytes []byte, password string) (*x509.Certificate, []*x509.Certificate, crypto.PrivateKey, error)
func ParsePEMCert ¶
func ParsePEMCert(b []byte) (*x509.Certificate, []*x509.Certificate, error)
func ParsePEMKey ¶
func ParsePEMKey(b []byte, password string) (crypto.PrivateKey, error)
func ParsePKCS12 ¶
func ParsePKCS12(pfxBytes []byte, password string) (*x509.Certificate, []*x509.Certificate, crypto.PrivateKey, error)
Types ¶
type CABundle ¶
type CABundle interface {
CertBundle
SignClient(req *ClientRequest) (CertBundle, error)
SignServer(req *ServerRequest) (CertBundle, error)
SignCA(req *CARequest) (CABundle, error)
}
func MustCAFromFile ¶
func NewCA ¶
func NewCA(cert *x509.Certificate, pool []*x509.Certificate, key crypto.PrivateKey) (CABundle, error)
type CertBundle ¶
type CertBundle interface {
CAs() []*x509.Certificate
IsCA() bool
Cert() *x509.Certificate
CertDER() []byte
CertPEM() []byte
CertTLS() tls.Certificate
Key() crypto.PrivateKey
KeyDER() []byte
KeyPEM() []byte
Dump(certFile, keyFile string) error
common.Debuggable
}
func Decode ¶
func Decode(bundleData []byte) (CertBundle, error)
func MustCertFromFile ¶
func MustCertFromFile(certFile, caFile, keyFile string) CertBundle
func NewCABundleWithoutKey ¶
func NewCABundleWithoutKey(caBytes []byte) (CertBundle, error)
func NewCert ¶
func NewCert(cert *x509.Certificate, pool []*x509.Certificate, key crypto.PrivateKey) (CertBundle, error)
func NewCertBundle ¶
func NewCertBundle(certBytes, keyBytes []byte) (CertBundle, error)
func NewCertBundleWithoutKey ¶
func NewCertBundleWithoutKey(certBytes []byte) (CertBundle, error)
type ClientRequest ¶
type Manager ¶
type Manager interface {
CABundle
ClientFiles(req *ClientRequest, certFile, keyFile string) error
ServerFiles(req *ServerRequest, certFile, keyFile string) error
}
type Option ¶
type Option func(m *manager)
func WithCertBytes ¶
func WithCertFile ¶
func WithCommonName ¶
func WithPassword ¶
Click to show internal directories.
Click to hide internal directories.