crtutil

package
v0.1.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 12, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package crtutil is common certificate related utils for Go.

Index

Constants

This section is empty.

Variables

View Source
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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL