Documentation
¶
Overview ¶
Package crtutil is common certificate related utils for Go.
Index ¶
- Variables
- func EncodeX509ChainToPEM(chain []*x509.Certificate, headers map[string]string) ([]byte, error)
- func EncodeX509ToPEM(cert *x509.Certificate, headers map[string]string) []byte
- func IsSelfSigned(cert *x509.Certificate) bool
- func ReadAsSigner(data []byte, isBase64 bool) (crypto.PrivateKey, error)
- func ReadAsSignerFromFile(fpath string) (crypto.PrivateKey, error)
- func ReadAsSignerWithPassFromFile(keyPath, keyPass string) (crypto.PrivateKey, error)
- func ReadAsX509(data []byte) ([]*x509.Certificate, error)
- func ReadAsX509FromFile(fpath string) ([]*x509.Certificate, error)
Constants ¶
This section is empty.
Variables ¶
var (
ErrUnknownKeyType = errors.New("unknown private key type in PKCS#8 wrapping")
)
Functions ¶
func EncodeX509ChainToPEM ¶ added in v0.1.23
EncodeX509ChainToPEM converts a slice of x509.Certificate into PEM block, in the order they are passed.
func EncodeX509ToPEM ¶ added in v0.1.23
func EncodeX509ToPEM(cert *x509.Certificate, headers map[string]string) []byte
EncodeX509ToPEM converts a x509.Certificate into a PEM block.
func IsSelfSigned ¶ added in v0.1.25
func IsSelfSigned(cert *x509.Certificate) bool
IsSelfSigned whether the given x509.Certificate is self-signed.
func ReadAsSigner ¶ added in v0.1.25
func ReadAsSigner(data []byte, isBase64 bool) (crypto.PrivateKey, error)
ReadAsSigner read a crypto.PrivateKey from the given data.
func ReadAsSignerFromFile ¶ added in v0.1.25
func ReadAsSignerFromFile(fpath string) (crypto.PrivateKey, error)
ReadAsSignerFromFile read a crypto.PrivateKey from the given file.
func ReadAsSignerWithPassFromFile ¶ added in v0.1.25
func ReadAsSignerWithPassFromFile(keyPath, keyPass string) (crypto.PrivateKey, error)
ReadAsSignerWithPassFromFile read a crypto.PrivateKey from the given file.
func ReadAsX509 ¶ added in v0.1.25
func ReadAsX509(data []byte) ([]*x509.Certificate, error)
ReadAsX509 read x509.Certificate chain from the given data. The data is expected to be PEM Encoded and contain one of more certificates with PEM type "CERTIFICATE".
func ReadAsX509FromFile ¶ added in v0.1.25
func ReadAsX509FromFile(fpath string) ([]*x509.Certificate, error)
ReadAsX509FromFile read x509.Certificate from the given file. The data is expected to be PEM Encoded and contain one or more certificates with PEM type "CERTIFICATE".
Types ¶
This section is empty.