Documentation
¶
Overview ¶
Package crtutil is common certificate related utils for Go.
Index ¶
- Variables
- func CertChainToPEM(chain []*x509.Certificate) ([]byte, error)
- func CertToPEM(cert *x509.Certificate) []byte
- func ParseCertBytes(data []byte) (*x509.Certificate, error)
- func ParseCertChainBytes(data []byte) ([]*x509.Certificate, error)
- func ParseCertChainFile(fpath string) ([]*x509.Certificate, error)
- func ParseCertFile(fpath string) (*x509.Certificate, error)
- func ParseKeyBytes(data []byte, isBase64 bool) (crypto.PrivateKey, error)
- func ParseKeyFile(fpath string) (crypto.PrivateKey, error)
- func ParseKeyFileWithPass(keyPath, keyPass string) (crypto.PrivateKey, error)
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoPEMData = errors.New("no pem data is found") ErrUnknownKeyType = errors.New("unknown private key type in PKCS#8 wrapping") )
Functions ¶
func CertChainToPEM ¶
func CertChainToPEM(chain []*x509.Certificate) ([]byte, error)
CertChainToPEM returns a PEM encoded chain of x509 Certificates, in the order they are passed
func CertToPEM ¶
func CertToPEM(cert *x509.Certificate) []byte
CertToPEM returns a PEM encoded x509 Certificate
func ParseCertBytes ¶
func ParseCertBytes(data []byte) (*x509.Certificate, error)
ParseCertBytes parses a single x509.Certificate from the given data. The data is expected to be PEM Encoded and contain one certificate with PEM type "CERTIFICATE"
func ParseCertChainBytes ¶
func ParseCertChainBytes(data []byte) ([]*x509.Certificate, error)
ParseCertChainBytes parses 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 ParseCertChainFile ¶
func ParseCertChainFile(fpath string) ([]*x509.Certificate, error)
ParseCertChainFile parses the x509.Certificate chain from the given file. The data is expected to be PEM Encoded and contain one of more certificates with PEM type "CERTIFICATE"
func ParseCertFile ¶
func ParseCertFile(fpath string) (*x509.Certificate, error)
ParseCertFile parses x509.Certificate from the given file. The data is expected to be PEM Encoded and contain one certificate with PEM type "CERTIFICATE"
func ParseKeyBytes ¶
func ParseKeyBytes(data []byte, isBase64 bool) (crypto.PrivateKey, error)
ParseKeyBytes parses an unencrypted crypto.PrivateKey from the given data
func ParseKeyFile ¶
func ParseKeyFile(fpath string) (crypto.PrivateKey, error)
ParseKeyFile parses an unencrypted crypto.PrivateKey from the given file
func ParseKeyFileWithPass ¶
func ParseKeyFileWithPass(keyPath, keyPass string) (crypto.PrivateKey, error)
ParseKeyFileWithPass parses an unencrypted crypto.PrivateKey from the given file
Types ¶
This section is empty.